home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / e / e032 / 3.ddi / FILES / PROGRAMM.PAK / VECTORCA.M < prev    next >
Encoding:
Text File  |  1992-07-29  |  1.1 KB  |  40 lines

  1.  
  2. (*********************************************************************
  3.  
  4.         Adapted from
  5.         Roman E. Maeder: Programming in Mathematica,
  6.         Second Edition, Addison-Wesley, 1991.
  7.  
  8.  *********************************************************************)
  9.  
  10.  
  11. BeginPackage["VectorCalculus`"]
  12.  
  13. Div::usage = "Div[v, varlist] computes the divergence of
  14.     the vectorfield v w.r.t. the given variables in Cartesian coordinates."
  15.  
  16. Grad::usage = "Grad[s, varlist] computes the gradient of s
  17.     w.r.t. the given variables in Cartesian coordinates."
  18.  
  19. Laplacian::usage = "Laplacian[s, varlist] computes the Laplacian of
  20.     the scalar field s w.r.t. the given variables in Cartesian coordinates."
  21.  
  22. JacobianMatrix::usage = "JacobianMatrix[flist, varlist] computes the Jacobian of
  23.     the functions flist w.r.t. the given variables."
  24.  
  25. Begin["`Private`"]
  26.  
  27. Div[v_List, var_List] := Inner[ D, v, var, Plus ]
  28.  
  29. Grad[s_, var_List] := D[s, #]& /@ var
  30.  
  31. Laplacian[s_, var_List] := Div[ Grad[s, var], var ]
  32.  
  33. JacobianMatrix[f_List, var_List] := Outer[ D, f, var ]
  34.  
  35. End[ ]
  36.  
  37. Protect[ Div, Laplacian, Grad, JacobianMatrix ]
  38.  
  39. EndPackage[ ]
  40.