matheca中的误导性情节问题
我想通过在数学中绘制一些“奇怪”的函数来研究它们。一个例子如下:
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}]
然而,我从 mma 得到的图具有误导性,因为 fn[x, 5]
的最大值和最小值应该位于相同的两个水平上。但由于函数的高度振荡,并且显然 mma 仅需要有限数量的点来绘制函数,您会看到该图表现出奇怪的行为。情节中有什么选项可以解决这个问题吗?
非常感谢。
I want to study some "strange" functions by plotting them out in mathematica. 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 plot I got from mma is misleading, in the sense that the maxima and minima of fn[x, 5]
should be on the same two levels. But due to high oscillation of the function, and the fact that clearly mma only takes limited number of points to draw the function, you see the plot exhibit strange behavior. Is there any option in plot to remedy for this?
Many thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要大幅增加 PlotPoints 的设置才能获得“良好”的结果。
(我还颠倒了函数的顺序,以便能够看到所有曲线。)
You need to increase the setting for PlotPoints quite a bit to get a 'good' result.
(I also reversed the order of the functions, so as to be able to see all the curves.)