# How to force mathematica to take derivatives in a specific way? [closed]

I am attempting to take some derivatives of some Lagrange planetary equations. In this I have two types of anomaly which have derivatives that are found geometrically. I'm trying to force mathematica to use the results of these derivatives. I realize that to do this I have defined the derivatives. To get Mathematica to be happy I unprotect D before doing so. Heres my code for that:

Unprotect[D];

D[f, e] := (a/r + (\[Mu]*a)/((\[Mu]*a)^(1/2)*(1 - e^2)^(1/2))^2)*Sin[f]

Unprotect[D];

D[f, M] := (1 + e*Cos[f])^2/(1 - e^2)^(3/2)


Okay so this is all well. When I evaluate D[f,M] or D[f,e] it seems to work correctly; however when I take the derivatives of other functions derivatives don't follow those rules I set above. For example, I made up a simple function to check this:

In:= abc [a, e, i, f, c] := e*f*Sin[f]

In:= D[abc[a, e, i, f, c], e]

Out= f Sin[f]


Uh oh. So my question is how do I get mathematica to match the derivatives I want?

Thanks for all your help

• Why unprotect D? What happens if you simply use the standard derivative? Jan 6, 2021 at 16:48
• D[f_,e]:= , D[f_,M]:= Jan 6, 2021 at 16:53
• ah wuyudi that worked perfectly!!! Jan 6, 2021 at 16:55

D[f_, e] := ...