(************** Content-type: application/mathematica ************** CreatedBy='Mathematica 5.1' Mathematica-Compatible Notebook This notebook can be used with any Mathematica-compatible application, such as Mathematica, MathReader or Publicon. The data for the notebook starts with the line containing stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. *******************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 6924, 280]*) (*NotebookOutlinePosition[ 7618, 304]*) (* CellTagsIndexPosition[ 7574, 300]*) (*WindowFrame->Normal*) Notebook[{ Cell[BoxData[ \(<< Calculus`VectorAnalysis`\)], "Input"], Cell["\<\ The following is just to make subscripts inert, so that they behave as in \ physics. It has no influence on the functioning of the package.\ \>", "Text"], Cell[BoxData[ \(SetAttributes[Subscript, {HoldAllComplete, Constant}]\)], "Input"], Cell[BoxData[ \(Off[General::spell, General::spell1]\)], "Input"], Cell[CellGroupData[{ Cell["Test of package", "Title"], Cell["\<\ The following should work for all coordinate systems, but the cylindrical is \ the easiest to check.\ \>", "Text"], Cell[CellGroupData[{ Cell["Define coordinate system", "Section"], Cell["Set up coordinate system and variables", "Text"], Cell[BoxData[ \(SetCoordinates[Cylindrical[r, \[Phi], z]]\)], "Input"], Cell["Check ranges", "Text"], Cell[BoxData[ \(CoordinateRanges[]\)], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["Coordinate transformations", "Section"], Cell["\<\ Substitutions of variables to and from the curvilinear coordinates\ \>", "Text"], Cell[BoxData[ \(toCurvilinear = Thread[{x, y, z} -> CoordinatesToCartesian[{r, \[Phi], z}]]\)], "Input"], Cell[BoxData[ \(toCartesian = Thread[{r, \[Phi], z} \[Rule] CoordinatesFromCartesian[{x, y, z}]]\)], "Input"], Cell[CellGroupData[{ Cell["Examples", "Subsection"], Cell[BoxData[ \(x\^2 + y\^2 + z\^2 /. toCurvilinear // TrigExpand\)], "Input"], Cell[BoxData[ \(\(r\^2\) Cos[2 \[Phi]] /. toCartesian\)], "Input"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["Basis vectors", "Section"], Cell["\<\ The Jacobian matrix connects Cartesian and curvilinear coordinates\ \>", "Text"], Cell[BoxData[ \(jacobian = JacobianMatrix[]\)], "Input"], Cell[BoxData[ \(jacobian // MatrixForm\)], "Input"], Cell["\<\ The scale factors used to normalize the columns of the Jacobian\ \>", "Text"], Cell[BoxData[ \(scales = ScaleFactors[]\)], "Input"], Cell["Curvilinear basis in the Cartesian system", "Text"], Cell[BoxData[ \({e\_r, e\_\[Phi], e\_z} = Transpose[jacobian]\/scales\)], "Input"], Cell["Cartesian basis in the curvilinear system", "Text"], Cell[BoxData[ \({e\_x, e\_y, e\_z} = Transpose[{e\_r, e\_\[Phi], e\_z}]\)], "Input"], Cell[CellGroupData[{ Cell["Examples", "Subsection"], Cell["Cartesian vector", "Text"], Cell[BoxData[ \(\(v = {v\_x, v\_y, v\_z};\)\)], "Input"], Cell["Transform to curvilinear system", "Text"], Cell[BoxData[ \({v . e\_r, v . e\_\[Phi], v . e\_z}\)], "Input"], Cell["Curvilinear vector", "Text"], Cell[BoxData[ \(\(v = {v\_r, v\_\[Phi], v\_z};\)\)], "Input"], Cell["Transform to Cartesian system", "Text"], Cell[BoxData[ \({v . e\_x, v . e\_y, v . e\_z}\)], "Input"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["Gradient, divergence, and curl", "Section"], Cell["Scalar field in curvilinear coordinates", "Text"], Cell[BoxData[ \(\(s = f[r, \[Phi], z];\)\)], "Input"], Cell["Gradient of scalar field", "Text"], Cell[BoxData[ \(Grad[s]\)], "Input"], Cell["Vector field in curvilinear coordinates", "Text"], Cell[BoxData[ \(\(v = {v\_r[r, \[Phi], z], v\_\[Phi][r, \[Phi], z], v\_z[r, \[Phi], z]};\)\)], "Input"], Cell["Divergence of vector field", "Text"], Cell[BoxData[ \(Div[v] // Expand\)], "Input"], Cell["Curl of vector field", "Text"], Cell[BoxData[ \(Curl[v] // Expand\)], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["Laplacian", "Section"], Cell["The Laplacian of scalar field ", "Text"], Cell[BoxData[ \(Laplacian[s] // Expand\)], "Input"], Cell["Laplacian of vector field", "Text"], Cell[BoxData[ \(\(Laplacian[v] // Expand\) // MatrixForm\)], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Tensor operations (not included in original Calculus`VectorAnalysis`)\ \>", "Section"], Cell["Gradient from the left of a vector", "Text"], Cell[BoxData[ \(Grad[v] // MatrixForm\)], "Input"], Cell["\<\ Divergence of the gradient of a vector should equal the Laplacian\ \>", "Text"], Cell[BoxData[ \(\(Div[Grad[v]] // Expand\) // MatrixForm\)], "Input"], Cell["\<\ One may also calculate the inertial acceleration used in fluid mechanics\ \>", "Text"], Cell[BoxData[ \(\(v . Grad[v] // Expand\) // MatrixForm\)], "Input"], Cell["General tensor field", "Text"], Cell[BoxData[ \(\(t = {{t\_rr[r, \[Phi], z], t\_r\[Phi][r, \[Phi], z], t\_rz[r, \[Phi], z]}, {t\_\[Phi]r[r, \[Phi], z], t\_\[Phi]\[Phi][r, \[Phi], z], t\_\[Phi]z[r, \[Phi], z]}, {t\_zr[r, \[Phi], z], t\_z\[Phi][r, \[Phi], z], t\_zz[r, \[Phi], z]}};\)\)], "Input"], Cell[BoxData[ \(t // MatrixForm\)], "Input"], Cell["\<\ Divergence from left of tensor field (for example the stress tensor)\ \>", "Text"], Cell[BoxData[ \(\(Div[t] // Expand\) // MatrixForm\)], "Input"], Cell[CellGroupData[{ Cell["Example", "Subsection"], Cell["\<\ The stress tensor in a Newtonian incompressible fluid depends on the \ symmetric gradient of the velocity field\ \>", "Text"], Cell[BoxData[ \(Grad[v] + Transpose[Grad[v]] // MatrixForm\)], "Input"] }, Open ]] }, Open ]] }, Open ]] }, FrontEndVersion->"5.1 for Microsoft Windows", ScreenRectangle->{{0, 1280}, {0, 941}}, AutoGeneratedPackage->None, WindowSize->{843, 740}, WindowMargins->{{Automatic, 20}, {Automatic, 12}}, ShowSelection->True ] (******************************************************************* Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. *******************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[1754, 51, 60, 1, 30, "Input"], Cell[1817, 54, 163, 3, 33, "Text"], Cell[1983, 59, 86, 1, 30, "Input"], Cell[2072, 62, 69, 1, 30, "Input"], Cell[CellGroupData[{ Cell[2166, 67, 32, 0, 95, "Title"], Cell[2201, 69, 124, 3, 33, "Text"], Cell[CellGroupData[{ Cell[2350, 76, 43, 0, 73, "Section"], Cell[2396, 78, 54, 0, 33, "Text"], Cell[2453, 80, 74, 1, 30, "Input"], Cell[2530, 83, 28, 0, 33, "Text"], Cell[2561, 85, 51, 1, 30, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[2649, 91, 45, 0, 73, "Section"], Cell[2697, 93, 90, 2, 33, "Text"], Cell[2790, 97, 115, 2, 30, "Input"], Cell[2908, 101, 131, 3, 30, "Input"], Cell[CellGroupData[{ Cell[3064, 108, 30, 0, 38, "Subsection"], Cell[3097, 110, 82, 1, 30, "Input"], Cell[3182, 113, 71, 1, 30, "Input"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[3302, 120, 32, 0, 73, "Section"], Cell[3337, 122, 90, 2, 33, "Text"], Cell[3430, 126, 60, 1, 30, "Input"], Cell[3493, 129, 55, 1, 30, "Input"], Cell[3551, 132, 87, 2, 33, "Text"], Cell[3641, 136, 56, 1, 30, "Input"], Cell[3700, 139, 57, 0, 33, "Text"], Cell[3760, 141, 86, 1, 42, "Input"], Cell[3849, 144, 57, 0, 33, "Text"], Cell[3909, 146, 88, 1, 30, "Input"], Cell[CellGroupData[{ Cell[4022, 151, 30, 0, 38, "Subsection"], Cell[4055, 153, 32, 0, 33, "Text"], Cell[4090, 155, 60, 1, 30, "Input"], Cell[4153, 158, 47, 0, 33, "Text"], Cell[4203, 160, 68, 1, 30, "Input"], Cell[4274, 163, 34, 0, 33, "Text"], Cell[4311, 165, 65, 1, 30, "Input"], Cell[4379, 168, 45, 0, 33, "Text"], Cell[4427, 170, 63, 1, 30, "Input"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[4539, 177, 49, 0, 73, "Section"], Cell[4591, 179, 55, 0, 33, "Text"], Cell[4649, 181, 57, 1, 30, "Input"], Cell[4709, 184, 40, 0, 33, "Text"], Cell[4752, 186, 40, 1, 30, "Input"], Cell[4795, 189, 55, 0, 33, "Text"], Cell[4853, 191, 118, 2, 30, "Input"], Cell[4974, 195, 42, 0, 33, "Text"], Cell[5019, 197, 49, 1, 30, "Input"], Cell[5071, 200, 36, 0, 33, "Text"], Cell[5110, 202, 50, 1, 30, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[5197, 208, 28, 0, 73, "Section"], Cell[5228, 210, 46, 0, 33, "Text"], Cell[5277, 212, 55, 1, 30, "Input"], Cell[5335, 215, 41, 0, 33, "Text"], Cell[5379, 217, 73, 1, 30, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[5489, 223, 96, 2, 73, "Section"], Cell[5588, 227, 50, 0, 33, "Text"], Cell[5641, 229, 54, 1, 30, "Input"], Cell[5698, 232, 89, 2, 33, "Text"], Cell[5790, 236, 73, 1, 30, "Input"], Cell[5866, 239, 96, 2, 33, "Text"], Cell[5965, 243, 72, 1, 30, "Input"], Cell[6040, 246, 36, 0, 33, "Text"], Cell[6079, 248, 319, 5, 50, "Input"], Cell[6401, 255, 48, 1, 30, "Input"], Cell[6452, 258, 92, 2, 33, "Text"], Cell[6547, 262, 67, 1, 30, "Input"], Cell[CellGroupData[{ Cell[6639, 267, 29, 0, 38, "Subsection"], Cell[6671, 269, 135, 3, 33, "Text"], Cell[6809, 274, 75, 1, 30, "Input"] }, Open ]] }, Open ]] }, Open ]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)