(* 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[ 35149, 992] NotebookOptionsPosition[ 30448, 857] NotebookOutlinePosition[ 32597, 920] CellTagsIndexPosition[ 32166, 908] WindowFrame->Normal ContainsDynamic->False*) (* Beginning of Notebook Content *) Notebook[{ Cell["Visualizing Time-Dependent Scalar and Vector Fields", "Title"], Cell[CellGroupData[{ Cell["Cross Products", "Subtitle"], Cell["Here is the built-in cross product between two vectors", "Text"], Cell[BoxData[ RowBox[{"crossab", " ", "=", RowBox[{"Cross", "[", RowBox[{ RowBox[{"{", RowBox[{ SubscriptBox["a", "1"], ",", SubscriptBox["a", "2"], ",", SubscriptBox["a", "3"]}], "}"}], " ", ",", RowBox[{"{", RowBox[{ SubscriptBox["b", "1"], ",", SubscriptBox["b", "2"], ",", SubscriptBox["b", "3"]}], "}"}]}], "]"}]}]], "Input"], Cell["\<\ And, here is the standard visual way to do it by hand with the determinant.\ \>", "Text"], Cell[BoxData[ RowBox[{"detab", " ", "=", RowBox[{"Det", "[", RowBox[{"(", GridBox[{ {"i", "j", "k"}, { SubscriptBox["a", "1"], SubscriptBox["a", "2"], SubscriptBox["a", "3"]}, { SubscriptBox["b", "1"], SubscriptBox["b", "2"], SubscriptBox["b", "3"]} }, GridBoxDividers->{ "Columns" -> {{True}}, "ColumnsIndexed" -> {}, "Rows" -> {{True}}, "RowsIndexed" -> {}}], ")"}], "]"}]}]], "Input", CellTags->{ "mtag:11:cross_products_example", "mtag:11:vector_products_example"}], Cell["Pick out each of the compenents to create the vector", "Text"], Cell[BoxData[ RowBox[{"testcrossab", "=", RowBox[{"{", RowBox[{ RowBox[{"Coefficient", "[", RowBox[{"detab", ",", "i"}], "]"}], ",", " ", RowBox[{"Coefficient", "[", RowBox[{"detab", ",", "j"}], "]"}], ",", RowBox[{"Coefficient", "[", RowBox[{"detab", ",", "k"}], "]"}]}], "}"}]}]], "Input"], Cell["\<\ Check for equality between the old-fashioned way and Mathematica's built-in \ function\ \>", "Text"], Cell[BoxData[ RowBox[{"testcrossab", " ", "\[Equal]", " ", "crossab"}]], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Visualizing Space Curves as Time-Dependent Vectors", "Subtitle", CellChangeTimes->{{3.399024434597324*^9, 3.399024436684186*^9}}], Cell["Create a trajectory of a point or a particle", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"XVector", "[", "t_", "]"}], " ", ":=", " ", RowBox[{"{", RowBox[{ RowBox[{"Cos", "[", RowBox[{"6", " ", "t"}], "]"}], ",", RowBox[{"Sin", "[", RowBox[{"4", "t"}], " ", "]"}], ",", " ", RowBox[{ RowBox[{"Sin", "[", "t", "]"}], " ", "+", " ", RowBox[{"Cos", "[", "t", "]"}]}]}], "}"}]}]], "Input", CellChangeTimes->{{3.398938526577839*^9, 3.398938560066228*^9}, { 3.39893860356325*^9, 3.398938611978594*^9}, {3.398938645917617*^9, 3.398938646920697*^9}, {3.3989386833752193`*^9, 3.398938696356805*^9}, { 3.398939056140594*^9, 3.398939060906686*^9}, {3.398939725285697*^9, 3.398939732922943*^9}, {3.398939936966131*^9, 3.3989399413481092`*^9}, { 3.398940022491366*^9, 3.3989400509149427`*^9}, {3.3989420518572073`*^9, 3.398942067037017*^9}, 3.3990245188277073`*^9}], Cell["\<\ ParametricPlot3D allows us to visualize the entire trajectory at once.\ \>", "Text"], Cell[BoxData[ RowBox[{"ParametricPlot3D", "[", RowBox[{ RowBox[{"XVector", "[", "t", "]"}], ",", RowBox[{"{", RowBox[{"t", ",", "0", ",", RowBox[{"2", " ", "\[Pi]"}]}], "}"}], ",", RowBox[{"PlotStyle", "\[Rule]", " ", RowBox[{"{", RowBox[{"Thick", ",", " ", "Blue"}], "}"}]}], ",", RowBox[{"AxesLabel", "\[Rule]", RowBox[{"{", RowBox[{"\"\\"", ",", "\"\\"", ",", "\"\\""}], "}"}]}]}], "]"}]], "Input", CellChangeTimes->{{3.39893717374819*^9, 3.39893719654604*^9}, { 3.3989385112601967`*^9, 3.398938511822048*^9}, {3.398938583133102*^9, 3.3989385869504967`*^9}, {3.3989387840193453`*^9, 3.3989387893712187`*^9}, 3.398938837012837*^9, {3.398939738708152*^9, 3.398939739573153*^9}, { 3.398942071916224*^9, 3.3989420730769577`*^9}, 3.399024525798478*^9}, CellTags->"mtag:11:ParametricPlot3D[]"], Cell["\<\ Here is a function to create a graphic with a variable end - point. We will \ have the function remember when it has already computed a graphic, trading \ memory for a possible speed-up.\ \>", "Text", CellChangeTimes->{{3.399023448814796*^9, 3.399023463204712*^9}, { 3.399023612469404*^9, 3.399023648267984*^9}, 3.399023934869885*^9}], Cell[BoxData[ RowBox[{ RowBox[{"paraplot", "[", "time_", "]"}], " ", ":=", RowBox[{ RowBox[{"paraplot", "[", "time", "]"}], "=", " ", RowBox[{"ParametricPlot3D", "[", RowBox[{ RowBox[{"XVector", "[", "t", "]"}], ",", RowBox[{"{", RowBox[{"t", ",", "0", ",", "time"}], "}"}], ",", RowBox[{"PlotStyle", "\[Rule]", " ", RowBox[{"{", RowBox[{"Thick", ",", " ", "Blue"}], "}"}]}], ",", RowBox[{"AxesLabel", "\[Rule]", RowBox[{"{", RowBox[{"\"\\"", ",", "\"\\"", ",", "\"\\""}], "}"}]}]}], "]"}]}]}]], "Input", CellChangeTimes->{{3.398938840545042*^9, 3.3989388733472357`*^9}, { 3.398939782326624*^9, 3.3989397832791233`*^9}, {3.399023542335149*^9, 3.3990235508944902`*^9}, 3.399024531118664*^9}], Cell["\<\ Use manipulate on the graphics function to visualize how the curve develops \ with its parameter\ \>", "Text", CellChangeTimes->{{3.399023474591178*^9, 3.399023494366028*^9}}], Cell[BoxData[ RowBox[{"Manipulate", "[", RowBox[{ RowBox[{"paraplot", "[", "time", "]"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"time", ",", "0.05"}], "}"}], ",", "0.01", ",", RowBox[{"2", " ", "\[Pi]"}]}], "}"}]}], "]"}]], "Input", CellChangeTimes->{{3.398938797769754*^9, 3.3989388097382507`*^9}, { 3.398938891255632*^9, 3.3989389404344263`*^9}, {3.3989420892441273`*^9, 3.398942090485051*^9}}], Cell["\<\ However, we need to fix the length scale between frames, so we use the last \ graphic to infer what PlotRange should be.\ \>", "Text", CellChangeTimes->{{3.399023474591178*^9, 3.3990235157719812`*^9}, { 3.399023664019722*^9, 3.399023696531802*^9}}], Cell[BoxData[ RowBox[{"Manipulate", "[", RowBox[{ RowBox[{"Show", "[", RowBox[{ RowBox[{"paraplot", "[", "time", "]"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1.5"}], ",", "1.5"}], "}"}]}], "}"}]}]}], "]"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"time", ",", "0.05"}], "}"}], ",", "0.01", ",", RowBox[{"2", " ", "\[Pi]"}]}], "}"}]}], "]"}]], "Input", CellChangeTimes->{{3.398938797769754*^9, 3.3989388097382507`*^9}, { 3.398938891255632*^9, 3.3989389404344263`*^9}, {3.398938973660116*^9, 3.398939034267025*^9}, {3.398939111180785*^9, 3.398939115491376*^9}, { 3.3989421270537987`*^9, 3.39894212812386*^9}}], Cell["\<\ Next, we add a graphic element to show the vector, drawn from the origin, for \ each end-point.\ \>", "Text", CellChangeTimes->{{3.399023474591178*^9, 3.3990235157719812`*^9}, { 3.399023664019722*^9, 3.399023696531802*^9}, {3.399023750893639*^9, 3.39902379723598*^9}}], Cell[BoxData[ RowBox[{"Manipulate", "[", RowBox[{ RowBox[{"Show", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"paraplot", "[", "time", "]"}], ",", RowBox[{"Graphics3D", "[", RowBox[{"{", RowBox[{"Cylinder", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "0", ",", "0"}], "}"}], ",", RowBox[{"XVector", "[", "time", "]"}]}], "}"}], ",", "0.03"}], "]"}], "}"}], "]"}]}], "}"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1.5"}], ",", "1.5"}], "}"}]}], "}"}]}]}], "]"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"time", ",", "0.05"}], "}"}], ",", "0.01", ",", RowBox[{"2", " ", "\[Pi]"}]}], "}"}]}], "]"}]], "Input", CellChangeTimes->{{3.398939306789699*^9, 3.398939325854747*^9}, { 3.3989394133756037`*^9, 3.3989395670441*^9}, {3.39893960404208*^9, 3.398939681096155*^9}, {3.3989398230147953`*^9, 3.398939909144534*^9}, { 3.398942150815586*^9, 3.398942157040504*^9}, 3.399024539967445*^9}] }, Closed]], Cell[CellGroupData[{ Cell["Visualizing Local Tangent Vectors of Space Curves", "Subtitle", CellChangeTimes->{{3.3990244145352716`*^9, 3.399024430411911*^9}}], Cell[TextData[{ "Compute the local derivative of the vector that we visualized above: ", Cell[BoxData[ FormBox[ OverscriptBox["v", "\[RightVector]"], TraditionalForm]]], " = ", Cell[BoxData[ FormBox[ FractionBox[ RowBox[{"d", OverscriptBox["x", "\[RightVector]"]}], "dt"], TraditionalForm]]] }], "Text", CellChangeTimes->{{3.399024463680479*^9, 3.399024466851901*^9}, { 3.3990247223751574`*^9, 3.399024781710598*^9}}], Cell[BoxData[ RowBox[{"Simplify", "[", RowBox[{"D", "[", RowBox[{ RowBox[{"XVector", "[", "t", "]"}], ",", "t"}], "]"}], "]"}]], "Input", CellChangeTimes->{{3.3989401059583683`*^9, 3.3989401730186243`*^9}, { 3.398940222235014*^9, 3.3989402693468018`*^9}, {3.39894031310679*^9, 3.398940319246875*^9}, {3.399024545205615*^9, 3.399024552181038*^9}}], Cell["Write out a function for the derivative:", "Text", CellChangeTimes->{{3.399024814196199*^9, 3.3990248610522738`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"dxdt", "[", "s_", "]"}], " ", ":=", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"-", "6"}], " ", RowBox[{"Sin", "[", RowBox[{"6", " ", "s"}], "]"}]}], ",", RowBox[{"4", " ", RowBox[{"Cos", "[", RowBox[{"4", " ", "s"}], "]"}]}], ",", RowBox[{ RowBox[{"Cos", "[", "s", "]"}], "-", RowBox[{"Sin", "[", "s", "]"}]}]}], "}"}]}]], "Input", CellChangeTimes->{{3.39894032341877*^9, 3.398940336775806*^9}, { 3.39894070221378*^9, 3.3989407113669653`*^9}, 3.398940762620303*^9, { 3.398941067234968*^9, 3.398941093879298*^9}, 3.3989418799726667`*^9, { 3.398942176563261*^9, 3.398942187775881*^9}, 3.399024477883621*^9}], Cell["\<\ Plot it.... Note that it doesn't \"appear\" to be periodic, which would be \ wrong.\ \>", "Text", CellChangeTimes->{{3.399024814196199*^9, 3.399024967716174*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{"dxdtplot", "[", "time_", "]"}], " ", ":=", " ", RowBox[{"ParametricPlot3D", "[", RowBox[{ RowBox[{"dxdt", "[", "t", "]"}], ",", RowBox[{"{", RowBox[{"t", ",", "0", ",", "time"}], "}"}], ",", RowBox[{"PlotStyle", "\[Rule]", " ", RowBox[{"{", RowBox[{"Thick", ",", " ", RowBox[{"Darker", "[", "Red", "]"}]}], "}"}]}], ",", RowBox[{"AxesLabel", "\[Rule]", RowBox[{"{", RowBox[{"\"\\"", ",", "\"\\"", ",", "\"\\""}], "}"}]}]}], "]"}]}], "\[IndentingNewLine]", RowBox[{"dxdtplot", "[", RowBox[{"2", " ", "\[Pi]"}], "]"}]}], "Input", CellChangeTimes->{{3.3989407355815163`*^9, 3.3989407368191147`*^9}, { 3.398940804177651*^9, 3.398940808499555*^9}, {3.398941131685041*^9, 3.398941174196624*^9}, {3.398941228543888*^9, 3.398941245484045*^9}, { 3.3989422013981133`*^9, 3.398942202492248*^9}, {3.399024480206724*^9, 3.399024488398385*^9}}], Cell["\<\ The puzzle can be visualizing the time-development of both curves:\ \>", "Text", CellChangeTimes->{{3.399024814196199*^9, 3.399024967716174*^9}, { 3.399024999109838*^9, 3.399025033196002*^9}}], Cell[BoxData[ RowBox[{"Manipulate", "[", RowBox[{ RowBox[{"Show", "[", RowBox[{ RowBox[{"paraplot", "[", "time", "]"}], ",", RowBox[{"dxdtplot", "[", "time", "]"}], ",", "\[IndentingNewLine]", RowBox[{"Graphics3D", "[", RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Lighter", "[", "Blue", "]"}], ",", RowBox[{"Cylinder", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "0", ",", "0"}], "}"}], ",", RowBox[{"XVector", "[", "time", "]"}]}], "}"}], ",", "0.1"}], "]"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"Lighter", "[", "Red", "]"}], ",", RowBox[{"Cylinder", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "0", ",", "0"}], "}"}], ",", " ", RowBox[{"dxdt", "[", "time", "]"}]}], "}"}], ",", "0.1"}], "]"}]}], "}"}]}], "\[IndentingNewLine]", "}"}], "]"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "6"}], ",", "6"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "4"}], ",", "4"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1.5"}], ",", "1.5"}], "}"}]}], "}"}]}]}], "]"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"time", ",", "0.05"}], "}"}], ",", "0.01", ",", RowBox[{"2", " ", "\[Pi]"}]}], "}"}]}], "]"}]], "Input", CellChangeTimes->{{3.398939306789699*^9, 3.398939325854747*^9}, { 3.3989394133756037`*^9, 3.3989395670441*^9}, {3.39893960404208*^9, 3.398939681096155*^9}, {3.3989398230147953`*^9, 3.398939909144534*^9}, { 3.398941258759438*^9, 3.398941262566104*^9}, {3.398941313127961*^9, 3.3989414887341948`*^9}, {3.398941545445347*^9, 3.398941547783265*^9}, { 3.398941610493061*^9, 3.39894163991018*^9}, {3.398941731740634*^9, 3.3989417399362993`*^9}, {3.398941922929287*^9, 3.39894193984608*^9}, { 3.398942212135667*^9, 3.398942256168208*^9}, {3.398942288188596*^9, 3.398942318840629*^9}, {3.399024492680708*^9, 3.3990244960485086`*^9}, 3.399024565369018*^9}], Cell["\<\ To visualize the \"tangency property,\" we translate the derivative-vector \ to the end of the space curve\ \>", "Text", CellChangeTimes->{{3.399024814196199*^9, 3.399024967716174*^9}, { 3.399024999109838*^9, 3.399025033196002*^9}, {3.399025066397944*^9, 3.3990251212120667`*^9}}], Cell[BoxData[ RowBox[{"Manipulate", "[", RowBox[{ RowBox[{"Show", "[", RowBox[{ RowBox[{"paraplot", "[", "time", "]"}], ",", RowBox[{"dxdtplot", "[", "time", "]"}], ",", "\[IndentingNewLine]", RowBox[{"Graphics3D", "[", RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Lighter", "[", "Blue", "]"}], ",", RowBox[{"Cylinder", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "0", ",", "0"}], "}"}], ",", RowBox[{"XVector", "[", "time", "]"}]}], "}"}], ",", "0.1"}], "]"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"Lighter", "[", "Red", "]"}], ",", RowBox[{"Translate", "[", RowBox[{ RowBox[{"Cylinder", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "0", ",", "0"}], "}"}], ",", " ", RowBox[{"dxdt", "[", "time", "]"}]}], "}"}], ",", "0.1"}], "]"}], ",", RowBox[{"XVector", "[", "time", "]"}]}], "]"}]}], "}"}]}], "\[IndentingNewLine]", "}"}], "]"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "6"}], ",", "6"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "6"}], ",", "6"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "4"}], ",", "4"}], "}"}]}], "}"}]}]}], "]"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"time", ",", "0.05"}], "}"}], ",", "0.01", ",", RowBox[{"2", " ", "\[Pi]"}]}], "}"}]}], "]"}]], "Input", CellChangeTimes->{{3.398941766256557*^9, 3.398941775433474*^9}, { 3.398942336831798*^9, 3.398942378137519*^9}, {3.3989446322133827`*^9, 3.398944660358892*^9}, {3.3989447232905083`*^9, 3.3989447319355593`*^9}, { 3.398944771459235*^9, 3.398944791737803*^9}, {3.398944854144137*^9, 3.398944917078977*^9}, {3.398945089701251*^9, 3.39894510628962*^9}, { 3.39902450334474*^9, 3.399024507264677*^9}, {3.399024569961048*^9, 3.399024573264945*^9}}] }, Closed]], Cell[CellGroupData[{ Cell["\<\ The Time-Dependent Solution to the Diffusion Equation in the Plane \ Rectangular Initial Conditions\ \>", "Subtitle", CellChangeTimes->{{3.399025694207859*^9, 3.39902573841193*^9}, 3.399029965151432*^9}], Cell["\<\ This is the solution to the time-dependent diffusion equation in the infinite \ plane for iniital conditions c = 1 inside a rectangle (-a/2 < x < a/2 && -b/2 \ < y < b/2) and zero outside.\ \>", "Text", CellChangeTimes->{{3.398950745605343*^9, 3.3989508743796797`*^9}}], Cell[BoxData[ RowBox[{"concentration", " ", "=", RowBox[{"Integrate", "[", RowBox[{ FractionBox[ RowBox[{"Exp", "[", FractionBox[ RowBox[{"-", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"xsource", "-", "x"}], ")"}], "^", "2"}], " ", "+", " ", RowBox[{ RowBox[{"(", RowBox[{"ysource", "-", "y"}], ")"}], "^", "2"}]}], ")"}]}], RowBox[{"4", "Diffusivity", " ", "t"}]], "]"}], RowBox[{"4", " ", "Pi", " ", "Diffusivity", " ", "t"}]], ",", " ", RowBox[{"{", RowBox[{"xsource", ",", RowBox[{ RowBox[{"-", "a"}], "/", "2"}], ",", RowBox[{"a", "/", "2"}]}], "}"}], ",", RowBox[{"{", RowBox[{"ysource", ",", RowBox[{ RowBox[{"-", "b"}], "/", "2"}], ",", RowBox[{"b", "/", "2"}]}], "}"}], ",", RowBox[{"Assumptions", "\[Rule]", RowBox[{ RowBox[{"Diffusivity", ">", "0"}], "&&", RowBox[{"t", ">", "0"}], " ", "&&", " ", RowBox[{"a", ">", "0"}], " ", "&&", " ", RowBox[{"b", ">", " ", "0"}], " ", "&&", " ", RowBox[{"x", " ", "\[Element]", " ", "Reals"}], " ", "&&", " ", RowBox[{"y", " ", "\[Element]", " ", "Reals"}]}]}]}], "]"}]}]], "Input",\ CellChangeTimes->{{3.3989485663262167`*^9, 3.398948587692474*^9}, 3.39895073016965*^9}, CellTags-> "mtag:11:diffusion_equation_solution__example__2D_point_source_at_origin"], Cell[TextData[{ "Introduce a fixed model parameter and", StyleBox[" non-dimensional variables:", FontWeight->"Bold"] }], "Text", CellChangeTimes->{{3.398950887609941*^9, 3.398950913482429*^9}, { 3.3990292549831*^9, 3.399029264484557*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"aspectRatio", "=", "3"}], ";"}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"b", " ", "=", " ", RowBox[{"aspectRatio", " ", "a"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"length", " ", "=", " ", "a"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"time", " ", "=", " ", RowBox[{ RowBox[{"length", "^", "2"}], "/", "Diffusivity"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ScaleRules", "=", " ", RowBox[{"{", RowBox[{ RowBox[{"t", " ", "->", " ", RowBox[{"\[Tau]", " ", "time"}]}], ",", RowBox[{"x", " ", "->", " ", RowBox[{"\[Xi]", " ", "length"}]}], ",", RowBox[{"y", " ", "->", " ", RowBox[{"\[Eta]", " ", "length"}]}]}], "}"}]}], ";"}]}], "Input", CellChangeTimes->{{3.39895088330954*^9, 3.3989508847229433`*^9}, { 3.3989509287230873`*^9, 3.398950981451663*^9}, {3.39895102471551*^9, 3.398951268716894*^9}, {3.398963850177671*^9, 3.398963898862855*^9}, { 3.398963941220104*^9, 3.398963962351323*^9}, {3.399029281463336*^9, 3.399029291232435*^9}, {3.399029333927183*^9, 3.399029341254506*^9}, { 3.399029438888629*^9, 3.399029439390892*^9}}], Cell[BoxData[ RowBox[{"scaledconc", " ", "=", RowBox[{"Simplify", "[", RowBox[{ RowBox[{"concentration", "/.", "ScaleRules"}], ",", RowBox[{"Assumptions", "\[Rule]", RowBox[{"a", ">", "0"}]}]}], "]"}]}]], "Input", CellChangeTimes->{{3.398951396781345*^9, 3.398951402187666*^9}, { 3.39896058623066*^9, 3.3989605909403267`*^9}, {3.3989606545202093`*^9, 3.398960687948903*^9}, 3.39896397644069*^9}], Cell[BoxData[ RowBox[{"Plot3D", "[", RowBox[{ RowBox[{"scaledconc", "/.", RowBox[{"\[Tau]", "\[Rule]", "0.003"}]}], ",", RowBox[{"{", RowBox[{"\[Xi]", ",", RowBox[{"-", "3"}], ",", "3"}], "}"}], ",", RowBox[{"{", RowBox[{"\[Eta]", ",", RowBox[{"-", "3"}], ",", "3"}], "}"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{"0", ",", "1"}], "}"}]}], ",", RowBox[{"MeshFunctions", "\[Rule]", " ", RowBox[{"{", RowBox[{"#3", "&"}], "}"}]}], ",", RowBox[{"PlotPoints", "\[Rule]", "30"}], ",", RowBox[{"Mesh", "\[Rule]", "5"}], ",", RowBox[{"MeshStyle", "\[Rule]", RowBox[{"{", "Thick", "}"}]}]}], "]"}]], "Input", CellChangeTimes->{{3.398951602630186*^9, 3.398951613212438*^9}, { 3.398952636650877*^9, 3.398952638148683*^9}, {3.3989526736936007`*^9, 3.398952694855546*^9}, {3.3989527677997417`*^9, 3.398952805965127*^9}, { 3.3989533289432364`*^9, 3.398953465590302*^9}, {3.3989535097813396`*^9, 3.398953510462091*^9}, {3.398953550016724*^9, 3.39895370855097*^9}, { 3.3989537911607037`*^9, 3.398953836438465*^9}, {3.398953892297365*^9, 3.3989539567574263`*^9}}], Cell["\<\ Visualize the solution by plotting the concentration as function of x and y, \ and animate as function of time.\ \>", "Text"], Cell[BoxData[ RowBox[{"Manipulate", "[", RowBox[{ RowBox[{"Plot3D", "[", RowBox[{ RowBox[{"scaledconc", "/.", RowBox[{"\[Tau]", "\[Rule]", "timevar"}]}], ",", RowBox[{"{", RowBox[{"\[Xi]", ",", RowBox[{"-", "3"}], ",", "3"}], "}"}], ",", RowBox[{"{", RowBox[{"\[Eta]", ",", RowBox[{"-", "3"}], ",", "3"}], "}"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{"0", ",", "1"}], "}"}]}], ",", RowBox[{"MaxRecursion", "\[Rule]", "4"}]}], "]"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"timevar", ",", "0.05"}], "}"}], ",", "0.001", ",", "0.1"}], "}"}]}], "]"}]], "Input", CellChangeTimes->{{3.3989539880038233`*^9, 3.398954023989163*^9}, { 3.3989540710123262`*^9, 3.3989541001266193`*^9}, {3.398954217910687*^9, 3.3989542186621027`*^9}, {3.3989542726935577`*^9, 3.3989543721664658`*^9}, {3.398958399268092*^9, 3.398958401094524*^9}, { 3.398958717264575*^9, 3.3989587406068373`*^9}, {3.398958779158977*^9, 3.398958787046905*^9}, {3.3989588284057083`*^9, 3.398958843960526*^9}, { 3.398958974929153*^9, 3.398958997145321*^9}, 3.398959060813199*^9, { 3.398959139971465*^9, 3.398959143139144*^9}, {3.398959247663522*^9, 3.398959251358405*^9}, {3.39895929236462*^9, 3.398959303885988*^9}}], Cell["\<\ Another visualization scheme: plot the isoconcentration lines as function of \ x and y, and animate as function of time. This is like the temporal \ evolution of a topographical map.\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"cplots", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"ContourPlot", "[", RowBox[{ RowBox[{"scaledconc", "/.", RowBox[{"\[Tau]", "\[Rule]", "timevar"}]}], ",", RowBox[{"{", RowBox[{"\[Xi]", ",", RowBox[{"-", "3"}], ",", "3"}], "}"}], ",", RowBox[{"{", RowBox[{"\[Eta]", ",", RowBox[{"-", "3"}], ",", "3"}], "}"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{"0", ",", "1"}], "}"}]}], ",", RowBox[{"ColorFunction", "\[Rule]", RowBox[{"ColorData", "[", "\"\\"", "]"}]}]}], "]"}], ",", RowBox[{"{", RowBox[{"timevar", ",", ".001", ",", ".2", ",", ".005"}], "}"}]}], "]"}]}], ";"}]], "Input", CellChangeTimes->{{3.398959377541149*^9, 3.3989594152804747`*^9}, { 3.3989594815797358`*^9, 3.3989595413669233`*^9}, {3.398959576266972*^9, 3.398959582704507*^9}, {3.3989597318674*^9, 3.398959747086755*^9}, { 3.398959798374002*^9, 3.398959805657627*^9}, {3.398959874031477*^9, 3.398959893135055*^9}}, CellTags->"mtag:11:MovieContourPlot[]"], Cell[BoxData[ RowBox[{"ListAnimate", "[", "cplots", "]"}]], "Input", CellChangeTimes->{{3.398959834493649*^9, 3.3989598497484293`*^9}}] }, Closed]], Cell[CellGroupData[{ Cell["\<\ Visualizing Diffusional Flux: The Time-Dependent Gradient Field\ \>", "Subtitle", CellChangeTimes->{{3.399025694207859*^9, 3.39902573841193*^9}, { 3.399029965151432*^9, 3.399030004660471*^9}}], Cell["\<\ Flux is a vector that points in the direction of the flow and is a measure \ of how much is flowing per unit time. This is Fick's first law.\ \>", "Text"], Cell[BoxData[ RowBox[{"flux", " ", "=", " ", RowBox[{"{", RowBox[{ RowBox[{"-", RowBox[{"D", "[", RowBox[{"scaledconc", ",", "\[Xi]"}], "]"}]}], ",", RowBox[{"-", RowBox[{"D", "[", RowBox[{"scaledconc", ",", "\[Eta]"}], "]"}]}]}], "}"}]}]], "Input", CellChangeTimes->{{3.3989601797574863`*^9, 3.398960196406342*^9}}], Cell["\<\ An example of the vector field as a function of position at time = 0.8\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"Needs", "[", "\"\\"", "]"}], ";"}]], "Input"], Cell[BoxData[ RowBox[{"VectorFieldPlot", "[", RowBox[{ RowBox[{"flux", "/.", RowBox[{"\[Tau]", "\[Rule]", ".08"}]}], ",", RowBox[{"{", RowBox[{"\[Xi]", ",", RowBox[{"-", "3"}], ",", "3"}], "}"}], ",", RowBox[{"{", RowBox[{"\[Eta]", ",", RowBox[{"-", "3"}], ",", "3"}], "}"}], ",", RowBox[{"PlotPoints", "\[Rule]", " ", "21"}], ",", RowBox[{"ColorFunction", "\[Rule]", RowBox[{"ColorData", "[", "\"\\"", "]"}]}]}], "]"}]], "Input", CellChangeTimes->{{3.3989604591340857`*^9, 3.398960467190497*^9}, { 3.398960821435555*^9, 3.3989608790842133`*^9}, {3.398960956253017*^9, 3.398961131383685*^9}, 3.398961180130953*^9, {3.398962402169969*^9, 3.398962444606248*^9}, {3.398963604905404*^9, 3.3989636236906347`*^9}, { 3.398964116950137*^9, 3.3989641179606533`*^9}, {3.3989641966440763`*^9, 3.3989642017952414`*^9}}, CellTags->{ "mtag:11:PlotVectorField[]", "mtag:11:ScaleFunction__in_PlotVectorField[]"}],\ Cell["\<\ An example of the vector field as a function of position at time = 0.2, but \ with more control over the appearance of the arrows.\ \>", "Text"], Cell[BoxData[{ RowBox[{ RowBox[{"Needs", "[", "\"\\"", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"vplots", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"VectorFieldPlot", "[", RowBox[{ RowBox[{"flux", "/.", RowBox[{"\[Tau]", "\[Rule]", "time"}]}], ",", RowBox[{"{", RowBox[{"\[Xi]", ",", RowBox[{"-", "3"}], ",", "3"}], "}"}], ",", RowBox[{"{", RowBox[{"\[Eta]", ",", RowBox[{"-", "3"}], ",", "3"}], "}"}], ",", RowBox[{"PlotPoints", "\[Rule]", "21"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "4"}], ",", "4"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "4"}], ",", "4"}], "}"}]}], "}"}]}], ",", RowBox[{"Frame", "\[Rule]", "True"}], ",", RowBox[{"MaxArrowLength", "\[Rule]", "3"}], ",", RowBox[{"ScaleFactor", "\[Rule]", " ", "None"}], ",", RowBox[{"ScaleFunction", "\[Rule]", RowBox[{"(", RowBox[{ RowBox[{"2", "#"}], "&"}], ")"}]}], ",", RowBox[{"ColorFunction", "\[Rule]", " ", RowBox[{"(", RowBox[{ RowBox[{"Hue", "[", RowBox[{"0.25", "+", RowBox[{"0.75", " ", "#"}]}], "]"}], "&"}], ")"}]}]}], "]"}], ",", RowBox[{"{", RowBox[{"time", ",", ".001", ",", ".2", ",", ".005"}], "}"}]}], "]"}]}], ";"}]}], "Input", CellChangeTimes->{{3.398961241515101*^9, 3.398961279316272*^9}, { 3.398962450402603*^9, 3.398962512812149*^9}, {3.398962555282633*^9, 3.398962597366146*^9}, {3.39896431790268*^9, 3.398964331789098*^9}}], Cell[BoxData[ RowBox[{"ListAnimate", "[", "vplots", "]"}]], "Input", CellChangeTimes->{3.3989626301505404`*^9}], Cell[BoxData[ RowBox[{"ListAnimate", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{"Show", "[", RowBox[{ RowBox[{"cplots", "[", RowBox[{"[", "i", "]"}], "]"}], ",", RowBox[{"vplots", "[", RowBox[{"[", "i", "]"}], "]"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"3.5", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "1"}], "}"}]}], "}"}]}]}]}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", "cplots", "]"}]}], "}"}]}], "]"}], "]"}]], "Input", CellChangeTimes->{{3.398963167545763*^9, 3.3989632004056*^9}, { 3.398963263415305*^9, 3.398963349921794*^9}}] }, Closed]] }, WindowToolbars->{}, CellGrouping->Manual, WindowSize->{1167, 883}, WindowMargins->{{91, Automatic}, {Automatic, 94}}, WindowTitle->"Lecture 11 MIT 3.016 (Fall 2007) \[Copyright] W. Craig Carter \ 2003-2007", PrintingCopies->1, PrintingPageRange->{1, Automatic}, ShowCellLabel->False, CellLabelAutoDelete->True, Magnification->1, FrontEndVersion->"6.0 for Mac OS X x86 (32-bit) (June 19, 2007)", StyleDefinitions->"3016-Carter.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{ "mtag:11:cross_products_example"->{ Cell[1276, 48, 568, 18, 131, "Input", CellTags->{ "mtag:11:cross_products_example", "mtag:11:vector_products_example"}]}, "mtag:11:vector_products_example"->{ Cell[1276, 48, 568, 18, 131, "Input", CellTags->{ "mtag:11:cross_products_example", "mtag:11:vector_products_example"}]}, "mtag:11:ParametricPlot3D[]"->{ Cell[3650, 121, 873, 19, 85, "Input", CellTags->"mtag:11:ParametricPlot3D[]"]}, "mtag:11:diffusion_equation_solution__example__2D_point_source_at_origin"->{ Cell[17991, 511, 1475, 40, 98, "Input", CellTags-> "mtag:11:diffusion_equation_solution__example__2D_point_source_at_origin"]\ }, "mtag:11:MovieContourPlot[]"->{ Cell[24251, 676, 1170, 29, 53, "Input", CellTags->"mtag:11:MovieContourPlot[]"]}, "mtag:11:PlotVectorField[]"->{ Cell[26537, 745, 990, 22, 37, "Input", CellTags->{ "mtag:11:PlotVectorField[]", "mtag:11:ScaleFunction__in_PlotVectorField[]"}]}, "mtag:11:ScaleFunction__in_PlotVectorField[]"->{ Cell[26537, 745, 990, 22, 37, "Input", CellTags->{ "mtag:11:PlotVectorField[]", "mtag:11:ScaleFunction__in_PlotVectorField[]"}]} } *) (*CellTagsIndex CellTagsIndex->{ {"mtag:11:cross_products_example", 31016, 876}, {"mtag:11:vector_products_example", 31185, 880}, {"mtag:11:ParametricPlot3D[]", 31349, 884}, {"mtag:11:diffusion_equation_solution__example__2D_point_source_at_origin", \ 31512, 887}, {"mtag:11:MovieContourPlot[]", 31684, 892}, {"mtag:11:PlotVectorField[]", 31803, 895}, {"mtag:11:ScaleFunction__in_PlotVectorField[]", 31998, 900} } *) (*NotebookFileOutline Notebook[{ Cell[568, 21, 68, 0, 64, "Title"], Cell[CellGroupData[{ Cell[661, 25, 34, 0, 70, "Subtitle"], Cell[698, 27, 70, 0, 34, "Text"], Cell[771, 29, 400, 13, 54, "Input"], Cell[1174, 44, 99, 2, 34, "Text"], Cell[1276, 48, 568, 18, 131, "Input", CellTags->{ "mtag:11:cross_products_example", "mtag:11:vector_products_example"}], Cell[1847, 68, 68, 0, 34, "Text"], Cell[1918, 70, 331, 9, 85, "Input"], Cell[2252, 81, 110, 3, 34, "Text"], Cell[2365, 86, 82, 1, 54, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[2484, 92, 136, 1, 56, "Subtitle"], Cell[2623, 95, 60, 0, 34, "Text"], Cell[2686, 97, 864, 18, 54, "Input"], Cell[3553, 117, 94, 2, 34, "Text"], Cell[3650, 121, 873, 19, 85, "Input", CellTags->"mtag:11:ParametricPlot3D[]"], Cell[4526, 142, 348, 6, 57, "Text"], Cell[4877, 150, 793, 19, 115, "Input"], Cell[5673, 171, 186, 4, 34, "Text"], Cell[5862, 177, 446, 11, 54, "Input"], Cell[6311, 190, 261, 5, 34, "Text"], Cell[6575, 197, 967, 27, 85, "Input"], Cell[7545, 226, 284, 6, 34, "Text"], Cell[7832, 234, 1393, 39, 145, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[9262, 278, 137, 1, 56, "Subtitle"], Cell[9402, 281, 444, 13, 48, "Text"], Cell[9849, 296, 364, 7, 54, "Input"], Cell[10216, 305, 124, 1, 34, "Text"], Cell[10343, 308, 710, 18, 54, "Input"], Cell[11056, 328, 173, 4, 34, "Text"], Cell[11232, 334, 964, 22, 115, "Input"], Cell[12199, 358, 205, 4, 34, "Text"], Cell[12407, 364, 2413, 59, 205, "Input"], Cell[14823, 425, 297, 6, 34, "Text"], Cell[15123, 433, 2327, 59, 205, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[17487, 497, 218, 5, 93, "Subtitle"], Cell[17708, 504, 280, 5, 26, "Text"], Cell[17991, 511, 1475, 40, 98, "Input", CellTags-> "mtag:11:diffusion_equation_solution__example__2D_point_source_at_origin"], Cell[19469, 553, 245, 6, 26, "Text"], Cell[19717, 561, 1227, 30, 113, "Input"], Cell[20947, 593, 426, 9, 37, "Input"], Cell[21376, 604, 1171, 27, 53, "Input"], Cell[22550, 633, 137, 3, 26, "Text"], Cell[22690, 638, 1347, 30, 37, "Input"], Cell[24040, 670, 208, 4, 26, "Text"], Cell[24251, 676, 1170, 29, 53, "Input", CellTags->"mtag:11:MovieContourPlot[]"], Cell[25424, 707, 137, 2, 37, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[25598, 714, 205, 4, 93, "Subtitle"], Cell[25806, 720, 165, 3, 26, "Text"], Cell[25974, 725, 360, 10, 37, "Input"], Cell[26337, 737, 94, 2, 26, "Text"], Cell[26434, 741, 100, 2, 37, "Input"], Cell[26537, 745, 990, 22, 37, "Input", CellTags->{ "mtag:11:PlotVectorField[]", "mtag:11:ScaleFunction__in_PlotVectorField[]"}], Cell[27532, 770, 154, 3, 26, "Text"], Cell[27689, 775, 1774, 47, 68, "Input"], Cell[29466, 824, 113, 2, 37, "Input"], Cell[29582, 828, 850, 26, 37, "Input"] }, Closed]] } ] *) (* End of internal cache information *)