# How to Clear derivative definitions?

I can't find a Clear or ClearAll command that gets rid of Derivative definitions I created. this code:

ClearAll["Global*"];
gau[x_, v_] = (1/Sqrt[2*Pi*v])*E^-((x^2)/(2*v));
Derivative[0, n_][p][x, v] := Simplify[D[gau[z, v], {v, n}]];
ClearAll["Global*"];
gau[x_, v_] = (1/Sqrt[2*Pi*v])*E^-((x^2)/(2*v));
Derivative[0, n_][p][x, v] := Simplify[D[gau[z, v], {v, n}]/gau[z, v]];
D[p[x, v], {v, 2}]


produces output consistent with the 1st definition, not the second.

• Mar 5, 2015 at 7:21

First of all you most likely want to define your functions with patterns x_, y_ instead of fixed symbols x, y. Second, you can use Unset to achieve what (I think) you want. This is needed because Derivative is not in the Global context, but instead in the System context. So your ClearAll command doesn't affect it. But you also don't want to just say ClearAll[Derivative] because that may remove definitions you still need. Unset is more specific. You use it as follows:
Derivative[0,n_][p][x_,v_]=.

This can still be combined with the ClearAll["Global*"]; that you already had, to make sure other definitions are removed.
• Since Derivative is not protected, ClearAll[Derivative] would indeed affect its properties. E.g., I checked SubValues[Derivative] before and after, and there is a difference...