Re: Derivative of Dot[]

*To*: mathgroup at smc.vnet.net*Subject*: [mg91189] Re: Derivative of Dot[]*From*: David Bailey <dave at Remove_Thisdbailey.co.uk>*Date*: Fri, 8 Aug 2008 07:18:16 -0400 (EDT)*References*: <200808060908.FAA22542@smc.vnet.net> <g7ed8j$2r1$1@smc.vnet.net>

Eitan Grinspun wrote: >>> I differentiate this function w.r.t. its sole argument, F' evaluates >>> to 1.#1+#1.1& >>> This is reasonable, and as expected. >> Expected yes given the way the form F' works, but reasonable? A >> dot product of vector and any other vector is a scalar. If you >> give specific values for the vector components, I would think it >> would be reasonable to return a value zero. Further, the >> gradient of a vector isn't given by the derivative of the dot >> product. Instead, it is the sum of partial derivatives of each >> component with respect to the corresponding basis function. That >> is the gradient of vector {x, y w, z^2} is given by >> >> In[27]:= Tr@D[{x, y w, z^2}, {{x, y, z}}] >> >> Out[27]= w+2 z+1 > > I would say that the derivative of x.x with respect to some other > vector y is given by 2x.(dx/dy), where dx/dy is a tensor. When > mathematica returns 1.#1+#1.1&, it is reasonable if the 1 is > interpreted as the identity map, so that, e.g., > (#1.1&)[x].(dx/dy)=x.1.(dx/dy)=x.(dx/dy). Unfortunately, x.1 does not > simplify to x, as it would if 1 were interpreted as the identity map. > > Eitan > Forgetting for a moment what may or may not be reasonable, the best way to pursue such calculations is to define your own grad (say) operation. If it is going to operate on mixed scalar/vector expressions where the vectors are just symbols, you will have to provide a method by which your code can identify vectors - say: isVector[x_]:=MemberQ[{v1,v2,v3},x]; isVector[_]:=False; David Bailey http://www.dbaileyconsultancy.co.uk

**References**:**Re: Derivative of Dot[]***From:*Bill Rowe <readnews@sbcglobal.net>