(*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 3.0, MathReader 3.0, or any compatible application. The data for the notebook starts with the line of 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[ 8118, 249]*) (*NotebookOutlinePosition[ 8920, 277]*) (* CellTagsIndexPosition[ 8876, 273]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell[TextData[{ "Euler's Equations with ", StyleBox["Mathematica", FontSlant->"Italic"], ":\nNumerical Solutions" }], "Title", TextAlignment->Center, TextJustification->0, FontSize->18], Cell[TextData[{ "In this notebook we'll show an examples of how to use ", StyleBox["Mathematica", FontSlant->"Italic"], " to analyze the book flipping problems by solving Euler's differential \ equations numerically. \n\n", StyleBox["Mathematica", FontSlant->"Italic"], "'s function to solve differential equations numerically is NDSolve. More \ detail can be found using the Help Browser under NDSolve (including more \ examples)." }], "Text"], Cell[CellGroupData[{ Cell["Clear symbols", "Section", Evaluatable->False, AspectRatioFixed->True], Cell["\<\ In order to avoid interference from symbols defined in other \ notebooks, we first Remove all symbols. We assume that the relevant symbols \ are in the Global` context.\ \>", "Text", Evaluatable->False, AspectRatioFixed->True], Cell["Remove[\"Global`*\"]", "Input", AspectRatioFixed->True] }, Open ]], Cell[CellGroupData[{ Cell["Book Flipping", "Section", FontSize->14], Cell[TextData[ "First we give names (de1,2,3) to the differential equations. We use the \ notation \[Omega]'[t] to indicate d\[Omega]/dt. Note that we use = in \ defining the name but == in the actual equation. We have to specify any \ constants for a numerical solution (unlike using DSolve)."], "Text"], Cell[BoxData[ \(de1\ = \ \ I1\ \ \(\[Omega]1'\)[t]\ + \ \((I3 - I2)\)\ \[Omega]2[t]\ \[Omega]3[t]\ == 0\)], "Input"], Cell[BoxData[ \(de2\ = \ \ I2\ \ \(\[Omega]2'\)[t]\ + \ \((I1 - I3)\)\ \[Omega]1[t]\ \[Omega]3[t]\ == 0\)], "Input"], Cell[BoxData[ \(de3\ = \ \ I3\ \ \(\[Omega]3'\)[t]\ + \ \((I2 - I1)\)\ \[Omega]1[t]\ \[Omega]2[t]\ == 0\)], "Input"], Cell["Next we specify values for I1, I2, and I3.", "Text"], Cell[BoxData[ \(I1\ = \ 1\)], "Input"], Cell[BoxData[ \(I2\ = \ 2\)], "Input"], Cell[BoxData[ \(I3\ = \ 3\)], "Input"], Cell["\<\ The command to solve the equation numerically is called \"NDSolve\" \ (note the capital letters!). Here we solve the differential equations with \ intial conditions. We also have to specify the range in t for which a \ solution is desired; here we ask for 0 < t < 10.\ \>", "Text"], Cell[BoxData[ \(solution\ = \ \ NDSolve[\ {de1, \ de2, \ de3, \n \t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \[Omega]1[0] == 1, \ \[Omega]2[0] == .05, \ \[Omega]3[0] == .05}, \n \t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {\[Omega]1, \[Omega]2, \[Omega]3}, \n \t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {t, 0, 10}]\)], "Input"], Cell[TextData[{ "The solution for \[Omega][t] is in the double set of {}'s in the form of \ an \"interpolating function\". This is a way of representing the numerical \ solution. \n\nWe can evaluate \[Omega]1[t] at a particular x using ", StyleBox["Mathematica", FontSlant->"Italic"], "'s substitution function, /. :" }], "Text"], Cell[BoxData[ \(\[Omega]1[0]\ /. \ solution\)], "Input"], Cell[BoxData[ \(\[Omega]1[3]\ /. \ solution\)], "Input"], Cell["\<\ We can plot the result if we use the Evaluate function:\ \>", "Text"], Cell[BoxData[ \(Plot[Evaluate[\ \[Omega]1[t]\ /. \ solution], \ {t, 0, 10}, \n \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ PlotRange -> {0, 1.1}]\)], "Input"], Cell[BoxData[ \(Plot[Evaluate[\ \[Omega]2[t]\ /. \ solution], \ {t, 0, 10}, \n \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ PlotRange -> {\(- .5\), .5}]\)], "Input"], Cell[BoxData[ \(Plot[Evaluate[\ \[Omega]3[t]\ /. \ solution], \ {t, 0, 10}, \n \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ PlotRange -> {\(- .5\), .5}]\)], "Input"], Cell[BoxData[ \(Plot[{Evaluate[\ \[Omega]1[t]\ /. \ solution], \n\t\t\ \ \ \ \ \ \ \ \ Evaluate[\ \[Omega]2[t]\ /. \ solution], \n\t\t\ \ \ \ \ \ \ \ \ Evaluate[\ \[Omega]3[t]\ /. \ solution]}, \ {t, 0, 10}, \n \t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ PlotRange -> {\(-0.5\), 1.1}]\)], "Input"], Cell["Next we specify new values for I1, I2, and I3.", "Text"], Cell[BoxData[ \(I1\ = \ 2\)], "Input"], Cell[BoxData[ \(I2\ = \ 1\)], "Input"], Cell[BoxData[ \(I3\ = \ 3\)], "Input"], Cell["\<\ The command to solve the equation numerically is called \"NDSolve\" \ (note the capital letters!). Here we solve the differential equations with \ intial conditions. We also have to specify the range in t for which a \ solution is desired; here we ask for 0 < t < 10.\ \>", "Text"], Cell[BoxData[ \(solution\ = \ \ NDSolve[\ {de1, \ de2, \ de3, \n \t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \[Omega]1[0] == 1, \ \[Omega]2[0] == .05, \ \[Omega]3[0] == .05}, \n \t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {\[Omega]1, \[Omega]2, \[Omega]3}, \n \t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {t, 0, 10}]\)], "Input"], Cell[TextData[{ "The solution for \[Omega][t] is in the double set of {}'s in the form of \ an \"interpolating function\". This is a way of representing the numerical \ solution. \n\nWe can evaluate \[Omega]1[t] at a particular x using ", StyleBox["Mathematica", FontSlant->"Italic"], "'s substitution function, /. :" }], "Text"], Cell[BoxData[ \(\[Omega]1[0]\ /. \ solution\)], "Input"], Cell[BoxData[ \(\[Omega]1[3]\ /. \ solution\)], "Input"], Cell["\<\ We can plot the result if we use the Evaluate function:\ \>", "Text"], Cell[BoxData[ \(Plot[Evaluate[\ \[Omega]1[t]\ /. \ solution], \ {t, 0, 10}, \n \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ PlotRange -> {0, 1.1}]\)], "Input"], Cell[BoxData[ \(Plot[Evaluate[\ \[Omega]2[t]\ /. \ solution], \ {t, 0, 10}, \n \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ PlotRange -> {0, 1}]\)], "Input"], Cell[BoxData[ \(Plot[Evaluate[\ \[Omega]3[t]\ /. \ solution], \ {t, 0, 10}, \n \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ PlotRange -> {0, 1}]\)], "Input"] }, Open ]] }, Open ]] }, FrontEndVersion->"X 3.0", ScreenRectangle->{{0, 1024}, {0, 768}}, WindowToolbars->"EditBar", WindowSize->{534, 534}, WindowMargins->{{150, Automatic}, {Automatic, 74}}, PrintingPageRange->{Automatic, Automatic}, PrintingOptions->{"PaperSize"->{612, 792}, "PaperOrientation"->"Portrait", "Magnification"->1} ] (*********************************************************************** 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[CellGroupData[{ Cell[1731, 51, 201, 8, 108, "Title"], Cell[1935, 61, 465, 11, 104, "Text"], Cell[CellGroupData[{ Cell[2425, 76, 80, 2, 52, "Section", Evaluatable->False], Cell[2508, 80, 241, 6, 50, "Text", Evaluatable->False], Cell[2752, 88, 63, 1, 27, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[2852, 94, 48, 1, 50, "Section"], Cell[2903, 97, 307, 4, 68, "Text"], Cell[3213, 103, 141, 3, 27, "Input"], Cell[3357, 108, 141, 3, 27, "Input"], Cell[3501, 113, 141, 3, 27, "Input"], Cell[3645, 118, 58, 0, 32, "Text"], Cell[3706, 120, 43, 1, 27, "Input"], Cell[3752, 123, 43, 1, 27, "Input"], Cell[3798, 126, 43, 1, 27, "Input"], Cell[3844, 129, 293, 5, 68, "Text"], Cell[4140, 136, 527, 9, 75, "Input"], Cell[4670, 147, 342, 7, 86, "Text"], Cell[5015, 156, 61, 1, 27, "Input"], Cell[5079, 159, 61, 1, 27, "Input"], Cell[5143, 162, 80, 3, 50, "Text"], Cell[5226, 167, 155, 2, 43, "Input"], Cell[5384, 171, 162, 2, 43, "Input"], Cell[5549, 175, 162, 2, 43, "Input"], Cell[5714, 179, 321, 5, 75, "Input"], Cell[6038, 186, 62, 0, 32, "Text"], Cell[6103, 188, 43, 1, 27, "Input"], Cell[6149, 191, 43, 1, 27, "Input"], Cell[6195, 194, 43, 1, 27, "Input"], Cell[6241, 197, 293, 5, 68, "Text"], Cell[6537, 204, 527, 9, 75, "Input"], Cell[7067, 215, 342, 7, 86, "Text"], Cell[7412, 224, 61, 1, 27, "Input"], Cell[7476, 227, 61, 1, 27, "Input"], Cell[7540, 230, 80, 3, 50, "Text"], Cell[7623, 235, 155, 2, 43, "Input"], Cell[7781, 239, 153, 2, 43, "Input"], Cell[7937, 243, 153, 2, 43, "Input"] }, Open ]] }, Open ]] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)