home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / e / e032 / 3.ddi / FILES / CALCULUS.PAK / VECTORAN.M < prev   
Encoding:
Text File  |  1992-07-29  |  35.2 KB  |  892 lines

  1.  
  2. (* :Name: Calculus`VectorAnalysis` *)
  3.  
  4. (* :Title: Three-Dimensional Vector Analysis *)
  5.  
  6. (* :Author: Stephen Wolfram, Bruce K. Sawhill, Jerry B. Keiper *) 
  7.  
  8. (* :Summary:
  9.     This package performs standard vector differential operations in 
  10.     orthogonal coordinate systems.  Coordinate transformations are 
  11.     also provided.
  12. *)  
  13.  
  14. (* :Context: Calculus`VectorAnalysis` *)
  15.  
  16. (* :Package Version: 2.0 *)
  17.  
  18. (* :Copyright: Copyright 1990  Wolfram Research, Inc.
  19.     Permission is hereby granted to modify and/or make copies of
  20.     this file for any purpose other than direct profit, or as part
  21.     of a commercial product, provided this copyright notice is left
  22.     intact.  Sale, other than for the cost of media, is prohibited.
  23.  
  24.     Permission is hereby granted to reproduce part or all of
  25.     this file, provided that the source is acknowledged.
  26. *)
  27.  
  28. (* :History:
  29.     Extensively revised by Jerry B. Keiper, November, 1990.
  30.     Revised by Bruce K. Sawhill, August, 1990.
  31.     Version 1.0 by Stephen Wolfram, 1988.
  32. *)
  33.  
  34. (* :Keywords:
  35.     coordinates, orthogonal coordinates, curvilinear coordinates,
  36.     div, curl, grad, Laplacian, biharmonic, Jacobian, coordinate
  37.     systems, coordinate transformations, Cartesian, cylindrical,
  38.     spherical, parabolic cylindrical, paraboloidal, elliptic
  39.     cylindrical, prolate spheroidal, oblate spheroidal, bipolar,
  40.     bispherical, toroidal, conical, confocal ellipsoidal, confocal
  41.     paraboloidal.
  42. *)
  43.     
  44. (* :Source:
  45.     Murray R. Spiegel, Schaum's Mathematical Handbook of 
  46.     Formulas and Tables, McGraw-Hill, New York, 1968, pp. 116-130.
  47.  
  48.     Philip M. Morse and Herman Feshbach, Methods of Theoretical
  49.     Physics, McGraw-Hill, New York, 1953.
  50.  
  51.     George B. Arfken, Mathematical Methods for Physicists, 3rd ed.,
  52.     Academic Press, New York, 1985.
  53. *)
  54.  
  55. (* :Mathematica Version: 2.0 *)
  56.  
  57. (* :Limitation:
  58.     The branches associated with the signs of the square roots in the
  59.     coordinate transformations between Cartesian coordinates and
  60.     confocal ellipsoidal or confocal paraboloidal cannot be dealt
  61.     with in the manner used in this package.  In particular the
  62.     transformation from the confocal ellipsoidal system always gives
  63.     a point in the octant with x, y, z > 0.  The transformation from
  64.     the confocal paraboloidal coordinate system always gives a point
  65.     in the quadrant with x, y > 0.
  66.     
  67.     Only right-handed coordinate systems are implemented.
  68.  
  69.     Parameters and coordinates cannot take on complex values in some
  70.     of the coordinate systems.
  71.  
  72.     Only three-dimensional coordinate systems are implemented.
  73. *)
  74.  
  75. BeginPackage["Calculus`VectorAnalysis`"]
  76.  
  77. DotProduct::usage = "DotProduct[v1, v2] gives the dot product (sometimes
  78. called inner product or scalar product) of the two vectors v1, v2 in three
  79. space in the default coordinate system.  DotProduct[v1, v2, coordsys] gives
  80. the dot product of v1 and v2 in the coordinate system coordsys."
  81.  
  82. CrossProduct::usage = "CrossProduct[v1, v2] gives the cross product
  83. (sometimes called vector product) of the two vectors v1, v2 in three space
  84. in the default coordinate system.  CrossProduct[v1, v2, coordsys] gives
  85. the cross product of v1 and v2 in the coordinate system coordsys."
  86.  
  87. ScalarTripleProduct::usage = "ScalarTripleProduct[v1, v2, v3] gives the scalar
  88. triple product of the three vectors v1, v2, and v3 in three space in the
  89. default coordinate system.  ScalarTripleProduct[v1, v2, v3, coordsys] gives
  90. the scalar triple product of v1, v2, and v3 in the coordinate system coordsys."
  91.  
  92. SetCoordinates::usage = "SetCoordinates[coordsys] sets the default
  93. coordinate system to be coordsys with default variable names.
  94. SetCoordinates[coordsys[x, y, z]] sets the default coordinate system to be
  95. the specified coordinate system with variable names x, y, and z.  Certain
  96. coordinate systems have parameters associated with them, and these
  97. parameters can be set by specifying the full description of the coordinate
  98. system, as in SetCoordinates[Conical[lambda, mu, nu, a, b]]."
  99.  
  100. CoordinateSystem::usage = "CoordinateSystem gives the name of the default
  101. coordinate system."
  102.  
  103. Coordinates::usage = "Coordinates[ ] gives a list of the default names of
  104. the coordinate variables in the default coordinate system.
  105. Coordinates[coordsys] gives a list of the default names of coordinate variables
  106. in the coordinate system coordsys."
  107.  
  108. Parameters::usage = "Parameters[ ] gives a list of the default parameters
  109. of the default coordinate system.  Parameters[coordsys] gives a list of the
  110. default parameters in the coordinate system coordsys.  (Many of the
  111. coordinate systems do not have parameters.)"
  112.  
  113. CoordinateRanges::usage = "CoordinateRanges[ ] gives the intervals over which
  114. each the of the coordinates in the default coordinate system may range.
  115. CoordinateRanges[coordsys] gives the ranges for each of the coordinates
  116. in the coordinate system coordsys."
  117.  
  118. ParameterRanges::usage = "ParameterRanges[ ] gives the intervals over which
  119. each the of the parameters (if any) in the default coordinate system may range.
  120. ParameterRanges[coordsys] gives the ranges for each of the parameters in
  121. the coordinate system coordsys."
  122.  
  123. CoordinatesToCartesian::usage =
  124. "CoordinatesToCartesian[pt] gives the Cartesian coordinates
  125. of the point pt given in the default coordinate system.
  126. CoordinatesToCartesian[pt, coordsys] gives the Cartesian
  127. coordinates of the point given in the coordinate system coordsys."
  128.  
  129. CoordinatesFromCartesian::usage =
  130. "CoordinatesFromCartesian[pt] gives the coordinates in the
  131. default coordinate system of the point pt given in Cartesian coordinates.
  132. CoordinatesFromCartesian[pt, coordsys] gives the coordinates
  133. in the coordinate system coordsys of the point given in Cartesian coordinates."
  134.  
  135. ScaleFactors::usage = "ScaleFactors[pt] gives a list of the scale factors
  136. at the point pt in the default coordinate system.  ScaleFactors[pt, coordsys]
  137. gives a list of the scale factors at the point pt in the coordinate system
  138. coordsys.  If pt is not given, the default names of coordinate variables are
  139. used."
  140.  
  141. ArcLengthFactor::usage = "ArcLengthFactor[pt, t] gives the derivative of
  142. the arc length of a curve given by pt with respect to the parameter t in
  143. the default coordinate system.  ArcLengthFactor[pt, t, coordsys] gives the
  144. derivative of the arc length of a curve given by pt with respect to the
  145. parameter t in the coordinate system coordsys. If pt is not given, the
  146. default names of coordinate variables are used."
  147.  
  148. JacobianDeterminant::usage = "JacobianDeterminant[pt] gives the determinate
  149. of the Jacobian matrix of the transformation from the default coordinate
  150. system to the Cartesian coordinate system at the point pt.
  151. JacobianDeterminant[pt, coordsys] gives the determinate of the Jacobian
  152. matrix of the transformation from the coordinate system coordsys to the
  153. Cartesian coordinate system at the point pt.  If pt is not given, the
  154. default names of coordinate variables are used."
  155.  
  156. JacobianMatrix::usage = "JacobianMatrix[pt] gives the Jacobian matrix of
  157. the transformation from the default coordinate system to the Cartesian
  158. coordinate system at the point pt.  JacobianMatrix[pt, coordsys] gives the
  159. Jacobian matrix of the transformation from the coordinate system coordsys
  160. to the Cartesian coordinate system at the point pt.  If pt is not given,
  161. the default names of coordinate variables are used."
  162.  
  163. Grad::usage = "Grad[f] gives the gradient of the scalar function f in the
  164. default coordinate system. Grad[f, coordsys] gives the gradient of f in the
  165. coordinate system coordsys."
  166.  
  167. Div::usage = "Div[f] gives the divergence of the vector-valued function f
  168. in the default coordinate system. Div[f, coordsys] gives the divergence of f
  169. in the coordinate system coordsys."
  170.  
  171. Curl::usage = "Curl[f] gives the curl of the vector-valued function f in the
  172. default coordinate system. Curl[f, coordsys] gives the curl of f in the
  173. coordinate system coordsys."
  174.  
  175. Laplacian::usage = "Laplacian[f] gives the Laplacian of the scalar function
  176. f in the default coordinate system. Laplacian[f, coordsys] gives the
  177. Laplacian of f in the coordinate system coordsys."
  178.  
  179. Biharmonic::usage = "Biharmonic[f] gives the Laplacian of the Laplacian
  180. of the scalar function f in the default coordinate system.
  181. Biharmonic[f, coordsys] gives the biharmonic of f in the coordinate system
  182. coordsys."
  183.  
  184. Cartesian::usage = "Cartesian represents the Cartesian coordinate system
  185. with default variable names.  Cartesian[x, y, z] represents the Cartesian
  186. coordinate system with variable names x, y, and z."
  187.  
  188. Cylindrical::usage = "Cylindrical represents the cylindrical coordinate
  189. system with default variable names. Cylindrical[r, theta, z] represents the
  190. cylindrical coordinate system with variable names r, theta, and z."
  191.  
  192. Spherical::usage = "Spherical represents the spherical coordinate system
  193. with default variable names.  Spherical[r, theta, phi] represents the
  194. spherical coordinate system with variable names r, theta, and phi."
  195.  
  196. ParabolicCylindrical::usage = "ParabolicCylindrical represents the parabolic
  197. cylindrical coordinate system with default variable names.
  198. ParabolicCylindrical[u, v, z] represents the parabolic cylindrical coordinate
  199. system with variable names u, v, and z."
  200.     (* Parabolic cylindrical coordinates: Holding either of the first
  201.     two variables constant while the third variable is held constant
  202.     produces parabolas facing in opposite directions; the third
  203.     variable specifies distance along the axis of common focus. *)
  204.     
  205. Paraboloidal::usage = "Paraboloidal represents the paraboloidal coordinate
  206. system with default variable names.  Paraboloidal[u, v, phi] represents
  207. the paraboloidal coordinate system with variable names u, v, and phi."
  208.     (* Paraboloidal coordinates: Holding either of the first two
  209.     variables constant while the third variable is held constant
  210.     produces opposite facing parabolas; the third parameter
  211.     describes rotations about their common bisectors. *)
  212.  
  213. EllipticCylindrical::usage = "EllipticCylindrical represents the elliptic
  214. cylindrical coordinate system with default parameter and default variable
  215. names.  EllipticCylindrical[u, v, z] represents the elliptic cylindrical
  216. coordinate system with variable names u, v, and z and default parameter.
  217. EllipticCylindrical[u, v, z, a] represents the elliptic cylindrical
  218. coordinate system  with variable names u, v, and z and parameter a."
  219.     (* Elliptic cylindrical coordinates: The parameter a is one-half
  220.     the distance between the two foci.  Holding the first variable
  221.     constant produces confocal ellipses, holding the second variable
  222.     constant produces confocal hyperbolas, and the third variable
  223.     specifies distance along the axis of common focus. *)
  224.     
  225. ProlateSpheroidal::usage = "ProlateSpheroidal represents the prolate
  226. spheroidal coordinate system with default parameter and default variable
  227. names.  ProlateSpheroidal[xi, eta, phi] represents the prolate spheroidal
  228. coordinate system with variable names xi, eta, and phi and default parameter.
  229. ProlateSpheroidal[xi, eta, phi, a] represents the prolate spheroidal
  230. coordinate system with variable names xi, eta, and phi and parameter a."
  231.     (* Prolate spheroidal coordinates: These coordinates
  232.     are obtained by rotating elliptic cylindrical coordinates 
  233.     about the axis joining the two foci, which are separated by
  234.     a distance 2a.  The third variable parameterizes the rotation. *)
  235.  
  236. OblateSpheroidal::usage = "OblateSpheroidal represents the oblate spheroidal
  237. coordinate system with default parameter and default variable names.
  238. OblateSpheroidal[xi, eta, phi] represents the oblate spheroidal coordinate
  239. system with variable names xi, eta, and phi and default parameter.
  240. OblateSpheroidal[xi, eta, phi, a] represents the oblate spheroidal
  241. coordinate system with variable names xi, eta, and phi and parameter a."
  242.     (* Oblate spheroidal coordinates: These coordinates are
  243.         obtained by rotating elliptic cylindrical coordinates about an
  244.         axis perpendicular to the axis joining the two foci, which are
  245.         separated by a distance 2a.  The third variable parameterizes the
  246.         rotation. *)
  247.          
  248. Bipolar::usage = "Bipolar represents the bipolar coordinate system with 
  249. default parameter and default variable names.  Bipolar[u, v, z] represents
  250. the bipolar coordinate system with variable names u, v, and z and default
  251. parameter.  Bipolar[u, v, z, a] represents the  bipolar coordinate system
  252. with variable names u, v, and z and parameter a."
  253.     (* Bipolar coordinates: These coordinates are built around two
  254.     foci, separated by a distance 2a.  Holding the first variable
  255.     fixed produces circles that pass through both foci.  Holding
  256.     the second variable fixed produces degenerate ellipses about one
  257.     of the foci. The third variable parameterizes distance along the
  258.     axis of common foci. *)
  259.  
  260. Bispherical::usage = "Bispherical represents the bispherical coordinate
  261. system with default parameter and default variable names.
  262. Bispherical[u, v, phi] represents the bispherical coordinate system with
  263. variable names u, v, and phi and default parameter.  Bispherical[u, v, phi, a]
  264. represents the bispherical coordinate system with variable names u, v, and
  265. phi and parameter a."
  266.     (* Bispherical coordinates: These coordinates are related
  267.     to bipolar coordinates except that the third coordinate
  268.     measures azimuthal angle rather than z. *)
  269.  
  270. Toroidal::usage = "Toroidal represents the toroidal coordinate system
  271. with default parameter and default variable names.  Toroidal[u, v, phi]
  272. represents the toroidal coordinate system with variable names u, v, and phi
  273. and default parameter.  Toroidal[u, v, phi, a] represents the toroidal
  274. coordinate system with variable names u, v, and phi and parameter a."
  275.     (* Toroidal coordinates: These are obtained by rotating bipolar
  276.     coordinates about an axis perpendicular to the line joining the
  277.     two foci which are separated by a distance 2a.  The third variable
  278.     parameterizes this rotation. *)
  279.     
  280. Conical::usage = "Conical represents the conical coordinate system with 
  281. default parameters and default variable names.  Conical[lambda, mu, nu]
  282. represents the conical coordinate system with variable names lambda, mu,
  283. and nu and default parameters.  Conical[lambda, mu, nu, a, b] represents
  284. the conical coordinate system with variable names lambda, mu, and nu and
  285. parameters a and b."
  286.     (* Conical coordinates:  The coordinate surfaces are spheres
  287.     with centers at the origin and radius lambda (lambda constant),
  288.     cones with apexes at the origin and axes along the z-axis
  289.     (mu constant), and cones with apexes at the origin and axes
  290.     along the y-axis (nu constant). *)
  291.     
  292. ConfocalEllipsoidal::usage = "ConfocalEllipsoidal represents the confocal
  293. ellipsoidal coordinate system with default parameters and default variable
  294. names.  ConfocalEllipsoidal[lambda, mu, nu] represents the confocal ellipsoidal
  295. coordinate system with variable names lambda, mu, and nu and default
  296. parameters.  ConfocalEllipsoidal[lambda, mu, nu, a, b, c] represents the
  297. confocal ellipsoidal coordinate system with variable names lambda, mu, and
  298. nu and parameters a, b, and c."
  299.     (* Confocal ellipsoidal coordinates: The coordinate surfaces are
  300.     ellipsoids (lambda constant), hyperboloids of one sheet (mu
  301.     constant), and hyperboloids of two sheets (nu constant). *)
  302.  
  303. ConfocalParaboloidal::usage = "ConfocalParaboloidal represents the confocal
  304. paraboloidal coordinate system with default parameters and default variable
  305. names.  ConfocalParaboloidal[lambda, mu, nu] represents the confocal
  306. paraboloidal coordinate system with variable names lambda, mu, and nu and
  307. default parameters.  ConfocalParaboloidal[lambda, mu, nu, a, b] represents
  308. the confocal paraboloidal coordinate system with variable names lambda, mu,
  309. and nu and parameters a and b."
  310.     (* Confocal paraboloidal coordinates: The coordinate surfaces are
  311.     confocal families of elliptic paraboloids extending in the
  312.     direction of the negative z-axis (lambda constant), hyperbolic
  313.     paraboloids (mu constant), and elliptic paraboloids extending in
  314.     the direction of the positive z-axis (nu constant). *)
  315.  
  316.  
  317. (* default coordinates *)
  318.  
  319. x::usage = y::usage =
  320. "{x,y,z} are the default Cartesian coordinates."
  321.  
  322. z::usage =
  323. "{x,y,z} are the default Cartesian coordinates; {r,theta,z} are the default
  324. Cylindrical coordinates; {u,v,z} are the default coordinates for the
  325. ParabolicCylindrical, EllipticCylindrical, and Bipolar coordinate systems."
  326.  
  327. r::usage = theta::usage =
  328. "{r,theta,z} are the default Cylindical coordinates; {r,theta,phi} are the
  329. default Spherical coordinates."
  330.  
  331. phi::usage =
  332. "{r,theta,phi} are the default Spherical coordinates; {u,v,phi} are the default
  333. coordinates for the Paraboloidal, Bispherical, and Toroidal coordinate systems;
  334. {xi,eta,phi} are the default coordinates for the Prolate Spheroidal and
  335. Oblate Spheroidal coordinate systems."
  336.  
  337. u::usage = v::usage =
  338. "{u,v,z} are the default coordinates for the ParabolicCylindrical,
  339. EllipticCylindrical, and Bipolar coordinate systems; {u,v,phi} are the default
  340. coordinates for the Paraboloidal,  Bispherical, and Toroidal coordinate
  341. systems."
  342.  
  343. xi::usage = eta::usage =
  344. "{xi,eta,phi} are the default coordinates for the ProlateSpheroidal and
  345. OblateSpheroidal coordinate systems."
  346.  
  347. lambda::usage = mu::usage = nu::usage =
  348. "{lambda,mu,nu} are the default coordinates for the Conical,
  349. ConfocalEllipsoidal, and ConfocalParaboloidal coordinate systems."
  350.  
  351.  
  352. Begin["Calculus`VectorAnalysis`Private`"]
  353.  
  354. Clear[$CoordinateSystem];  (* a person might read in this package twice! *)
  355.  
  356. $VecQ[v_] := VectorQ[v] && Length[v] == 3;
  357.  
  358.     (* these are the coordinate systems that are supported *)
  359. $CoordSysList = {Cartesian, Cylindrical, Spherical, ParabolicCylindrical,
  360.     Paraboloidal, EllipticCylindrical, ProlateSpheroidal, OblateSpheroidal,
  361.     Bipolar, Bispherical, Toroidal, Conical, ConfocalEllipsoidal,
  362.     ConfocalParaboloidal}
  363.  
  364. Coordinates::invalid = "`1` is not a valid coordinate system specification."
  365.  
  366. $BadCoordSys[coordsys_] := (Message[Coordinates::invalid, coordsys]; $Failed)
  367.  
  368. $ExpandCoordSys[coordsys_Symbol] :=
  369.     If[MemberQ[$CoordSysList, coordsys],
  370.         Apply[coordsys, Flatten[{Coordinates[coordsys],
  371.                 Parameters[coordsys]}]],
  372.         (* else *)
  373.         $BadCoordSys[coordsys]];
  374.  
  375. $ExpandCoordSys[coordsys_[vp___]] :=
  376.     Module[{vpars = {vp}, np, len},
  377.     If[!MemberQ[$CoordSysList, coordsys],
  378.         Return[$BadCoordSys[coordsys[vp]]]];
  379.     len = Length[vpars];
  380.     np = Length[Parameters[coordsys]];
  381.     Which[
  382.         len == 0,
  383.         Apply[coordsys,
  384.             Flatten[{Coordinates[coordsys], Parameters[coordsys]}]],
  385.         len == 3,
  386.         If[Head /@ vpars =!= {Symbol, Symbol, Symbol},
  387.             $BadCoordSys[coordsys[vp]],
  388.             Apply[coordsys, Flatten[{vpars, Parameters[coordsys]}]]],
  389.         len == 3 + np,
  390.         If[(Head /@ Take[vpars, 3]) =!= {Symbol, Symbol, Symbol},
  391.             $BadCoordSys[coordsys[vp]], Apply[coordsys, vpars]],
  392.         True,
  393.         $BadCoordSys[coordsys[vp]]
  394.         ]
  395.     ]
  396.  
  397. $PointRule[cs_, pt_] :=
  398.     {cs[[1]] -> pt[[1]], cs[[2]] -> pt[[2]], cs[[3]] -> pt[[3]]}
  399.  
  400. $DAbsSign = {Sign'[_] -> 0, Abs'[x_] -> Sign[x]};
  401.  
  402.   (* ===================== Dot Product ====================== *)
  403.  
  404. DotProduct[v1_?$VecQ, v2_?$VecQ, coordsys_:$CoordinateSystem] :=
  405.     Module[{cs = $ExpandCoordSys[coordsys], cv1, cv2},
  406.     cv1 . cv2 /; (cs =!= $Failed &&
  407.             (cv1 = $CTToCart[v1, cs]) =!= $Failed &&
  408.             (cv2 = $CTToCart[v2, cs]) =!= $Failed)];
  409.  
  410.   (* ===================== Cross Product ====================== *)
  411.  
  412. CrossProduct[v1_?$VecQ, v2_?$VecQ, coordsys_:$CoordinateSystem] :=
  413.     Module[{cs = $ExpandCoordSys[coordsys], cv1, cv2, m},
  414.     (m = Minors[{cv1, cv2}, 2][[1]];
  415.     $CTFromCart[{m[[3]], -m[[2]], m[[1]]}, cs]) /; (cs =!= $Failed &&
  416.                 (cv1 = $CTToCart[v1, cs]) =!= $Failed &&
  417.                 (cv2 = $CTToCart[v2, cs]) =!= $Failed)];
  418.  
  419.   (* ================== Scalar Triple Product ====================== *)
  420.  
  421. ScalarTripleProduct[v1_?$VecQ, v2_?$VecQ, v3_?$VecQ,
  422.                     coordsys_:$CoordinateSystem] :=
  423.     Module[{cs = $ExpandCoordSys[coordsys], cv1, cv2, cv3},
  424.     Det[{cv1, cv2, cv3}] /; (cs =!= $Failed &&
  425.                 (cv1 = $CTToCart[v1, cs]) =!= $Failed &&
  426.                 (cv2 = $CTToCart[v2, cs]) =!= $Failed &&
  427.                 (cv3 = $CTToCart[v3, cs]) =!= $Failed)];
  428.  
  429.   (* ==================== Coordinates ========================== *)
  430.  
  431. Coordinates[coordsys_:$CoordinateSystem] :=
  432.     Module[{cs = $ExpandCoordSys[coordsys]},
  433.     (List @@ Take[cs, 3]) /; cs =!= $Failed]
  434.  
  435.   (* ==================== Parameters ========================== *)
  436.  
  437. Parameters[coordsys_:$CoordinateSystem] :=
  438.     Module[{cs = $ExpandCoordSys[coordsys]},
  439.     (List @@ Drop[cs, 3]) /; cs =!= $Failed]
  440.  
  441.   (* ==================== SetCoordinates ========================== *)
  442.  
  443.     (* ----------------- defaults -------------------- *)
  444.  
  445. Coordinates[Cartesian] ^= {x, y, z}
  446. Coordinates[Cylindrical] ^= {r, theta, z}
  447. Coordinates[Spherical] ^= {r, theta, phi} 
  448. Coordinates[ParabolicCylindrical] ^= {u, v, z}
  449. Coordinates[Paraboloidal] ^= {u, v, phi} 
  450. Coordinates[EllipticCylindrical] ^= {u, v, z}
  451. Coordinates[ProlateSpheroidal] ^= {xi, eta, phi} 
  452. Coordinates[OblateSpheroidal] ^= {eta, xi, phi} 
  453. Coordinates[Bipolar] ^= {u, v, z}
  454. Coordinates[Bispherical] ^= {u, v, phi}
  455. Coordinates[Toroidal] ^= {v, u, phi} 
  456. Coordinates[Conical] ^= {lambda, mu, nu} 
  457. Coordinates[ConfocalEllipsoidal] ^= {lambda, mu, nu} 
  458. Coordinates[ConfocalParaboloidal] ^= {lambda, mu, nu}
  459.  
  460. Parameters[Cartesian] ^= {}
  461. Parameters[Cylindrical] ^= {}
  462. Parameters[Spherical] ^= {} 
  463. Parameters[ParabolicCylindrical] ^= {}
  464. Parameters[Paraboloidal] ^= {} 
  465. Parameters[EllipticCylindrical] ^= {1}
  466. Parameters[ProlateSpheroidal] ^= {1}
  467. Parameters[OblateSpheroidal] ^= {1} 
  468. Parameters[Bipolar] ^= {1}
  469. Parameters[Bispherical] ^= {1}
  470. Parameters[Toroidal] ^= {1} 
  471. Parameters[Conical] ^= {1, 2} 
  472. Parameters[ConfocalEllipsoidal] ^= {3, 2, 1} 
  473. Parameters[ConfocalParaboloidal] ^= {2, 1}
  474.  
  475. CoordinateSystem := $CoordinateSystem
  476.  
  477. SetCoordinates::range = "The parameter `1` is not positive."
  478.  
  479. SetCoordinates::ranges = "The parameters `1` do not satisfy the range
  480. requirements `2` for `3`."
  481.  
  482. SetCoordinates[coordsys_:$CoordinateSystem] :=
  483.     Module[{cs = $ExpandCoordSys[coordsys], hcs, rr, par},
  484.     cs /; ((cs =!= $Failed) &&
  485.         (rr = ParameterRanges[cs];
  486.         hcs = Head[cs];
  487.         par = Apply[List, Drop[cs, 3]];
  488.         If[rr =!= Null && (Evaluate[rr]& @@ par === False),
  489.             If[Length[par] == 1,
  490.             Message[SetCoordinates::range, par[[1]]],
  491.             Message[SetCoordinates::ranges, par, rr, hcs]
  492.             ];
  493.             False,
  494.           (* else *)
  495.             Unprotect[Evaluate[hcs]];
  496.             Coordinates[hcs] ^= Apply[List, Take[cs, 3]];
  497.             Parameters[hcs] ^= par;
  498.             Protect[Evaluate[hcs]];
  499.             $CoordinateSystem = hcs;
  500.             True
  501.             ]))
  502.     ];
  503.  
  504.   (* ================== Coordinate Ranges ====================== *)
  505.  
  506. CoordinateRanges[coordsys_:$CoordinateSystem] :=
  507.     Module[{cs = $ExpandCoordSys[coordsys]},
  508.     Switch[Head[cs],
  509.         Cartesian,
  510.         { -Infinity < cs[[1]] < Infinity,
  511.           -Infinity < cs[[2]] < Infinity,
  512.           -Infinity < cs[[3]] < Infinity },
  513.         Cylindrical,
  514.         { 0 <= cs[[1]] < Infinity,
  515.           -Pi < cs[[2]] <= Pi,
  516.           -Infinity < cs[[3]] < Infinity },
  517.         Spherical,
  518.         { 0 <= cs[[1]] < Infinity,
  519.           0 <= cs[[2]] <= Pi,
  520.           -Pi < cs[[3]] <= Pi },
  521.         ParabolicCylindrical,
  522.         { -Infinity < cs[[1]] < Infinity,
  523.           0 <= cs[[2]] < Infinity,
  524.           -Infinity < cs[[3]] < Infinity },
  525.         Paraboloidal,
  526.         { 0 <= cs[[1]] < Infinity,
  527.           0 <= cs[[2]] < Infinity,
  528.           -Pi <= cs[[3]] <= Pi },
  529.         EllipticCylindrical,
  530.         { 0 <= cs[[1]] < Infinity,
  531.           -Pi < cs[[2]] <= Pi,
  532.           -Infinity < cs[[3]] < Infinity },
  533.         ProlateSpheroidal,
  534.         { 0 <= cs[[1]] < Infinity,
  535.           0 <= cs[[2]] <= Pi,
  536.           -Pi < cs[[3]] <= Pi },
  537.         OblateSpheroidal,
  538.         { -Pi/2 <= cs[[1]] <= Pi/2,
  539.           0 <= cs[[2]] < Infinity,
  540.           -Pi < cs[[3]] <= Pi },
  541.         Bipolar,
  542.         { -Pi < cs[[1]] <= Pi,
  543.           -Infinity < cs[[2]] < Infinity,
  544.           -Infinity < cs[[3]] < Infinity },
  545.         Bispherical,
  546.         { 0 <= cs[[1]] <= Pi,
  547.           -Infinity < cs[[2]] < Infinity,
  548.           -Pi < cs[[3]] <= Pi },
  549.         Toroidal,
  550.         { 0 <= cs[[1]] < Infinity,
  551.           -Pi < cs[[2]] <= Pi,
  552.           -Pi < cs[[3]] <= Pi },
  553.         Conical,
  554.         { -Infinity < cs[[1]] < Infinity,
  555.           cs[[4]]^2 < cs[[2]]^2 < cs[[5]]^2,
  556.           cs[[3]]^2 < cs[[4]]^2 },
  557.         ConfocalEllipsoidal,
  558.         { -Infinity < cs[[1]] < cs[[6]]^2,
  559.           cs[[6]]^2 < cs[[2]] < cs[[5]]^2,
  560.           cs[[5]]^2 < cs[[3]] < cs[[4]]^2 },
  561.         ConfocalParaboloidal,
  562.         { -Infinity < cs[[1]] < cs[[5]]^2,
  563.           cs[[5]]^2 < cs[[2]] < cs[[4]]^2,
  564.           cs[[4]]^2 < cs[[3]] < Infinity }
  565.     ] /; (cs =!= $Failed)
  566.     ]
  567.  
  568.   (* ================== Parameter Ranges ====================== *)
  569.  
  570. ParameterRanges[coordsys_:$CoordinateSystem] :=
  571.     Module[{cs = $ExpandCoordSys[coordsys]},
  572.     Switch[Head[cs],
  573.         Conical,
  574.         0 < #1 < #2 < Infinity,
  575.         ConfocalEllipsoidal,
  576.         0 < #3 < #2 < #1 < Infinity,
  577.         ConfocalParaboloidal,
  578.         0 < #2 < #1 < Infinity,
  579.         _ (* all others *),
  580.         If[Length[cs] == 4, 0 < #1 < Infinity, Null]
  581.     ] /; (cs =!= $Failed)
  582.     ]
  583.  
  584.     (* ==================== ScaleFactors ===========================*)
  585.  
  586. ScaleFactors[arg_:$CoordinateSystem] :=
  587.     Module[{pt, cs},
  588.     ScaleFactors[pt, cs] /; (If[$VecQ[arg],
  589.                     cs = $CoordinateSystem;
  590.                     pt = arg,
  591.                     cs = $ExpandCoordSys[arg];
  592.                     If[cs =!= $Failed,
  593.                         pt = List @@ Take[cs, 3]]];
  594.                 cs =!= $Failed)];
  595.  
  596. ScaleFactors[pt_?$VecQ, coordsys_:$CoordinateSystem] :=
  597.     Module[{cs = $ExpandCoordSys[coordsys], tmp},
  598.     (tmp = Switch[Head[cs],
  599.         Cartesian, {1, 1, 1},
  600.         Cylindrical, {1, cs[[1]], 1},
  601.         Spherical, {1, cs[[1]], cs[[1]] Sin[cs[[2]]]},
  602.         ParabolicCylindrical, 
  603.         tmp = Sqrt[cs[[1]]^2 + cs[[2]]^2];
  604.         {tmp, tmp, 1},
  605.         Paraboloidal,
  606.         tmp = Sqrt[cs[[1]]^2 + cs[[2]]^2];
  607.         {tmp, tmp, cs[[1]] cs[[2]]},
  608.         EllipticCylindrical,
  609.         tmp = cs[[4]] Sqrt[Sinh[cs[[1]]]^2 + Sin[cs[[2]]]^2];
  610.         {tmp, tmp, 1},
  611.         ProlateSpheroidal,
  612.         tmp = cs[[4]] Sqrt[Sinh[cs[[1]]]^2+Sin[cs[[2]]]^2];
  613.         {tmp, tmp, cs[[4]] Sinh[cs[[1]]] Sin[cs[[2]]]},
  614.         OblateSpheroidal,
  615.         tmp = cs[[4]] Sqrt[Sinh[cs[[2]]]^2+Sin[cs[[1]]]^2];
  616.         {tmp, tmp, cs[[4]] Cosh[cs[[2]]] Cos[cs[[1]]]},
  617.         Bipolar,
  618.         tmp = cs[[4]]/(Cosh[cs[[2]]] - Cos[cs[[1]]]);
  619.         {tmp, tmp, 1},
  620.         Bispherical,
  621.         tmp = cs[[4]]/(Cosh[cs[[2]]] - Cos[cs[[1]]]);
  622.         {tmp, tmp, Sin[cs[[1]]] tmp},
  623.         Toroidal,
  624.         tmp = cs[[4]]/(Cosh[cs[[1]]] - Cos[cs[[2]]]);
  625.         {tmp, tmp, tmp Sinh[cs[[1]]]},
  626.         Conical,
  627.         tmp = Abs[cs[[1]]] Sqrt[cs[[2]]^2-cs[[3]]^2];
  628.         {1, tmp/(Sqrt[cs[[2]]^2-cs[[4]]^2] Sqrt[cs[[5]]^2-cs[[2]]^2]),
  629.            tmp/(Sqrt[cs[[3]]^2-cs[[4]]^2] Sqrt[cs[[3]]^2-cs[[5]]^2])},
  630.         ConfocalEllipsoidal,
  631.         tmp = 2 Sqrt[(cs[[4]]^2 - #)(cs[[5]]^2 - #)(cs[[6]]^2 - #)]&;
  632.         {Sqrt[(cs[[2]]-cs[[1]])(cs[[3]]-cs[[1]])]/tmp[cs[[1]]],
  633.          Sqrt[(cs[[3]]-cs[[2]])(cs[[1]]-cs[[2]])]/tmp[cs[[2]]],
  634.          Sqrt[(cs[[1]]-cs[[3]])(cs[[2]]-cs[[3]])]/tmp[cs[[3]]]},
  635.         ConfocalParaboloidal,
  636.         tmp = 2 Sqrt[(cs[[4]]^2 - #)(cs[[5]]^2 - #)]&;
  637.         {Sqrt[(cs[[2]]-cs[[1]])(cs[[3]]-cs[[1]])]/tmp[cs[[1]]],
  638.          Sqrt[(cs[[3]]-cs[[2]])(cs[[1]]-cs[[2]])]/tmp[cs[[2]]],
  639.          Sqrt[(cs[[1]]-cs[[3]])(cs[[2]]-cs[[3]])]/tmp[cs[[3]]]}
  640.         ];
  641.     tmp /. $PointRule[cs, pt]) /; (cs =!= $Failed)
  642.     ]
  643.  
  644.   (* ================= CoordinatesToCartesian ===================*)
  645.  
  646. CoordinatesToCartesian[v_?$VecQ, coordsys_:$CoordinateSystem] :=
  647.     Module[{cs = $ExpandCoordSys[coordsys], cv},
  648.     cv /; (cs =!= $Failed && (cv = $CTToCart[v, cs]) =!= $Failed)
  649.     ]
  650.  
  651. CoordinatesToCartesian::range = "The point `1` does not satisfy the
  652. range requirements `2` for `3`."
  653.  
  654. $CTToCart[{a_, b_, c_}, cs_] :=
  655.     Module[{tmp, d},
  656.     If[MemberQ[{Conical,ConfocalEllipsoidal,ConfocalParaboloidal},Head[cs]],
  657.         tmp = CoordinateRanges[cs];
  658.         tmp = And @@ (tmp /. {cs[[1]] -> a, cs[[2]] -> b, cs[[3]] -> c});
  659.         If[tmp === False,
  660.         Message[CoordinatesToCartesian::range,
  661.             {a, b, c}, CoordinateRanges[cs], cs];
  662.         Return[$Failed]
  663.         ]
  664.         ];
  665.     Switch[Head[cs],
  666.         Cartesian, {a, b, c},
  667.         Cylindrical, {a Cos[b], a Sin[b], c},
  668.         Spherical, {a Sin[b] Cos[c], a Sin[b] Sin[c], a Cos[b]},
  669.         ParabolicCylindrical, {(a^2 - b^2)/2, a b, c},
  670.         Paraboloidal, {a b Cos[c], a b Sin[c], (a^2 - b^2)/2},
  671.         EllipticCylindrical,
  672.         {cs[[4]] Cosh[a] Cos[b], cs[[4]] Sinh[a] Sin[b], c},
  673.         ProlateSpheroidal,
  674.         tmp = cs[[4]] Sinh[a] Sin[b];
  675.         {tmp Cos[c], tmp Sin[c], cs[[4]] Cosh[a] Cos[b]},
  676.         OblateSpheroidal,
  677.         tmp = cs[[4]] Cosh[b] Cos[a];
  678.         {tmp Cos[c], tmp Sin[c], cs[[4]] Sinh[b] Sin[a]},
  679.         Bipolar,
  680.         tmp = cs[[4]]/(Cosh[b]-Cos[a]);
  681.         {tmp Sinh[b], tmp Sin[a], c},
  682.         Bispherical,
  683.         tmp = cs[[4]]/(Cosh[b]-Cos[a]);
  684.         d = Sin[a];
  685.         {tmp d Cos[c], tmp d Sin[c], tmp Sinh[b]},
  686.         Toroidal,
  687.         tmp = cs[[4]]/(Cosh[a]-Cos[b]);
  688.         d = Sinh[a];
  689.         {tmp d Cos[c], tmp d Sin[c], tmp Sin[b]},
  690.         Conical,
  691.         tmp = 1/(cs[[4]]^2 - cs[[5]]^2);
  692.         { a Abs[b c] / (cs[[4]] cs[[5]]),
  693.           Abs[a] Sign[b] Sqrt[(b^2 - cs[[4]]^2)(c^2 - cs[[4]]^2) tmp]/
  694.             cs[[4]],
  695.           Abs[a] Sign[c] Sqrt[(b^2 - cs[[5]]^2)(c^2 - cs[[5]]^2)(-tmp)]/
  696.             cs[[5]] },
  697.         ConfocalEllipsoidal,
  698.         tmp = (#^2 - a)(#^2 - b)(#^2 - c)&;
  699.         d = 1/((cs[[#1]]^2 - cs[[#2]]^2)(cs[[#1]]^2 - cs[[#3]]^2))&;
  700.         d = { Sqrt[tmp[cs[[4]]] d[4, 5, 6]],
  701.               Sqrt[tmp[cs[[5]]] d[5, 4, 6]],
  702.               Sqrt[tmp[cs[[6]]] d[6, 4, 5]] },
  703.         ConfocalParaboloidal,
  704.         tmp = (#^2 - a)(#^2 - b)(#^2 - c)&;
  705.         { Sqrt[tmp[cs[[4]]]/(cs[[5]]^2 - cs[[4]]^2)],
  706.           Sqrt[tmp[cs[[5]]]/(cs[[4]]^2 - cs[[5]]^2)],
  707.           (cs[[4]]^2 + cs[[5]]^2 - a - b - c)/2}
  708.     ]
  709.     ]
  710.  
  711.   (* ================= CoordinatesFromCartesian ===================*)
  712.  
  713. $ArcTan[x_, y_] := If[TrueQ[x == y == 0], 0, ArcTan[x, y]];
  714.  
  715. CoordinatesFromCartesian[v_?$VecQ, coordsys_:$CoordinateSystem] :=
  716.     Module[{cs = $ExpandCoordSys[coordsys]},
  717.     $CTFromCart[v, cs] /; (cs =!= $Failed)
  718.     ]
  719.  
  720. $CTFromCart[{x_, y_, z_}, cs_] :=
  721.     Module[{tmp, a, b, c, d, e},
  722.     Switch[Head[cs],
  723.         Cartesian, {x, y, z},
  724.         Cylindrical, {Sqrt[x^2 + y^2], $ArcTan[x, y], z},
  725.         Spherical,
  726.         a = Sqrt[x^2 + y^2 + z^2];
  727.         {a, If[TrueQ[a == 0], 0, ArcCos[z/a]], $ArcTan[x, y]},
  728.         ParabolicCylindrical,
  729.         d = Sqrt[x^2 + y^2];
  730.         If[TrueQ[d == 0],
  731.             a = b = d,
  732.             If[TrueQ[x < 0],
  733.             a = Sqrt[d + x] Sign[y]; b = y/a,
  734.             b = Sqrt[d - x]; a = y/b]];
  735.         {a, b, z},
  736.         Paraboloidal,
  737.         d = Sqrt[x^2 + y^2 + z^2];
  738.         If[TrueQ[d == 0],
  739.             {d, d, d},
  740.             e = Sqrt[x^2 + y^2];
  741.             If[TrueQ[z >= 0],
  742.             a = Sqrt[d + z]; b = e/a,
  743.             b = Sqrt[d - z]; a = e/b];
  744.             {a, b, $ArcTan[x, y]}],
  745.         EllipticCylindrical,
  746.         e = ArcCosh[(x + I y)/cs[[4]]];
  747.         {Re[e], Im[e], z},
  748.         ProlateSpheroidal,
  749.         e = ArcCosh[(z + I Sqrt[x^2 + y^2])/cs[[4]]];
  750.         {Re[e], Im[e], $ArcTan[x, y]},
  751.         OblateSpheroidal,
  752.         e = ArcCosh[(Sqrt[x^2 + y^2] + I z)/cs[[4]]];
  753.         {Im[e], Re[e], $ArcTan[x, y]},
  754.         Bipolar,
  755.         e = 2 ArcCoth[x + I y];
  756.         {-Im[e], Re[e], z},
  757.         Bispherical,
  758.         e = 2 ArcCoth[(z + I Sqrt[x^2 + y^2])/cs[[4]]];
  759.         {-Im[e], Re[e], $ArcTan[x, y]},
  760.         Toroidal,
  761.         e = 2 ArcCoth[(Sqrt[x^2 + y^2] + I z)/cs[[4]]];
  762.         {Re[e], -Im[e], $ArcTan[x, y]},
  763.         Conical,
  764.         a = Sqrt[x^2 + y^2 + z^2];
  765.         If[TrueQ[a == 0],
  766.             {a, 0, 0},
  767.           (* else *)
  768.             c = b - cs[[4]]^2;
  769.             d = b - cs[[5]]^2;
  770.             e = b /. Solve[x^2 c d + y^2 b d + z^2 b c == 0, b];
  771.             Prepend[Sqrt[Reverse[Sort[e]]],a] {Sign[x],Sign[y],Sign[z]}
  772.         ],
  773.         ConfocalEllipsoidal,
  774.         a = d - cs[[4]]^2;
  775.         b = d - cs[[5]]^2;
  776.         c = d - cs[[6]]^2;
  777.         Sort[d /. Solve[x^2 b c + y^2 a c + z^2 a b + a b c == 0, d]],
  778.         ConfocalParaboloidal,
  779.         a = d - cs[[4]]^2;
  780.         b = d - cs[[5]]^2;
  781.         Sort[d /. Solve[x^2 b + y^2 a - 2 z a b - d a b == 0, d]]
  782.     ]
  783.     ]
  784.  
  785. (* === Here are all of the rules for differential operations on vectors === *)
  786.  
  787. ArcLengthFactor[t_Symbol, coordsys_:$CoordinateSystem] :=
  788.     Module[{pt, cs = $ExpandCoordSys[coordsys]},
  789.     ArcLengthFactor[pt, t, cs] /;
  790.         (If[cs =!= $Failed, pt = List @@ Take[cs, 3]]; cs =!= $Failed)]
  791.  
  792. ArcLengthFactor[pt_?$VecQ, t_Symbol, coordsys_:$CoordinateSystem] :=
  793.     Module[{cs = $ExpandCoordSys[coordsys]},
  794.     Sqrt[(ScaleFactors[pt, cs]^2) . (Dt[pt, t]^2)] /; (cs =!= $Failed)]
  795.  
  796. JacobianDeterminant[arg_:$CoordinateSystem] :=
  797.     Module[{pt, cs},
  798.     JacobianDeterminant[pt, cs] /; (If[$VecQ[arg],
  799.                     cs = $CoordinateSystem;
  800.                     pt = arg,
  801.                     cs = $ExpandCoordSys[arg];
  802.                     If[cs =!= $Failed,
  803.                         pt = List @@ Take[cs, 3]]];
  804.                     cs =!= $Failed)];
  805.  
  806. JacobianDeterminant[pt_?$VecQ, coordsys_:$CoordinateSystem] :=
  807.     Module[{cs = $ExpandCoordSys[coordsys]},
  808.     (Times @@ ScaleFactors[pt, cs]) /; (cs =!= $Failed)]
  809.  
  810. JacobianMatrix[arg_:$CoordinateSystem] :=
  811.     Module[{pt, cs},
  812.     JacobianMatrix[pt, cs] /; (If[$VecQ[arg],
  813.                     cs = $CoordinateSystem;
  814.                     pt = arg,
  815.                     cs = $ExpandCoordSys[arg];
  816.                     If[cs =!= $Failed,
  817.                         pt = List @@ Take[cs, 3]]];
  818.                     cs =!= $Failed)];
  819.  
  820. JacobianMatrix[pt_?$VecQ, coordsys_:$CoordinateSystem] :=
  821.     Module[{cs = $ExpandCoordSys[coordsys], uvw},
  822.     (uvw = List @@ Take[cs, 3];
  823.     Outer[D, $CTToCart[uvw, cs], uvw] /. $DAbsSign /.
  824.         $PointRule[cs, pt]) /; (cs =!= $Failed)]
  825.  
  826. Grad[f_, coordsys_:$CoordinateSystem] :=
  827.     Module[{cs = $ExpandCoordSys[coordsys]},
  828.     Outer[D, {f}, List @@ Take[cs, 3]][[1]]/ScaleFactors[cs] /;
  829.         (cs =!= $Failed)] 
  830.  
  831. Div[f_?$VecQ, coordsys_:$CoordinateSystem] :=
  832.     Module[{cs = $ExpandCoordSys[coordsys], sf, psf},
  833.     (sf = ScaleFactors[cs];
  834.     psf = Times @@ sf;
  835.     (Inner[D, f psf/sf, List @@ Take[cs, 3]] /. $DAbsSign)/psf) /;
  836.         (cs =!= $Failed)]
  837.  
  838. Curl[f_?$VecQ, coordsys_:$CoordinateSystem] :=
  839.     Module[{cs = $ExpandCoordSys[coordsys], sf},
  840.     (sf = ScaleFactors[cs];
  841.     {(D[sf[[3]] f[[3]], cs[[2]]] - D[sf[[2]] f[[2]], cs[[3]]])/
  842.         (sf[[2]] sf[[3]]),
  843.      (D[sf[[1]] f[[1]], cs[[3]]] - D[sf[[3]] f[[3]], cs[[1]]])/
  844.         (sf[[1]] sf[[3]]),
  845.      (D[sf[[2]] f[[2]], cs[[1]]] - D[sf[[1]] f[[1]], cs[[2]]])/
  846.         (sf[[1]] sf[[2]])} /. $DAbsSign) /; (cs =!= $Failed)]
  847.  
  848. Laplacian[f_, coordsys_:$CoordinateSystem] :=
  849.     Module[{cs = $ExpandCoordSys[coordsys]},
  850.     Div[Grad[f, cs], cs] /; (cs =!= $Failed)]
  851.  
  852. Biharmonic[f_, coordsys_:$CoordinateSystem] :=
  853.     Module[{cs = $ExpandCoordSys[coordsys]},
  854.     Laplacian[Laplacian[f, cs], cs] /; (cs =!= $Failed)]
  855.  
  856. SetCoordinates[Cartesian[ ]];  (* default coordinate system *)
  857.  
  858. End[ ];        (* "Calculus`VectorAnalysis`Private`" *)
  859.  
  860. Attributes[DotProduct] = {ReadProtected};
  861. Attributes[CrossProduct] = {ReadProtected};
  862. Attributes[ScalarTripleProduct] = {ReadProtected};
  863. Attributes[SetCoordinates] = {ReadProtected};
  864. Attributes[CoordinateSystem] = {ReadProtected};
  865. Attributes[Coordinates] = {ReadProtected};
  866. Attributes[Parameters] = {ReadProtected};
  867. Attributes[CoordinateRanges] = {ReadProtected};
  868. Attributes[CoordinatesToCartesian] = {ReadProtected};
  869. Attributes[CoordinatesFromCartesian] = {ReadProtected};
  870. Attributes[ScaleFactors] = {ReadProtected};
  871. Attributes[ArcLengthFactor] = {ReadProtected};
  872. Attributes[JacobianDeterminant] = {ReadProtected};
  873. Attributes[JacobianMatrix] = {ReadProtected};
  874. Attributes[Grad] = {ReadProtected};
  875. Attributes[Div] = {ReadProtected};
  876. Attributes[Curl] = {ReadProtected};
  877. Attributes[Laplacian] = {ReadProtected};
  878. Attributes[Biharmonic] = {ReadProtected};
  879.  
  880. Protect[Cartesian, Cylindrical, Spherical, ParabolicCylindrical,
  881.     Paraboloidal, EllipticCylindrical, ProlateSpheroidal, OblateSpheroidal,
  882.     Bipolar, Bispherical, Toroidal, Conical, ConfocalEllipsoidal,
  883.     ConfocalParaboloidal];
  884.  
  885. Protect[DotProduct, CrossProduct, ScalarTripleProduct, SetCoordinates,
  886.     Coordinates, Parameters, CoordinateRanges, CoordinatesToCartesian,
  887.     CoordinatesFromCartesian, ScaleFactors, ArcLengthFactor,
  888.     JacobianDeterminant, JacobianMatrix, Grad, Div, Curl, Laplacian,
  889.     Biharmonic, CoordinateSystem];
  890.  
  891. EndPackage[ ]
  892.