MathGroup Archive 2000

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

Search the Archive

RE:? D[f,{x,n}]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg25559] RE:[mg25495] ? D[f,{x,n}]
  • From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
  • Date: Sat, 7 Oct 2000 03:36:07 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Jack Goldberg had trouble making it so 
D[f, x]   and   D[f, {x, n}] 
perform some "simplification" on (f) 
before the built in D is used.

I give some code below that does this. 
Notice if you do these examples without  
changing D you get factored polynomials.

Since I don't give a rule for D[f, {x, n}] this 
seems to prove that D[f, {x, n}]  evaluates 
  Nest[ D[#, x]&, f, n ]
or something equivalent.
-----------------------------

In[1]:=
Unprotect[D];
flag=True;

D[f_,x_]/;flag:=
  Block[{flag}, D[Expand[f],x] ]


In[4]:=
D[(x+2)^3,x]

Out[4]=
12 + 12*x + 3*x^2


In[5]:=
D[(x+2)^4,{x,2}]

Out[5]=
48 + 48*x + 12*x^2

--------------------
Notice, inside Block I didn't have to set (flag=False) 
We only care that flag is not True.

--------------------
On a related note, the Help Browser says 
"Derivative is generated when you apply D to a function  
whose derivative Mathematica does not know."  We see Derivative 
in the FullForm below.

In[6]:=
f'[x] //FullForm

Out[6]=
Derivative[1][f][x]


In[7]:=
f''[x] //FullForm

Out[7]=
Derivative[2][f][x]


--------------------
Regards,
Ted Ersek

Get Mathematica tips, tricks from
http://www.verbeia.com/mathematica/tips/Tricks.html



  • Prev by Date: Re: Graphing, Symbolic Manipulation, and Regressions
  • Next by Date: Re: RGB to CMYK
  • Previous by thread: Re: ? D[f,{x,n}]
  • Next by thread: Re: ? D[f,{x,n}]