Why do you keep ignoring D[{f1, f2}, {{x1, x2}}]
, which a couple of others have mentioned? (Assumes f1 = x1^2 + x2^2; f2 = x1 x2
.)
Is it just because it's not named "Jacobian"? It's one of the problems when we adopt a person's name as the basis for calling a common object, such as the derivative, something else. (Of course, I believe the "Jacobian matrix" came into use before a vector-matrix-tensor view of multivariate functions and their derivatives became dominant. So there's a historical reason why "Jacobian" is used.)
Anyway, D[{f1, f2}, {{x1, x2}}]
is shorter than Jacobian[{f1, f2}, {x1, x2}]
. And so is Grad[{f1, f2}, {x1, x2}]
, which also works.
D[{f1, f2}, {{x1, x2}}]
is the currently documented way to calculate the Jacobian (in the docs for D[]
). The method from the version 2 Mathematica book is Outer[D, {f1, f2}, {x1, x2}]
, which also appears in the docs for D[]
. When I search the help center for "jacobian" (lower case), D[]
is the fourth hit in the desktop documentation; it's a disappointing eighth in the online docs, after the despisèd "JacobianMatrix"
resource function.
You mentioned large sets of equations. It's not exactly clear what you mean, but here's what I do when I have equations and variables that I don't want retype. You need a list of the variables, and their order matters usually. If you can name them such that Sort[]
puts them in the desired order, then great, you can just extract the variables from the formulas and Union[]
them. Otherwise, you'll probably have to type them by hand.
vars = {x1, x2, x3, x4};
funcs ={f1, f2, f3, f4}; (* pretend they've been defined in terms of vars *)
jac = D[funcs, {vars}]