Defining your own Derivative
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg810] Defining your own Derivative
- From: P.Jemmer at sussex.ac.uk (Patrick Jemmer)
- Date: Fri, 21 Apr 1995 01:49:36 -0400
- Organization: University of Sussex
I have a problem where I need to do something like the following, and define a slightly new "derivative" operator: (* define variables *) x1:=mRi/R^(4/3) y1:=x1^2-Rii/R^(5/3) (* define derivatives of derivatives *) (* this bit works ok *) Unprotect[D] D[mRi,ri]:=Rij*Rj/mRi D[R,ri]:=Ri D[Ri,ri]:=Rii D[Rj,ri]:=Rij D[Rii,ri]:=Rjji D[Rij,ri]:=Riij D[Riij,ri]:=Riiji D[Rjji,ri]:=Rjjii (* define derivatives of variables *) (* However there are problems _here_ *) D[x,ri]:=D[x1,ri] D[y,ri]:=D[y1,ri] ----- For example if I try to look at D[x,ri] I get the answer 0, rather than the answer D[mRi/R^(4/3),ri]. How do I make MMA apply the cahin rule (or whatever) to these new definitions of "D". Do I explicitly have to redefine, for example: D[a_/b_,ri]:=(1/b)*D[a,ri]-(a/b^2)*D[b,ri] ? The problem is that I initially defined a whole new function "df" and wrote out all these properties so that it worked, and I was looking for something a little more elegant. Cheers, Padz. ------- Patrick Jemmer, Theoretical Chemistry, Sussex University.