I want to learn some “weird” functions by building them in math. One example is the following:
mod2[x_] := Which[Mod[x, 2] >= 1, -2 + Mod[x, 2], True, Mod[x, 2]];
f[x_] := Which[-1 <= x <= 1, Abs[x], True, Abs[mod2[x]]];
fn[x_, n_] := Sum[(3/4)^i*f[4^n*x], {i, 0, n}]
Plot[{fn[x, 0], fn[x, 1], fn[x, 2], fn[x, 5]}, {x, -2, 2}]
However, the graph I received from mma is misleading in the sense that the highs and lows fn[x, 5]
should be at the same level. But due to the high fluctuation of the function and the fact that it is clear that mma uses only a limited number of points to draw the function, you see that the plot exhibits strange behavior. Is there any plan option to fix this?
Many thanks.
source
share