%mathpiper,def="JacobianMatrix"

// The arguments of the following functions should be checked
// this takes N funcs in N vars
JacobianMatrix(f,v):=GenMatrix({{i,j},Deriv(v[j])f[i]},Length(f),Length(f));

%/mathpiper



%mathpiper_docs,name="JacobianMatrix",categories="User Functions;Matrices (Special)"
*CMD JacobianMatrix --- calculate the Jacobian matrix of $n$ functions in $n$ variables
*STD
*CALL
	JacobianMatrix(functions,variables)

*PARMS

{functions} -- an $n$-dimensional vector of functions

{variables} -- an $n$-dimensional vector of variables

*DESC

The function {JacobianMatrix} calculates the Jacobian matrix
of n functions in n variables.

The ($i$,$j$)-th element of the Jacobian matrix is defined as the derivative
of $i$-th function with respect to the $j$-th variable.

*E.G.

In> JacobianMatrix( {Sin(x),Cos(y)}, {x,y} ); 
Result: {{Cos(x),0},{0,-Sin(y)}};
In> PrettyForm(%)

	/                                 \
	| ( Cos( x ) ) ( 0 )              |
	|                                 |
	| ( 0 )        ( -( Sin( y ) ) )  |
	\                                 /
%/mathpiper_docs