Re: Incoherent value for partial derivative
- To: mathgroup at smc.vnet.net
- Subject: [mg91068] Re: Incoherent value for partial derivative
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Tue, 5 Aug 2008 04:02:26 -0400 (EDT)
On 8/4/08 at 3:26 AM, misvrne at gmail.com (Miguel) wrote: >Let >In[1]: g[x_]:=3x^2+5x; FullForm[g'[x]] >Out[1]: Plus[5,Times[6,x]] >In[2]: g'[2] Out[2]: 17 >Mathematica works fine and the result is correct. First, it executes >the derivation and then the delayed substitution/assignation. Unless I had either tested this or found something specific in the documentation to say things would work this way, I would not have relied on this particular sequence of execution. Without checking, I would have expected Mathematica to substitute a particular value for x then take the derivative getting 0 since f evaluates as a constant. >But for partial derivative Mathematica works different way (not >correspondig to FullForm This really isn't a correct conclusion. FullForm[expr] gives the form corresponding to the evaluation of expr. >In[3]: f[x_,y_]:=x^2+x y^2; FullForm[\!\( >\*SubscriptBox[\(\[PartialD]\), \(x\)]\ \(f[x, y]\)\)] >Out[3]: Plus[Times[2,x],Power[y,2]] >In[4]: \!\( \*SubscriptBox[\(\[PartialD]\), \(x\)]\ \(f[1, 2]\)\) >Out[4]: 0 Here, the sequence of evaluation is more along the lines of what I would expect. That is values for x and y are substituted resulting in a real value then the derivative is computed. You can verify this works as I've described by using Trace.