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:


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


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[58]:= abc [a, e, i, f, c] := e*f*Sin[f]

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

Out[59]= 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

  • 1
    $\begingroup$ Why unprotect D? What happens if you simply use the standard derivative? $\endgroup$ – David G. Stork Jan 6 at 16:48
  • 1
    $\begingroup$ D[f_,e]:= , D[f_,M]:= $\endgroup$ – wuyudi Jan 6 at 16:53
  • $\begingroup$ ah wuyudi that worked perfectly!!! $\endgroup$ – Paul Hughes Jan 6 at 16:55

From Wuyudi, the answer is:

D[f_, e] := ...
D[f_, M] := ...

Not the answer you're looking for? Browse other questions tagged or ask your own question.