Software for plotting graphs for functions with cases

math-software

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}$$?

Best Answer

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}}]