In which software it will be easy to plot the graph of functions like $$f_{2^n+j}(x)=\begin{cases}0, x\in [\frac{j}{2^n},\frac{j+1}{2^n}]\\1, x\in x<\frac{j}{2^n} \text{ or } x>\frac{j+1}{2^n}\end{cases}$$?
Asked
Active
Viewed 97 times
1 Answers
2
In Mathematica you can use Piecewise
f[j_, n_, x_] =
Piecewise[{{0, j/2^n <= x && x <= (j + 1)/2^n}, {1, x < j/2^n || x > (j + 1)/2^n}}]
14159
- 935
-
when I do as you say I get this (added a pic). How to handle this error? – Mokhmad-Salekh Khekhaev Oct 20 '21 at 20:34
-
I need installed software or I can do it online? – Mokhmad-Salekh Khekhaev Oct 20 '21 at 21:02
-
I downloaded Mathematica. Your code does not work for me. Does it work for you? – Mokhmad-Salekh Khekhaev Oct 21 '21 at 07:41
-
1@Mokhmad-SalekhKhekhaev The program works for me. What error message do you get? Instead of Mathematica you can use an online graphing calculator like desmos or geogebra (here is the same function using desmos: https://www.desmos.com/calculator/dyjnnakdzb. You can move the sliders to test different values of $n$ and $j$) – 14159 Oct 21 '21 at 08:54