2

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!

space_voyager
  • 841
  • 4
  • 11
  • 1
    Some quantities are undefined and their dimensions thus unclear. In the absence of that info, my best guess is that this is a possible duplicate of Quick Hessian matrix and gradient calculation?, specialized to n=1 (i.e., first derivatives). – Jens Jul 31 '15 at 22:20
  • @Jens, as I said they are 3x1 lists. I updated the quesiton to include the definition of m[1] and m[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:23
  • It's easier for people to get started on this if you give examples of gvecI and x. 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
  • @Jens they are just symbols that should behave as [3x1] vectors. The values can be anything, but the whole point is that I do not want them to have values - I want the operation to be done on the raw symbols, as the LaTeX equation shows. – space_voyager Jul 31 '15 at 22:32
  • OK, then I initially misunderstood your question. It's not a duplicate of the Q I linked earlier. – Jens Jul 31 '15 at 22:35
  • @Jens No problem. I wish it was... I need the solution and I can't figure out how. – space_voyager Jul 31 '15 at 22:48
  • I have the same problem. It is 2019 now. seems no progress over the last four years. – Yordan Aug 07 '19 at 01:56

0 Answers0