Suppose I have a vector function of $n$ components and it has $n+m$ arguments,
$$\vec{f}(x_1,x_2,\dots,x_n, y_1, y_2, \dots, y_{m})$$
where $n, m $ are around 10. I want to create a Jacobian matrix over $\vec{x}$ only, $$J_{ij} = \frac{\partial f_i}{\partial x_j},$$ and then use it as a function. However, since I have a lots of arguments, it is really messy easy to make mistake when I create the table. For example, $n=10$ and $m=5$, then $J_{6,5}$ is
J[x1_,x2_,x3_,x4_,x5_,x6_,x7_,x8_,x9_,x10_,y1_,y2_,y3_,y4_,y5_][[6,5]]:=Derivative[0,0,0,0,1,0,0,0,0,0,0,0,0,0,0][f][x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,y1,y2,y3,y4,y5][[6]]
which is a nightmare for me. How to do it in a more efficient way such that I don't have to deal with all the arguments?
The operation D[{f1,f2,...},{{x1,x2,...}}] does not work, like,
u1[x1_, x2_] := x1*x2;
u2[x1_, x2_] := x1 - x2;
J[x1_, x2_] := D[{u1[x1, x2], u2[x1, x2]}, {{x1, x2}}];
J[1, 1]
it returns error
General::ivar: 1 is not a valid variable. >>
Differentiation. – b.gates.you.know.what Mar 31 '15 at 10:07D[{f1, f2, f3}, {{x1, x2, x3, x4}}]. – b.gates.you.know.what Mar 31 '15 at 10:24u1[x1_, x2_] := x1*x2; u2[x1_, x2_] := x1 - x2; J[x1_, x2_] := D[{u1[x1, x2], u2[x1, x2]}, {{x1, x2}}]; J[1, 1]
it returns error General::ivar: 1 is not a valid variable. >>
– mastrok Mar 31 '15 at 10:33vars={x1, x2, ...}and then doD[{f1, f2, ...}, {vars}]. – b.gates.you.know.what Mar 31 '15 at 10:41