MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

? D[f,{x,n}]

  • To: mathgroup at
  • Subject: [mg25495] ? D[f,{x,n}]
  • From: Jack Goldberg <jackgold at>
  • Date: Thu, 5 Oct 2000 23:50:15 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

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.

  • Prev by Date: RE: making a function linear
  • Next by Date: Exporting multiple page graphics
  • Previous by thread: Re: Syntax
  • Next by thread: Re: ? D[f,{x,n}]