1

Suppose I have:

mM = {{D[#, x]&, D[#, y]&}, {D[#, y]&, D[#, z]&}} 
v = {f[x, y, z], g[x, y, z]}

I want to get $u=mMv=\{\frac{\partial f}{\partial x}+\frac{\partial g}{\partial y},\frac{\partial f}{\partial y}+\frac{\partial g}{\partial z}\}$.

I know I can do it element by element, but how to do it nicely, using matrix operation or something.

an offer can't refuse
  • 1,745
  • 12
  • 23

1 Answers1

3

Your operation does not work because in this case it is not a matricial multiplication but a composition. Try

 mM = {{D[#, x] &, D[#, y] &}, {D[#, y] &, D[#, z] &}}
 v = {f[x, y, z], g[x, y, z]}
 apply[a_, b_] := Inner[#1[#2] &, a, b]

This answer come from the article http://www.mathematica-journal.com/issue/v8i4/tricks/contents/Tricks8-4_3.html. In this article, the autor uses a_.b_ for apply[a_, b_] but the answer is "Tag Times in a_.\ b_ is Protected. "

The operator must be applied any times for example --- two times

v1 = {x^2 y^2 z^2, x^2 y^2 Log[z]}
v2 = apply[mM, v1]
v3 = apply[mM, v2]
cyrille.piatecki
  • 4,582
  • 13
  • 26