BeginPackage["CSM`DivGrad`"]

	(* simple vector calculus in Cartesian coordinates *)

Div::usage = "Div[v, varlist] computes the divergence of the vector field v
	w.r.t. the Cartesian coordinates varlist."

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

Grad::usage = "Grad[s, varlist] computes the gradient of the scalar field s
	w.r.t. the variables varlist."

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

Begin["`Private`"]

protected = Unprotect[{Jacobian}]

Div[v_List, vars_List] := Inner[D, v, vars, Plus]

Grad[s_, vars_List] := Map[ Function[{v}, D[s, v]], vars ]

Laplacian[s_, vars_List] := Div[ Grad[s, vars], vars ]

Jacobian[f_List, vars_List] := Outer[D, f, vars]

Protect[Evaluate[protected]]

End[]

EndPackage[]
