(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 6.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 37513, 1148] NotebookOptionsPosition[ 27581, 896] NotebookOutlinePosition[ 32522, 1015] CellTagsIndexPosition[ 31321, 989] WindowTitle->Lecture 13 MIT 3.016 (Fall 2011) \251 W. Craig Carter \ 2003--2011 WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell["Divergence and Curl and Their Geometric Interpretations", "Title"], Cell[CellGroupData[{ Cell["Scalar Potentials: Their Gradient Fields and Visualization", "Subtitle", CellChangeTimes->{{3.399384250093862*^9, 3.3993842601783857`*^9}, { 3.399384291818487*^9, 3.399384303154599*^9}}], Cell["\<\ Setting up the combined potential due to three point potentials as an example \ to visualize gradients, divergences, and curls\ \>", "Section"], Cell[BoxData[ RowBox[{"Simple", " ", RowBox[{"(", RowBox[{"2", "D"}], ")"}], " ", FractionBox["1", "r"], " ", RowBox[{"potential", ":", " ", RowBox[{"(", " ", RowBox[{"gravity", ",", " ", RowBox[{ "electrostatic", " ", "potential", " ", "have", " ", "this", " ", "dependency"}]}], ")"}]}]}]], "Text", FontFamily->"Helvetica", CellTags->"mmtag:13:1/r_potentials"], Cell[BoxData[ RowBox[{ RowBox[{"potential", "[", RowBox[{"x_", " ", ",", " ", "y_", ",", " ", "xo_", " ", ",", " ", "yo_"}], "]"}], ":=", " ", RowBox[{ RowBox[{"-", "1"}], "/", RowBox[{"Sqrt", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"x", "-", "xo"}], ")"}], "^", "2"}], " ", "+", " ", RowBox[{ RowBox[{"(", RowBox[{"y", "-", "yo"}], ")"}], "^", "2"}]}], "]"}]}]}]], "Input"], Cell["A field source located a distance 1 south of the origin", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"HoleSouth", "[", RowBox[{"x_", ",", " ", "y_"}], "]"}], " ", ":=", " ", RowBox[{"potential", "[", RowBox[{"x", ",", "y", ",", " ", RowBox[{"Cos", "[", RowBox[{"3", RowBox[{"Pi", "/", "2"}]}], "]"}], ",", " ", RowBox[{"Sin", "[", RowBox[{"3", " ", RowBox[{"Pi", "/", "2"}]}], "]"}]}], "]"}]}]], "Input"], Cell["\<\ Sources located distance 1 at 30\[Degree] and 150\[Degree]:\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"HoleNorthWest", "[", RowBox[{"x_", " ", ",", " ", "y_"}], "]"}], " ", ":=", " ", RowBox[{"potential", "[", RowBox[{"x", ",", "y", ",", " ", RowBox[{"Cos", "[", RowBox[{"Pi", "/", "6"}], "]"}], ",", " ", RowBox[{"Sin", "[", " ", RowBox[{"Pi", "/", "6"}], "]"}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"HoleNorthEast", "[", RowBox[{"x_", " ", ",", " ", "y_"}], "]"}], " ", ":=", " ", RowBox[{"potential", "[", RowBox[{"x", ",", "y", ",", " ", RowBox[{"Cos", "[", " ", RowBox[{"5", " ", RowBox[{"Pi", "/", "6"}]}], "]"}], ",", " ", RowBox[{"Sin", "[", RowBox[{"5", " ", RowBox[{"Pi", "/", "6"}]}], "]"}]}], "]"}]}]], "Input"], Cell["\<\ Function that returns the two dimensional (x,y) gradient field of any \ function declared a function of two arguments:\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"gradfield", "[", "scalarfunction_", "]"}], " ", ":=", " ", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"D", "[", RowBox[{ RowBox[{"scalarfunction", "[", RowBox[{"x", ",", "y"}], "]"}], ",", "x"}], "]"}], "//", "Simplify"}], ",", " ", RowBox[{ RowBox[{"D", "[", RowBox[{ RowBox[{"scalarfunction", "[", RowBox[{"x", ",", "y"}], "]"}], ",", "y"}], "]"}], "//", "Simplify"}]}], "}"}]}]], "Input", CellTags->"mmtag:13:gradient__example_function"], Cell["Generalizing the function to any arguments:", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"gradfield", "[", RowBox[{"scalarfunction_", ",", " ", "x_", " ", ",", " ", "y_"}], "]"}], " ", ":=", " ", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"D", "[", RowBox[{ RowBox[{"scalarfunction", "[", RowBox[{"x", ",", "y"}], "]"}], ",", "x"}], "]"}], "//", "Simplify"}], ",", " ", RowBox[{ RowBox[{"D", "[", RowBox[{ RowBox[{"scalarfunction", "[", RowBox[{"x", ",", "y"}], "]"}], ",", "y"}], "]"}], "//", "Simplify"}]}], "}"}]}]], "Input"], Cell["The sum of three potentials:", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"ThreeHolePotential", "[", RowBox[{"x_", ",", " ", "y_"}], "]"}], " ", ":=", " ", RowBox[{ RowBox[{"HoleSouth", "[", RowBox[{"x", ",", "y"}], "]"}], " ", "+", " ", RowBox[{"HoleNorthWest", "[", RowBox[{"x", ",", "y"}], "]"}], " ", "+", " ", RowBox[{"HoleNorthEast", "[", RowBox[{"x", ",", "y"}], "]"}]}]}]], "Input"], Cell["f(x,y) visualization of the scalar potential:", "Text"], Cell[BoxData[ RowBox[{"Plot3D", "[", RowBox[{ RowBox[{"ThreeHolePotential", "[", RowBox[{"x", ",", "y"}], "]"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{"-", "2"}], ",", "2"}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", RowBox[{"-", "2"}], ",", "2"}], "}"}]}], "]"}]], "Input", CellTags->"mmtag:13:Plot3D[]__example_1/r_potentials"], Cell["Contour visualization of the three-hole potential", "Text"], Cell[BoxData[ RowBox[{"cp", " ", "=", " ", RowBox[{"ContourPlot", "[", RowBox[{ RowBox[{"ThreeHolePotential", "[", RowBox[{"x", ",", "y"}], "]"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{"-", "2"}], ",", "2"}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", RowBox[{"-", "2"}], ",", "2"}], "}"}], ",", RowBox[{"PlotPoints", "\[Rule]", "40"}], ",", RowBox[{"ColorFunction", "\[Rule]", RowBox[{"(", RowBox[{ RowBox[{"Hue", "[", RowBox[{"1", "-", RowBox[{"#", "*", "0.66"}]}], "]"}], "&"}], ")"}]}]}], "]"}]}]], "Input", CellTags->"mmtag:13:ContourPlot[]__example_1/r_potentials"] }, Closed]], Cell[CellGroupData[{ Cell["\<\ Visualizing Gradient Fields and Laplacian of a Scalar Potential\ \>", "Subtitle", CellChangeTimes->{{3.399384250093862*^9, 3.3993842601783857`*^9}, { 3.399384291818487*^9, 3.399384354746304*^9}}], Cell["Gradient field of three-hole potential", "Text"], Cell[BoxData[ RowBox[{"gradthreehole", " ", "=", " ", RowBox[{"gradfield", "[", "ThreeHolePotential", "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"sp", " ", "=", " ", RowBox[{"StreamPlot", "[", RowBox[{"gradthreehole", ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{"-", "2"}], ",", "2"}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", RowBox[{"-", "2"}], ",", "2"}], "}"}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"Show", "[", RowBox[{"cp", ",", "sp"}], "]"}]], "Input"], Cell["\<\ Function that takes a two-dimensional vector function of (x,y) as an argument \ and returns its divergence\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"divergence", "[", RowBox[{"{", RowBox[{"xcomp_", " ", ",", " ", "ycomp_"}], "}"}], "]"}], " ", ":=", " ", RowBox[{"Simplify", "[", RowBox[{ RowBox[{"D", "[", RowBox[{"xcomp", ",", "x"}], "]"}], " ", "+", " ", RowBox[{"D", "[", RowBox[{"ycomp", ",", "y"}], "]"}]}], "]"}]}]], "Input", CellTags->"mmtag:13:divergence__example_function"], Cell[BoxData[ RowBox[{"divgradthreehole", " ", "=", " ", RowBox[{ RowBox[{"divergence", "[", RowBox[{"gradfield", "[", "ThreeHolePotential", "]"}], "]"}], "//", "Simplify"}]}]], "Input"], Cell[BoxData[ RowBox[{"Plotting", " ", "the", " ", "divergence", " ", "of", " ", "the", " ", "gradient", " ", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"\[Del]", RowBox[{"\[CenterDot]", RowBox[{"(", RowBox[{"\[Del]", " ", "f"}], ")"}]}]}], " ", "is", " ", "the", " ", RowBox[{"``Laplacian", "''"}], " ", RowBox[{ SuperscriptBox["\[Del]", "2"], " ", "f"}]}], ",", " ", RowBox[{ "sometimes", " ", "indicated", " ", "with", " ", "symbol", " ", "\[CapitalDelta]f"}]}], ")"}]}]], "Text", FontFamily->"Helvetica", CellTags-> "mmtag:13:laplacian__example_divegence_of_gradient_of_1/r_potentials"], Cell[BoxData[ RowBox[{"accumulation3D", " ", "=", " ", RowBox[{"Plot3D", "[", RowBox[{ RowBox[{"-", "divgradthreehole"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{"-", "2"}], ",", "2"}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", RowBox[{"-", "2"}], ",", "2"}], "}"}], ",", RowBox[{"PlotPoints", "->", "60"}]}], "]"}]}]], "Input", CellTags->"mmtag:13:Plot3D[]__example_divegence_of_1/r_potentials"], Cell[BoxData[ RowBox[{"accumulation", " ", "=", " ", RowBox[{"ContourPlot", "[", RowBox[{ RowBox[{"-", "divgradthreehole"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{"-", "2"}], ",", "2"}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", RowBox[{"-", "2"}], ",", "2"}], "}"}], ",", RowBox[{"PlotPoints", "\[Rule]", "40"}], ",", RowBox[{"ColorFunction", "\[Rule]", RowBox[{"(", RowBox[{ RowBox[{"Hue", "[", RowBox[{"#", "*", "0.66"}], "]"}], "&"}], ")"}]}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"fluxes", " ", "=", " ", RowBox[{"StreamPlot", "[", RowBox[{ RowBox[{"-", "gradthreehole"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{"-", "2"}], ",", "2"}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", RowBox[{"-", "2"}], ",", "2"}], "}"}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"Show", "[", RowBox[{"accumulation", ",", "fluxes"}], "]"}]], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Coordinate Transformations in the Vector Analysis Package", "Subtitle", CellChangeTimes->{{3.3993844484424562`*^9, 3.399384453698133*^9}, 3.399385090045039*^9}], Cell[TextData[{ "It is no surprise that many of these differential operations already exist \ in ", StyleBox["Mathematica", FontSlant->"Italic"], " packages." }], "Text"], Cell[BoxData[ RowBox[{"<<", "\"\\""}]], "Input", CellTags->"mmtag:13:VectorAnalysis_package"], Cell["Coordinate Systems", "Section"], Cell["Converting between coordinate systems", "Subsection", CellTags->"mmtag:13:coordinate_systems__converting_between"], Cell["\<\ The spherical coordinates expressed in terms of the cartesian x,y,z\ \>", "Text"], Cell[BoxData[ RowBox[{"CoordinatesFromCartesian", "[", RowBox[{ RowBox[{"{", RowBox[{"x", ",", "y", ",", "z"}], "}"}], ",", RowBox[{"Spherical", "[", RowBox[{"r", ",", "theta", ",", "phi"}], "]"}]}], "]"}]], "Input", CellTags->"mmtag:13:CoordinatesFromCartesian[]"], Cell["\<\ The cartesian coordinates expressed in terms of the spherical r \[Theta] \ \[Phi]\ \>", "Text"], Cell[BoxData[ RowBox[{"CoordinatesToCartesian", "[", RowBox[{ RowBox[{"{", RowBox[{"r", ",", "theta", ",", "phi"}], "}"}], ",", RowBox[{"Spherical", "[", RowBox[{"r", ",", "theta", ",", "phi"}], "]"}]}], "]"}]], "Input", CellTags->"mmtag:13:CoordinatesToCartesian[]"], Cell["\<\ The equation of a line through the origin in spherical coodinates\ \>", "Text"], Cell[BoxData[ RowBox[{"Simplify", "[", RowBox[{ RowBox[{"CoordinatesFromCartesian", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"a", " ", "t"}], ",", " ", RowBox[{"b", " ", "t"}], ",", " ", RowBox[{"c", " ", "t"}]}], "}"}], ",", RowBox[{"Spherical", "[", RowBox[{"r", ",", "theta", ",", "phi"}], "]"}]}], "]"}], ",", RowBox[{"t", " ", ">", " ", "0"}]}], "]"}]], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["\<\ Coordinate Transforms Example: Calculating Distances between Two Cities\ \>", "Subtitle", CellChangeTimes->{{3.3993844484424562`*^9, 3.399384453698133*^9}, { 3.399384870844368*^9, 3.399384905386351*^9}}], Cell["\<\ An example of calculating the positions of cities in cartesian and spherical \ coordinates.\ \>", "Text"], Cell["\<\ Boston is located at latitude 42\[Degree] 21' 30\" N and longitude -71\ \[Degree],-3',-37\" W (The following use of CityData will not work unless \ you have an active internet connection)\ \>", "Text", CellChangeTimes->{{3.3993830375751038`*^9, 3.3993830782423773`*^9}}, CellTags->"mmtag:13:latitude_and_longitude"], Cell[BoxData[ RowBox[{" ", RowBox[{"CityData", "[", RowBox[{"\"\\"", ",", "\"\\""}], "]"}]}]], "Input", CellChangeTimes->{{3.399106590950561*^9, 3.3991066027352533`*^9}, 3.399383112964658*^9}, CellTags->"mmtag:13:CityData[]"], Cell[BoxData[ RowBox[{" ", RowBox[{"CityData", "[", RowBox[{"\"\\"", ",", "\"\\""}], "]"}]}]], "Input", CellChangeTimes->{{3.399106590950561*^9, 3.3991066027352533`*^9}, { 3.3993831154752274`*^9, 3.399383139469803*^9}}, CellTags->"mmtag:13:CityData[]"], Cell[BoxData[ RowBox[{" ", RowBox[{"CityData", "[", RowBox[{"\"\\"", ",", "\"\\""}], "]"}]}]], "Input", CellChangeTimes->{{3.399382394248097*^9, 3.3993824029630404`*^9}, 3.399383117898963*^9}], Cell["\<\ Introduce a function that finds the spherical coordinates of a \ \>", "Text", CellChangeTimes->{{3.399108240358695*^9, 3.399108260388237*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"SphericalCoordinatesofCity", "[", "cityname_String", "]"}], " ", ":=", " ", "\[IndentingNewLine]", RowBox[{"{", "\[IndentingNewLine]", RowBox[{"6378.1", " ", ",", RowBox[{ RowBox[{"CityData", "[", RowBox[{"cityname", ",", "\"\\""}], "]"}], " ", "Degree"}], ",", "\[IndentingNewLine]", " ", RowBox[{ RowBox[{"CityData", "[", RowBox[{"cityname", ",", "\"\\""}], "]"}], " ", "Degree"}]}], "\[IndentingNewLine]", "}"}]}]], "Input", CellChangeTimes->{{3.399382417530838*^9, 3.3993824606859913`*^9}, { 3.3993825267675343`*^9, 3.399382528613737*^9}, {3.399382708146554*^9, 3.399382819527821*^9}}, CellTags->"mmtag:13:SphericalCoordinatesofCity[]__example_function"], Cell[BoxData[ RowBox[{"SphericalCoordinatesofCity", "[", "\"\\"", "]"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"LatLong", "[", "city_String", "]"}], " ", ":=", RowBox[{"{", RowBox[{ RowBox[{"CityData", "[", RowBox[{"city", ",", "\"\\""}], "]"}], ",", RowBox[{"CityData", "[", RowBox[{"city", ",", "\"\\""}], "]"}]}], "}"}]}], " ", "\[IndentingNewLine]"}]], "Input", CellChangeTimes->{{3.399383723653946*^9, 3.399383726748345*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"CartesianCoordinatesofCity", "[", "cityname_String", "]"}], " ", ":=", " ", RowBox[{"CoordinatesToCartesian", "[", RowBox[{ RowBox[{"SphericalCoordinatesofCity", "[", "cityname", "]"}], ",", RowBox[{"Spherical", "[", RowBox[{"r", ",", "theta", ",", "phi"}], "]"}]}], "]"}]}]], "Input", CellTags->{ "mmtag:13:CartesianCoordinatesofCity[]__example_function", "mmtag:13:distances_from_Boston_to_Paris"}], Cell[BoxData[ RowBox[{"CartesianCoordinatesofCity", "[", "\"\\"", "]"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"MinimumTunnel", "[", RowBox[{"city1_String", ",", "city2_String"}], "]"}], " ", ":=", "\[IndentingNewLine]", RowBox[{"Norm", "[", RowBox[{ RowBox[{"CartesianCoordinatesofCity", "[", "city1", "]"}], "-", RowBox[{"CartesianCoordinatesofCity", "[", "city2", "]"}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"MinimumTunnel", "[", RowBox[{"\"\\"", ",", "\"\\""}], "]"}]], "Input", CellChangeTimes->{{3.399383648364065*^9, 3.399383661443245*^9}}], Cell["\<\ Minimum travel distance between Boston and Paris for a round earth\ \>", "Text"], Cell[BoxData[ RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", CellChangeTimes->{{3.399382900000764*^9, 3.3993829107234*^9}}], Cell[BoxData[ RowBox[{"SphericalDistance", "[", RowBox[{ RowBox[{"LatLong", "[", "\"\\"", "]"}], ",", RowBox[{"LatLong", "[", "\"\\"", "]"}]}], "]"}]], "Input", CellChangeTimes->{{3.3993832783630238`*^9, 3.399383593173455*^9}, { 3.3993836401134777`*^9, 3.399383665251449*^9}, {3.3993837331796503`*^9, 3.399383741291792*^9}}], Cell[BoxData[ RowBox[{"SpheroidalDistance", "[", RowBox[{ RowBox[{"LatLong", "[", "\"\\"", "]"}], ",", RowBox[{"LatLong", "[", "\"\\"", "]"}]}], "]"}]], "Input", CellChangeTimes->{{3.399383611854116*^9, 3.399383619262375*^9}, 3.39938367730409*^9, {3.399383745487308*^9, 3.3993837544437428`*^9}}] }, Closed]], Cell[CellGroupData[{ Cell["\<\ Using Vector Derivative Functions in the Vector Analysis Package\ \>", "Subtitle"], Cell[BoxData[ RowBox[{ RowBox[{"SimplePot", "[", RowBox[{"x_", " ", ",", " ", "y_", " ", ",", " ", "z_", ",", " ", "n_"}], "]"}], " ", ":=", FractionBox["1", SuperscriptBox[ RowBox[{"(", RowBox[{ RowBox[{"x", "^", "2"}], " ", "+", " ", RowBox[{"y", "^", "2"}], " ", "+", " ", RowBox[{"z", "^", "2"}]}], ")"}], FractionBox["n", "2"]]]}]], "Input"], Cell[BoxData[ RowBox[{"gradsp", " ", "=", RowBox[{"Grad", "[", RowBox[{ RowBox[{"SimplePot", "[", RowBox[{"x", ",", "y", ",", "z", ",", "1"}], "]"}], ",", RowBox[{"Cartesian", "[", RowBox[{"x", ",", "y", ",", "z"}], "]"}]}], "]"}]}]], "Input", CellTags->"mmtag:13:Grad[]"], Cell[BoxData[ RowBox[{"The", " ", "above", " ", "is", " ", "equal", " ", "to", " ", FractionBox[ OverscriptBox["r", "\[Rule]"], SuperscriptBox[ RowBox[{"(", RowBox[{"||", OverscriptBox["r", "\[Rule]"], "||"}], ")"}], "3"]]}]], "Text", FontFamily->"Helvetica"], Cell[BoxData[ RowBox[{"Examples", ":", " ", RowBox[{ "the", " ", "same", " ", "function", " ", "and", " ", "gradient", " ", "in", " ", "different", " ", "coordinate", " ", "systems"}]}]], "Text", FontFamily->"Helvetica"], Cell[BoxData[ RowBox[{ RowBox[{"SimplePot", "[", RowBox[{"r_", ",", " ", "n_"}], "]"}], " ", ":=", FractionBox["1", SuperscriptBox["r", "n"]]}]], "Input"], Cell[BoxData[ RowBox[{"gradsphere", "=", RowBox[{"Grad", "[", RowBox[{ RowBox[{"SimplePot", "[", RowBox[{"r", ",", "1"}], "]"}], ",", " ", RowBox[{"Spherical", "[", RowBox[{"r", ",", "\[Theta]", ",", " ", "\[CurlyPhi]"}], "]"}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"Grad", "[", RowBox[{ RowBox[{"SimplePot", "[", RowBox[{"r", ",", "1"}], "]"}], ",", " ", RowBox[{"Cylindrical", "[", RowBox[{"r", ",", "\[Theta]", ",", " ", "z"}], "]"}]}], "]"}]], "Input"], Cell[BoxData[ RowBox[{"Grad", "[", RowBox[{ RowBox[{"SimplePot", "[", RowBox[{"r", ",", "1"}], "]"}], ",", " ", RowBox[{"ProlateSpheroidal", "[", RowBox[{"r", ",", "\[Theta]", ",", "\[CurlyPhi]"}], "]"}]}], "]"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"GradSimplePot", "[", RowBox[{"x_", ",", " ", "y_", ",", " ", "z_", ",", " ", "n_"}], "]"}], " ", ":=", RowBox[{"Evaluate", "[", RowBox[{"Grad", "[", RowBox[{ RowBox[{"SimplePot", "[", RowBox[{"x", ",", "y", ",", "z", ",", "n"}], "]"}], ",", RowBox[{"Cartesian", "[", RowBox[{"x", ",", "y", ",", "z"}], "]"}]}], "]"}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"Div", "[", RowBox[{ RowBox[{"GradSimplePot", "[", RowBox[{"x", ",", "y", ",", "z", ",", "n"}], "]"}], ",", RowBox[{"Cartesian", "[", RowBox[{"x", ",", "y", ",", "z"}], "]"}]}], "]"}], "//", "Simplify"}]], "Input", CellTags->"mmtag:13:Div[]"], Cell[BoxData[ RowBox[{"The", " ", "above", " ", "is", " ", "equal", " ", "to", " ", FractionBox[ RowBox[{"n", RowBox[{"(", RowBox[{"n", "-", "1"}], ")"}], OverscriptBox["r", "\[Rule]"]}], SuperscriptBox[ RowBox[{"(", RowBox[{"||", OverscriptBox["r", "\[Rule]"], "||"}], ")"}], RowBox[{"2", "+", "n"}]]]}]], "Text", FontFamily->"Helvetica"], Cell[BoxData[ RowBox[{ RowBox[{"Div", "[", RowBox[{ RowBox[{"GradSimplePot", "[", RowBox[{"x", ",", "y", ",", "z", ",", "1"}], "]"}], ",", RowBox[{"Cartesian", "[", RowBox[{"x", ",", "y", ",", "z"}], "]"}]}], "]"}], "//", "Simplify"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"This", " ", "makes", " ", RowBox[{"``sense", "''"}], " ", "because", " ", "the", " ", "amount", " ", "of", " ", "stuff", " ", "flowing", " ", "into", " ", "a", " ", "sphere", " ", "is", " ", "like", " ", "the", " ", "gradient", "*", "4", "\[Pi]", " ", SuperscriptBox["r", "2"], " ", "which", " ", "is", " ", "independent", " ", "of", " ", "the", " ", "size", " ", "of", " ", "the", " ", "sphere", " ", "for", " ", "n"}], "=", "1"}]], "Text", FontFamily->"Helvetica"] }, Closed]], Cell[CellGroupData[{ Cell["A Visualization Example of the Curl", "Subtitle"], Cell[TextData[{ "There is a very useful free software tool for solving minimal surface (and \ many other) variational problems called ", ButtonBox["Surface Evolver", BaseStyle->"Hyperlink", ButtonData:>{ URL["http://www.susqu.edu/facstaff/b/brakke/evolver/"], None}], " by Ken Brakke. To use Surface Evolver to greatest possible advantage, a \ user should be adept at using results from vector analysis. ", StyleBox["Mathematica's ", FontSlant->"Italic"], "Vector Analysis package is very helpful aid for developing powerful Evolver \ codes. The following example is extracted from the ", ButtonBox["Surface Evolver manual", BaseStyle->"Hyperlink", ButtonData:>{ URL["http://www.susqu.edu/facstaff/b/brakke/evolver/manual220.pdf"], None}], "." }], "Section"], Cell[BoxData[ RowBox[{ RowBox[{"LeavingKansas", "[", RowBox[{"x_", ",", " ", "y_", ",", " ", "z_", " ", ",", " ", "n_"}], "]"}], ":=", " ", RowBox[{ FractionBox[ SuperscriptBox["z", "n"], RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"x", "^", "2"}], " ", "+", " ", RowBox[{"y", "^", "2"}]}], ")"}], SuperscriptBox[ RowBox[{"(", RowBox[{ RowBox[{"x", "^", "2"}], " ", "+", " ", RowBox[{"y", "^", "2"}], " ", "+", " ", RowBox[{"z", "^", "2"}]}], ")"}], FractionBox["n", "2"]]}]], " ", RowBox[{"{", RowBox[{"y", ",", RowBox[{"-", "x"}], ",", " ", "0"}], "}"}]}]}]], "Input"], Cell[BoxData[ RowBox[{"LeavingKansas", "[", RowBox[{"x", ",", "y", ",", "z", ",", "3"}], "]"}]], "Input"], Cell["\<\ Visualize the vector field for n=3, note that the function will be singular \ near the z-axis\ \>", "Text"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"\[IndentingNewLine]", RowBox[{"VectorPlot3D", "[", RowBox[{ RowBox[{"Evaluate", "@", RowBox[{"LeavingKansas", "[", RowBox[{"x", ",", "y", ",", "z", ",", "3"}], "]"}]}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{"-", "1"}], ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", RowBox[{"-", "1"}], ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"z", ",", RowBox[{"-", "0.5"}], ",", "0.5"}], "}"}]}], "]"}]}]], "Input", CellTags->"mmtag:13:PlotVectorField3D[]"], Cell["using the symmetry of the field", "Text", CellChangeTimes->{{3.399107242211705*^9, 3.399107254321549*^9}}] }, Open ]], Cell[BoxData[ RowBox[{"?", "VectorPlot3D"}]], "Input"], Cell[BoxData[ RowBox[{"VectorPlot3D", "[", RowBox[{ RowBox[{"LeavingKansas", "[", RowBox[{"x", ",", "y", ",", "z", ",", "3"}], "]"}], ",", RowBox[{"{", RowBox[{"x", ",", "0", ",", ".5"}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", "0", ",", ".5"}], "}"}], ",", RowBox[{"{", RowBox[{"z", ",", "0.0", ",", "0.5"}], "}"}], ",", RowBox[{"VectorColorFunction", "\[Rule]", RowBox[{"(", RowBox[{ RowBox[{"Hue", "[", RowBox[{"#1", " ", "0.66"}], "]"}], "&"}], ")"}]}], ",", RowBox[{"VectorPoints", "\[Rule]", " ", RowBox[{"{", RowBox[{"16", ",", "16", ",", "4"}], "}"}]}], ",", RowBox[{"VectorScale", "\[Rule]", " ", "0.2"}]}], "]"}]], "Input"], Cell["\<\ Calculate the curl of the function using the VectorAnalysis package--note \ that the coordinate system is specified as cartesian. For the particular case of n=3:\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"Curl", "[", RowBox[{ RowBox[{"LeavingKansas", "[", RowBox[{"x", ",", "y", ",", "z", ",", "3"}], "]"}], ",", RowBox[{"Cartesian", "[", RowBox[{"x", ",", "y", ",", "z"}], "]"}]}], "]"}], "//", "Simplify"}]], "Input", CellTags->"mmtag:13:Curl[]"], Cell["Define a new vector function for the curl for general n", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"Glenda", "[", RowBox[{"x_", ",", "y_", ",", "z_", ",", "n_"}], "]"}], ":=", RowBox[{"Simplify", "[", RowBox[{"Curl", "[", RowBox[{ RowBox[{"LeavingKansas", "[", RowBox[{"x", ",", "y", ",", "z", ",", "n"}], "]"}], ",", RowBox[{"Cartesian", "[", RowBox[{"x", ",", "y", ",", "z"}], "]"}]}], "]"}], "]"}]}]], "Input"], Cell["\<\ Demonstrate the assertion that the curl has a fairly simple form and is \ sphericaly symmetric for n=1\ \>", "Text"], Cell[BoxData[ RowBox[{"Glenda", "[", RowBox[{"x", ",", "y", ",", "z", ",", "n"}], "]"}]], "Input"], Cell[BoxData[ RowBox[{"Glenda", "[", RowBox[{"x", ",", "y", ",", "z", ",", "1"}], "]"}]], "Input"], Cell[BoxData[ StyleBox[ RowBox[{ RowBox[{ "The", " ", "above", " ", "is", " ", "a", " ", "vector", " ", "field", " ", "that", " ", "points", " ", "radially", " ", "from", " ", "the", " ", "origin"}], ",", " ", RowBox[{ "with", " ", "a", " ", "magnitude", " ", "that", " ", "falls", " ", "off", " ", "like", " ", RowBox[{"1", "/", SuperscriptBox["r", "2"]}]}]}], "Text"]], "Text"], Cell["\<\ Visualize the curl for n=1, it will be necessary to \"zoom\" in to see the \ field.\ \>", "Text", CellChangeTimes->{{3.3991080248751783`*^9, 3.399108042076261*^9}}], Cell[BoxData[ RowBox[{"VectorPlot3D", "[", RowBox[{ RowBox[{"Evaluate", "[", RowBox[{"Glenda", "[", RowBox[{"x", ",", "y", ",", "z", ",", "1"}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{"-", "0.5"}], ",", "0.5"}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", RowBox[{"-", "0.5"}], ",", "0.5"}], "}"}], ",", RowBox[{"{", RowBox[{"z", ",", RowBox[{"-", "0.25"}], ",", "0.25"}], "}"}], ",", RowBox[{"ColorFunction", "\[Rule]", RowBox[{"(", RowBox[{ RowBox[{"Hue", "[", RowBox[{"#1", " ", "0.66`"}], "]"}], "&"}], ")"}]}], ",", RowBox[{"VectorPoints", "\[Rule]", " ", RowBox[{"{", RowBox[{"16", ",", "16", ",", "12"}], "}"}]}]}], "]"}]], "Input"], Cell["\<\ Demonstrate that the divergence of the curl vanishes for the above function \ independent of n\ \>", "Text", CellTags->"mmtag:13:divergence_of_curl__example"], Cell[BoxData[ RowBox[{"DivCurl", "=", RowBox[{"Div", "[", RowBox[{ RowBox[{"Glenda", "[", RowBox[{"x", ",", "y", ",", "z", ",", "n"}], "]"}], ",", RowBox[{"Cartesian", "[", RowBox[{"x", ",", "y", ",", "z"}], "]"}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"Simplify", "[", "DivCurl", "]"}]], "Input"] }, Closed]] }, CellGrouping->Manual, WindowSize->{1000, 708}, WindowMargins->{{254, Automatic}, {Automatic, 100}}, WindowTitle->"Lecture 13 MIT 3.016 (Fall 2011) \[Copyright] W. Craig Carter \ 2003--2011", PrintingCopies->1, PrintingPageRange->{1, Automatic}, ShowSelection->True, ShowCellLabel->False, CellLabelAutoDelete->True, FrontEndVersion->"8.0 for Mac OS X x86 (32-bit, 64-bit Kernel) (November 6, \ 2010)", StyleDefinitions->FrontEnd`FileName[{"Creative"}, "NaturalColor.nb", CharacterEncoding -> "UTF-8"] ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{ "mmtag:13:1/r_potentials"->{ Cell[1079, 35, 407, 12, 43, "Text", CellTags->"mmtag:13:1/r_potentials"]}, "mmtag:13:gradient__example_function"->{ Cell[3385, 113, 555, 17, 37, "Input", CellTags->"mmtag:13:gradient__example_function"]}, "mmtag:13:Plot3D[]__example_1/r_potentials"->{ Cell[5064, 170, 379, 11, 37, "Input", CellTags->"mmtag:13:Plot3D[]__example_1/r_potentials"]}, "mmtag:13:ContourPlot[]__example_1/r_potentials"->{ Cell[5514, 185, 685, 20, 37, "Input", CellTags->"mmtag:13:ContourPlot[]__example_1/r_potentials"]}, "mmtag:13:divergence__example_function"->{ Cell[7161, 242, 407, 11, 37, "Input", CellTags->"mmtag:13:divergence__example_function"]}, "mmtag:13:laplacian__example_divegence_of_gradient_of_1/r_potentials"->{ Cell[7776, 262, 667, 18, 37, "Text", CellTags-> "mmtag:13:laplacian__example_divegence_of_gradient_of_1/r_potentials"]}, "mmtag:13:Plot3D[]__example_divegence_of_1/r_potentials"->{ Cell[8446, 282, 455, 12, 37, "Input", CellTags->"mmtag:13:Plot3D[]__example_divegence_of_1/r_potentials"]}, "mmtag:13:VectorAnalysis_package"->{ Cell[10290, 345, 113, 2, 37, "Input", CellTags->"mmtag:13:VectorAnalysis_package"]}, "mmtag:13:coordinate_systems__converting_between"->{ Cell[10446, 351, 121, 1, 26, "Subsection", CellTags->"mmtag:13:coordinate_systems__converting_between"]}, "mmtag:13:CoordinatesFromCartesian[]"->{ Cell[10664, 358, 287, 7, 37, "Input", CellTags->"mmtag:13:CoordinatesFromCartesian[]"]}, "mmtag:13:CoordinatesToCartesian[]"->{ Cell[11062, 372, 289, 7, 37, "Input", CellTags->"mmtag:13:CoordinatesToCartesian[]"]}, "mmtag:13:latitude_and_longitude"->{ Cell[12255, 413, 329, 6, 26, "Text", CellTags->"mmtag:13:latitude_and_longitude"]}, "mmtag:13:CityData[]"->{ Cell[12587, 421, 259, 6, 37, "Input", CellTags->"mmtag:13:CityData[]"], Cell[12849, 429, 287, 6, 37, "Input", CellTags->"mmtag:13:CityData[]"]}, "mmtag:13:SphericalCoordinatesofCity[]__example_function"->{ Cell[13523, 449, 778, 17, 98, "Input", CellTags->"mmtag:13:SphericalCoordinatesofCity[]__example_function"]}, "mmtag:13:CartesianCoordinatesofCity[]__example_function"->{ Cell[14828, 484, 467, 11, 37, "Input", CellTags->{ "mmtag:13:CartesianCoordinatesofCity[]__example_function", "mmtag:13:distances_from_Boston_to_Paris"}]}, "mmtag:13:distances_from_Boston_to_Paris"->{ Cell[14828, 484, 467, 11, 37, "Input", CellTags->{ "mmtag:13:CartesianCoordinatesofCity[]__example_function", "mmtag:13:distances_from_Boston_to_Paris"}]}, "mmtag:13:Grad[]"->{ Cell[17378, 562, 302, 8, 37, "Input", CellTags->"mmtag:13:Grad[]"]}, "mmtag:13:Div[]"->{ Cell[19568, 636, 305, 9, 37, "Input", CellTags->"mmtag:13:Div[]"]}, "mmtag:13:PlotVectorField3D[]"->{ Cell[22908, 744, 563, 16, 53, "Input", CellTags->"mmtag:13:PlotVectorField3D[]"]}, "mmtag:13:Curl[]"->{ Cell[24575, 796, 307, 9, 37, "Input", CellTags->"mmtag:13:Curl[]"]}, "mmtag:13:divergence_of_curl__example"->{ Cell[27059, 877, 169, 4, 26, "Text", CellTags->"mmtag:13:divergence_of_curl__example"]} } *) (*CellTagsIndex CellTagsIndex->{ {"mmtag:13:1/r_potentials", 28216, 916}, {"mmtag:13:gradient__example_function", 28338, 919}, {"mmtag:13:Plot3D[]__example_1/r_potentials", 28480, 922}, {"mmtag:13:ContourPlot[]__example_1/r_potentials", 28633, 925}, {"mmtag:13:divergence__example_function", 28782, 928}, {"mmtag:13:laplacian__example_divegence_of_gradient_of_1/r_potentials", \ 28952, 931}, {"mmtag:13:Plot3D[]__example_divegence_of_1/r_potentials", 29143, 935}, {"mmtag:13:VectorAnalysis_package", 29294, 938}, {"mmtag:13:coordinate_systems__converting_between", 29438, 941}, {"mmtag:13:CoordinatesFromCartesian[]", 29591, 944}, {"mmtag:13:CoordinatesToCartesian[]", 29725, 947}, {"mmtag:13:latitude_and_longitude", 29855, 950}, {"mmtag:13:CityData[]", 29970, 953}, {"mmtag:13:SphericalCoordinatesofCity[]__example_function", 30187, 958}, {"mmtag:13:CartesianCoordinatesofCity[]__example_function", 30364, 961}, {"mmtag:13:distances_from_Boston_to_Paris", 30581, 966}, {"mmtag:13:Grad[]", 30774, 971}, {"mmtag:13:Div[]", 30869, 974}, {"mmtag:13:PlotVectorField3D[]", 30977, 977}, {"mmtag:13:Curl[]", 31087, 980}, {"mmtag:13:divergence_of_curl__example", 31204, 983} } *) (*NotebookFileOutline Notebook[{ Cell[628, 22, 72, 0, 60, "Title"], Cell[CellGroupData[{ Cell[725, 26, 195, 2, 21, "Subtitle"], Cell[923, 30, 153, 3, 72, "Section"], Cell[1079, 35, 407, 12, 43, "Text", CellTags->"mmtag:13:1/r_potentials"], Cell[1489, 49, 443, 14, 37, "Input"], Cell[1935, 65, 71, 0, 26, "Text"], Cell[2009, 67, 384, 11, 37, "Input"], Cell[2396, 80, 83, 2, 26, "Text"], Cell[2482, 84, 349, 9, 37, "Input"], Cell[2834, 95, 403, 11, 37, "Input"], Cell[3240, 108, 142, 3, 26, "Text"], Cell[3385, 113, 555, 17, 37, "Input", CellTags->"mmtag:13:gradient__example_function"], Cell[3943, 132, 59, 0, 26, "Text"], Cell[4005, 134, 559, 18, 37, "Input"], Cell[4567, 154, 44, 0, 26, "Text"], Cell[4614, 156, 383, 10, 37, "Input"], Cell[5000, 168, 61, 0, 26, "Text"], Cell[5064, 170, 379, 11, 37, "Input", CellTags->"mmtag:13:Plot3D[]__example_1/r_potentials"], Cell[5446, 183, 65, 0, 26, "Text"], Cell[5514, 185, 685, 20, 37, "Input", CellTags->"mmtag:13:ContourPlot[]__example_1/r_potentials"] }, Closed]], Cell[CellGroupData[{ Cell[6236, 210, 208, 4, 21, "Subtitle"], Cell[6447, 216, 54, 0, 26, "Text"], Cell[6504, 218, 124, 2, 37, "Input"], Cell[6631, 222, 309, 9, 37, "Input"], Cell[6943, 233, 82, 2, 37, "Input"], Cell[7028, 237, 130, 3, 26, "Text"], Cell[7161, 242, 407, 11, 37, "Input", CellTags->"mmtag:13:divergence__example_function"], Cell[7571, 255, 202, 5, 37, "Input"], Cell[7776, 262, 667, 18, 37, "Text", CellTags-> "mmtag:13:laplacian__example_divegence_of_gradient_of_1/r_potentials"], Cell[8446, 282, 455, 12, 37, "Input", CellTags->"mmtag:13:Plot3D[]__example_divegence_of_1/r_potentials"], Cell[8904, 296, 562, 16, 37, "Input"], Cell[9469, 314, 333, 10, 37, "Input"], Cell[9805, 326, 96, 2, 37, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[9938, 333, 171, 2, 21, "Subtitle"], Cell[10112, 337, 175, 6, 26, "Text"], Cell[10290, 345, 113, 2, 37, "Input", CellTags->"mmtag:13:VectorAnalysis_package"], Cell[10406, 349, 37, 0, 72, "Section"], Cell[10446, 351, 121, 1, 26, "Subsection", CellTags->"mmtag:13:coordinate_systems__converting_between"], Cell[10570, 354, 91, 2, 23, "Text"], Cell[10664, 358, 287, 7, 37, "Input", CellTags->"mmtag:13:CoordinatesFromCartesian[]"], Cell[10954, 367, 105, 3, 26, "Text"], Cell[11062, 372, 289, 7, 37, "Input", CellTags->"mmtag:13:CoordinatesToCartesian[]"], Cell[11354, 381, 90, 2, 26, "Text"], Cell[11447, 385, 434, 12, 37, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[11918, 402, 216, 4, 21, "Subtitle"], Cell[12137, 408, 115, 3, 26, "Text"], Cell[12255, 413, 329, 6, 26, "Text", CellTags->"mmtag:13:latitude_and_longitude"], Cell[12587, 421, 259, 6, 37, "Input", CellTags->"mmtag:13:CityData[]"], Cell[12849, 429, 287, 6, 37, "Input", CellTags->"mmtag:13:CityData[]"], Cell[13139, 437, 225, 5, 37, "Input"], Cell[13367, 444, 153, 3, 26, "Text"], Cell[13523, 449, 778, 17, 98, "Input", CellTags->"mmtag:13:SphericalCoordinatesofCity[]__example_function"], Cell[14304, 468, 92, 1, 37, "Input"], Cell[14399, 471, 426, 11, 53, "Input"], Cell[14828, 484, 467, 11, 37, "Input", CellTags->{ "mmtag:13:CartesianCoordinatesofCity[]__example_function", "mmtag:13:distances_from_Boston_to_Paris"}], Cell[15298, 497, 91, 1, 37, "Input"], Cell[15392, 500, 344, 9, 53, "Input"], Cell[15739, 511, 180, 3, 37, "Input"], Cell[15922, 516, 90, 2, 26, "Text"], Cell[16015, 520, 137, 2, 37, "Input"], Cell[16155, 524, 358, 7, 37, "Input"], Cell[16516, 533, 328, 6, 37, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[16881, 544, 92, 2, 21, "Subtitle"], Cell[16976, 548, 399, 12, 67, "Input"], Cell[17378, 562, 302, 8, 37, "Input", CellTags->"mmtag:13:Grad[]"], Cell[17683, 572, 288, 8, 70, "Text"], Cell[17974, 582, 231, 5, 26, "Text"], Cell[18208, 589, 168, 5, 56, "Input"], Cell[18379, 596, 282, 8, 37, "Input"], Cell[18664, 606, 233, 6, 37, "Input"], Cell[18900, 614, 247, 7, 37, "Input"], Cell[19150, 623, 415, 11, 37, "Input"], Cell[19568, 636, 305, 9, 37, "Input", CellTags->"mmtag:13:Div[]"], Cell[19876, 647, 389, 12, 70, "Text"], Cell[20268, 661, 276, 8, 37, "Input"], Cell[20547, 671, 530, 10, 31, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[21114, 686, 55, 0, 21, "Subtitle"], Cell[21172, 688, 791, 19, 132, "Section"], Cell[21966, 709, 685, 22, 66, "Input"], Cell[22654, 733, 109, 2, 37, "Input"], Cell[22766, 737, 117, 3, 26, "Text"], Cell[CellGroupData[{ Cell[22908, 744, 563, 16, 53, "Input", CellTags->"mmtag:13:PlotVectorField3D[]"], Cell[23474, 762, 113, 1, 26, "Text"] }, Open ]], Cell[23602, 766, 55, 1, 37, "Input"], Cell[23660, 769, 723, 19, 53, "Input"], Cell[24386, 790, 186, 4, 41, "Text"], Cell[24575, 796, 307, 9, 37, "Input", CellTags->"mmtag:13:Curl[]"], Cell[24885, 807, 71, 0, 26, "Text"], Cell[24959, 809, 389, 10, 37, "Input"], Cell[25351, 821, 126, 3, 26, "Text"], Cell[25480, 826, 102, 2, 37, "Input"], Cell[25585, 830, 102, 2, 37, "Input"], Cell[25690, 834, 421, 11, 37, "Text"], Cell[26114, 847, 175, 4, 26, "Text"], Cell[26292, 853, 764, 22, 53, "Input"], Cell[27059, 877, 169, 4, 26, "Text", CellTags->"mmtag:13:divergence_of_curl__example"], Cell[27231, 883, 264, 7, 37, "Input"], Cell[27498, 892, 67, 1, 37, "Input"] }, Closed]] } ] *) (* End of internal cache information *)