gpt4 book ai didi

wolfram-mathematica - 数学 : Plot the derivative of a piecewise function

转载 作者:行者123 更新时间:2023-12-04 08:16:20 24 4
gpt4 key购买 nike

我正在尝试在 Mathematica 中绘制缓和函数的导数。它区分函数 OK,并且可以使用 % 绘制函数,但我希望能够通过将导数指定为函数 f[t_] 来绘制,然后 绘制[ 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 *)

最佳答案

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

当涉及到用户定义的函数时,Plot 有点挑剔。

关于wolfram-mathematica - 数学 : Plot the derivative of a piecewise function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13723201/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com