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'
?
To clear all definitions of quantities you've introduced in a Mathematica session so far, type: ClearAll["Global'*"].
Clear removes values and definitions from a symbol while ClearAll removes attributes, messages and any default options as well as values and definitions from a symbol.
When in a notebook, <Control>+a will select all cells and <delete> will remove them from your screen, and it will appear as if you have just opened Mathematica. You can't autoamte this (put it in a script), but it's handy if you're just doing some calculations.
This should do what you want:
y'[x_] =.
See Unset
. Also see this question for related information.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With