Re: Incoherent value for partial derivative
- To: mathgroup at smc.vnet.net
- Subject: [mg91110] Re: Incoherent value for partial derivative
- From: Albert Retey <awnl at gmx-topmail.de>
- Date: Wed, 6 Aug 2008 05:07:04 -0400 (EDT)
- References: <g76auv$dks$1@smc.vnet.net>
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. But for > partial derivative Mathematica works different way (not correspondig > to FullForm > > 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 > > I dont understand the reason. Others have answered your question, but there is something that might make clearer what the reason for this might be, at least as far as I can tell: g' is just a short notation for Derivative[1][g] which, as others have mentioned, works correctly if there are suitable definitions for g even without arguments given. The same is true for the more general forms of Derivative, e.g. Derivative[0,1][f], for which there is also a nice notation in StandardForm, which you can generate by evaluating it for an f with no definition. The reason why it works (and can work) is because both notations implicitly work by positional arguments. On the other hand D[f[x,y],y] and the nicer looking StandardForm-Notation with \[PartialD] you have used work with the names of the arguments, and of course can only work correctly when arguments are given. To my understanding this is the deeper reason why g'[x] and \!\(\*SubscriptBox[\(\[PartialD]\), \(x\)]\ \(f[x, y]\)\) behave so differently. hth, albert This will create the Standard-Form Notation for Derivative[1,0][f] if evaluated in a notebook: SuperscriptBox["f", TagBox[ RowBox[{"(", RowBox[{"1", ",", "0"}], ")"}], Derivative ]] // DisplayForm