Mathematica clear a function's derivative definition

匆匆过客 提交于 2019-12-10 16:27:29

问题


I defined the derivative of a function in Mathematica without defining the function itself, i.e. I have a function definition that looks like this:

y'[x_] := constant * f'[x].

I can't figure out how to clear it out. If I use Clear[y'] or `ClearAll[y'], I get an error message:

ClearAll::ssym: y' is not a symbol or a string.

Clear[y] and ClearAll[y] do nothing to remove the definition of y'.

Any ideas on how I can remove the definition of y'?


回答1:


This should do what you want:

y'[x_] =.

See Unset. Also see this question for related information.




回答2:


You can use Remove[y]. For a function name f' is unusual syntax, but it does appear in the documentation for derivative: http://reference.wolfram.com/mathematica/ref/Derivative.html

The derivative name form seems to present a bit of a problem for Information (??), which would usually show attribute information.

y'[x_] := constant*f'[x]
y'[4]
??y

constant f'[4]

Global`y

Remove[y]
??y

Information::notfound : Symbol y not found. >>

y'[4]

y'[4]

But oddly, (and nothing to do with the derivative name form):

Information[y]

Global`y

There is some deeper information about Remove here: https://mathematica.stackexchange.com/questions/4921/what-is-the-story-with-removed-symbols



来源:https://stackoverflow.com/questions/12454887/mathematica-clear-a-functions-derivative-definition

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!