Re: ? D[f,{x,n}]
- To: mathgroup at smc.vnet.net
- Subject: [mg25548] Re: ? D[f,{x,n}]
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Sat, 7 Oct 2000 03:35:52 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <8rjioe$oea@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, you should no change D[f,x] or D[f,{x,n}] you should change the definition of Derivative[n][f][__] and only use the unique version Derivative[1][f][__] in your case. Regards Jens Jack Goldberg wrote: > > Hi folks, > > I am touching up a package I have worked on for a number of years. > Rather than send it off as is, I keep tweeking it to improve its > usefulness. I should know better... My latest tweek leads me to > a problem with D[f,{x,n}]. Here's the story: > > In my package I define a constant "flag" which I set true: flag = True. > > Then I Unprotect D: Unprotect[D]: I want to modify f before the built-in > D fires so I write a little program: > > D[f_,x_]/;flag := Block[ {flag=False}, > D[ mySimplification[f],x] > ] > > So, what I think happens is this. Since flag = True and since Mathematica uses > my definition of D before its own, this little snippet fires. Block sets > flag = False, mySimplification[f] fires, and my definition of D does not > fire again (or I would be caught in a loop) so Mathematica's definition of D > now works and I have accomplished my aim which is to simplify f before > taking the derivative. This seems to work. However, this idea fails to > work for D[f,{x,n}]! Here's my code: > > D[f_,{x_,n_}]/;flag := Block[ {flag=False}, > D[ mySimplification[f],{x,n} ] > ] > > (Of course, the nature of mySimplification should be irrelevant.) > > While trying to work out this problem, I discovered that I don't > understand the difference between D[f,x] and D[f,{x,1}]. If I > alter the definition of D[f,x] have I also altered the definition > of D[f,{x,1}]? How about the other way around? If I alter the > definiton of D[f,{x,1}] does this alter the definition of D[f,x]? > It seems as though they should be linked internally but if so, > I can find no reference to this linkage. This not a mute point since > I found that in trying to use mySimplification in both D[f,x] and > D[f,{x,n}] it is necessary to know what happens if a user chooses to > write D[f,x] in the form D[f,{x,n}]. > > Help is needed. Thanks. >