misleading plot issue in mathematica -


i want study "strange" functions plotting them out in mathematica. 1 example 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, plot got mma misleading, in sense maxima , minima of fn[x, 5] should on same 2 levels. due high oscillation of function, , fact mma takes limited number of points draw function, see plot exhibit strange behavior. there option in plot remedy this?

plot of fn

many thanks.

you need increase setting plotpoints quite bit 'good' result.

plot[evaluate[   reverse[{fn[x, 0], fn[x, 1], fn[x, 2], fn[x, 5]}]], {x, -2, 2},   plotpoints -> 4000] 

(i reversed order of functions, able see curves.) enter image description here


Comments

Popular posts from this blog

razor - Is this a bug in WebMatrix PageData? -

iphone - Requiring the presence of a method in an id -

xslt - Is it possible to select a node that just includes a subset of the child nodes? -