I have the expression:
Transpose[gvecI, {2, 1}].x (m[1] + m[2])
gvecI and x are [3x1] vectors while m[1] and m[2] are scalars, not important for this problem other than to point out that the solution should handle the existence of multiplication by scalars in the expression. I need to take a derivative with respect to x. Currently I have:
In= D[Transpose[gvecI, {2, 1}].x (m[1] + m[2]), x]
Out= Transpose[gvecI, {2, 1}].1 (m[1] + m[2])
However, I need instead:
Out= IdentityMatrix[3].gvecI (m[1]+m[2])
This is because we know from math that:
$$ \vec \nabla(\vec g\cdot\vec x)=[\vec\nabla(\vec g)]\vec x+[\vec\nabla(\vec x)]\vec g $$
What is the appropriate operation in Mathematica? Thanks a lot!
n=1(i.e., first derivatives). – Jens Jul 31 '15 at 22:20m[1]andm[2]. It is not the same as the Hessian calculation as I want to keep things fully symbolic (i.e. indicate a derivative rather than actually do one). – space_voyager Jul 31 '15 at 22:23gvecIandx. Otherwise it's not clear if they have values at all, or are supposed to be just symbols about which we make certain assumptions. – Jens Jul 31 '15 at 22:30