【发布时间】:2012-12-05 12:23:53
【问题描述】:
我正在尝试在 Mathematica 中绘制缓和函数的导数。它可以区分函数,并且可以使用% 绘制函数,但我希望能够通过将导数指定为函数f[t_],然后Plot[ f[t] , {t,-1,1} ] 来绘制。
我不确定如何解决出现的错误。
Mathematica 代码是:
Clear[moll, f]
moll[x_] :=
Piecewise[ { {E^(-1/(1 - x^2)), -1 < x < 1} , {0,x <= -1 || x >= 1} } ]; (* Standard mollifier *)
f[t_] := D[ moll[t] , t]
f[t]
Plot[%, {t, -1, 1}] (* this line works *)
Plot[f[t], {t, -1, 1}] (* this line comes up with an error *)
【问题讨论】:
-
如果您评估例如
f[2],你会明白为什么情节不起作用。您可以将函数定义为f[t_] = D[ moll[t] , t](Set而不是SetDelayed)
标签: wolfram-mathematica piecewise