Mathematica:绘制分段函数的导数

Kev*_*n C 2 wolfram-mathematica piecewise

我试图在Mathematica中绘制一个mollifier函数的导数.它区分OK功能,并可以绘制使用功能%,但我想能够通过分配导数是一个函数来绘制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 *)
Run Code Online (Sandbox Code Playgroud)

rat*_*osk 5

尝试使用 Plot[Evaluate[f[t]], {t, -1, 1}]

对于用户定义的函数,Plot有点挑剔.