
(*********************************************************************

        Adapted from
        Roman E. Maeder: Programming in Mathematica,
        Second Edition, Addison-Wesley, 1991.

 *********************************************************************)


BeginPackage["VectorCalculus`"]

Div::usage = "Div[v, varlist] computes the divergence of
	the vectorfield v w.r.t. the given variables in Cartesian coordinates."

Grad::usage = "Grad[s, varlist] computes the gradient of s
	w.r.t. the given variables in Cartesian coordinates."

Laplacian::usage = "Laplacian[s, varlist] computes the Laplacian of
	the scalar field s w.r.t. the given variables in Cartesian coordinates."

JacobianMatrix::usage = "JacobianMatrix[flist, varlist] computes the Jacobian of
	the functions flist w.r.t. the given variables."

Begin["`Private`"]

Div[v_List, var_List] := Inner[ D, v, var, Plus ]

Grad[s_, var_List] := D[s, #]& /@ var

Laplacian[s_, var_List] := Div[ Grad[s, var], var ]

JacobianMatrix[f_List, var_List] := Outer[ D, f, var ]

End[ ]

Protect[ Div, Laplacian, Grad, JacobianMatrix ]

EndPackage[ ]
