(************** Content-type: application/mathematica ************** 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[ 11471, 306]*) (*NotebookOutlinePosition[ 12178, 330]*) (* CellTagsIndexPosition[ 12134, 326]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell["Homogeneous Systems of Ordinary Differential Equations", "Subtitle"], Cell[CellGroupData[{ Cell["Linear Systems", "Section"], Cell[CellGroupData[{ Cell["Example 1 - Solving from the Eigensystem", "Subsection"], Cell["\<\ Suppose that you have the system of equations x'(t) = -y(t) and y'(t) = \ -x(t). If you first find the eigensystem of the coefficient matrix, you can \ write the general solution from it.\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"Eigensystem", "[", RowBox[{"(", "\[NegativeThinSpace]", GridBox[{ {"0", \(-1\)}, {\(-1\), "0"} }], "\[NegativeThinSpace]", ")"}], "]"}], "//", "MatrixForm"}]], "Input"], Cell["\<\ The following set of commands will detemine the solution for various values \ of the arbitrary constants and then plot those solutions as in a phase \ diagram (parametric plot).\ \>", "Text"], Cell[BoxData[{ \(Off[General::spell]\ \), "\[IndentingNewLine]", \(Off[General::spell1]\), "\[IndentingNewLine]", \(\(x[t_] = c1\ Exp[\(-t\)] + c2\ Exp[t];\)\), "\[IndentingNewLine]", \(y[t_] = c1\ Exp[\(-t\)] - c2\ Exp[t]; fncarray = Table[{x[t], y[t]} /. {c1 \[Rule] i, c2 \[Rule] j}, {i, \(-6\), 6, 2}, {j, \(-6\), 6, 2}]; tograph = Flatten[fncarray, 1];\), "\[IndentingNewLine]", \(Short[tograph, 2]\), "\[IndentingNewLine]", \(\(graphone = ParametricPlot[Evaluate[tograph], {t, \(-2\), 2}, PlotRange \[Rule] {{\(-15\), 15}, {\(-15\), 15}}];\)\)}], "Input"], Cell["\<\ We can also look at a vector field plot of the functions, by plotting arrows \ at points where the arrows are specified by the x' (horizontal component) and \ y' (vertical component)values. These will therefore be in the dy/dx \ directions. You must begin by reading in the following graphics package.\ \>", "Text"], Cell[BoxData[ \(<< Graphics`PlotField`\)], "Input"], Cell[BoxData[ \(graphtwo = PlotVectorField[{\(-y\), \(-x\)}, {x, \(-15\), 15}, {y, \(-15\), 15}, ScaleFunction \[Rule] \((1 &)\), DisplayFunction \[Rule] Identity]; Show[graphone, graphtwo, PlotRange \[Rule] {{\(-15\), 15}, {\(-15\), 15}}, AspectRatio \[Rule] 1];\)], "Input"], Cell["\<\ Note how the arrows line up with the solution curves. What is happening to the solutions as t -> \[Infinity] ? How does it depend \ on your starting point?\ \>", "Text"] }, Closed]], Cell[CellGroupData[{ Cell["Example 2 - Solving Using DSolve", "Subsection"], Cell["\<\ Here is one where the eigenvalues are complex. This solution would take a \ little work on your part to write, based on the eigensystem. We will do this \ in class to verify the results. For this one, we will plot the solutions and \ vector fields together. The system of equations looks very much like the one \ above, but the solutions are quite different (as can be seen from the \ eigensystem): x'(t) = y(t) and y'(t) = -x(t).\ \>", "Text"], Cell[BoxData[{ \(MatrixForm[mat = {{0, 1}, {\(-1\), 0}}]\), "\n", \(Eigensystem[mat] // MatrixForm\)}], "Input"], Cell["\<\ We will let Mathematica solve this system of equations for now.\ \>", "Text"], Cell[BoxData[{ \(Clear[x, y, t]\), "\n", \(solution = DSolve[Thread[{\(x'\)[t], \(y'\)[t]} \[Equal] mat . {x[t], y[t]}], {x[ t], y[t]}, t]\), "\[IndentingNewLine]", \(solx := solution[\([1, 1, 2]\)]\), "\n", \(soly := solution[\([1, 2, 2]\)]\)}], "Input"], Cell["\<\ Now we will assign different values to the arbitrary constants.\ \>", "Text"], Cell[BoxData[{ \(fncarray = Table[{solx, soly} /. {C[1] \[Rule] i, C[2] \[Rule] j}, {i, \(-6\), 6, 2}, {j, \(-6\), 6, 2}]; tograph = Flatten[fncarray, 1]; Short[tograph, 2];\), "\[IndentingNewLine]", \(\(graphthree = ParametricPlot[Evaluate[tograph], {t, \(-1\), 1}, PlotRange \[Rule] {{\(-10\), 10}, {\(-10\), 10}}, AspectRatio \[Rule] 1, DisplayFunction \[Rule] Identity];\)\), "\[IndentingNewLine]", \(\(graphdf = PlotVectorField[{y, \(-x\)}, {x, \(-10\), 10}, {y, \(-10\), 10}, DisplayFunction \[Rule] Identity];\)\), "\[IndentingNewLine]", \(\(Show[graphthree, graphdf, DisplayFunction \[Rule] $DisplayFunction];\)\)}], "Input"], Cell["\<\ What is happening to these solutions as t\[Rule]\[Infinity]?\ \>", "Text"] }, Closed]], Cell[CellGroupData[{ Cell["Example 3 - Another Way to Call on Your Solutions", "Subsection"], Cell[BoxData[{\(Clear[x, y, sol, mat, t]\), "\[IndentingNewLine]", RowBox[{"MatrixForm", "[", RowBox[{"mat", "=", RowBox[{"(", GridBox[{ {\(-5\), "3"}, {\(-2\), \(-10\)} }], ")"}]}], "]"}], "\[IndentingNewLine]", \(Eigensystem[mat] // MatrixForm\), "\n", \(sol = DSolve[Thread[{\(x'\)[t], \(y'\)[t]} \[Equal] mat . {x[t], y[t]}], {x[ t], y[t]}, t]\)}], "Input"], Cell[BoxData[{ \(funs = Table[\({x[t], y[t]} /. sol\) /. {C[1] \[Rule] i, C[2] \[Rule] j}, {i, \(-6\), 6, 3}, {j, \(-6\), 6, 3}]; toplot = Flatten[funs, 1]; Length[toplot];\), "\[IndentingNewLine]", \(\(pptwo = ParametricPlot[Evaluate[toplot], {t, \(-2\), 1}, Compiled \[Rule] False, PlotRange \[Rule] {{\(-10\), 10}, {\(-10\), 10}}, DisplayFunction \[Rule] Identity];\)\), "\[IndentingNewLine]", \(\(graph4 = PlotVectorField[mat . {x, y}, {x, \(-10\), 10}, {y, \(-10\), 10}, DisplayFunction \[Rule] Identity];\)\), "\[IndentingNewLine]", \(\(Show[pptwo, graph4, PlotRange \[Rule] {{\(-10\), 10}, {\(-10\), 10}}, AspectRatio \[Rule] 1, \ DisplayFunction \[Rule] $DisplayFunction];\)\)}], "Input"], Cell["\<\ What is happening to these solutions as t\[Rule]\[Infinity]?\ \>", "Text"] }, Closed]], Cell[CellGroupData[{ Cell["Example 4 - Zero Eigenvalue", "Subsection"], Cell[BoxData[{ \(Clear[x, y, sol, mat, t]\), "\[IndentingNewLine]", \(MatrixForm[mat = {{\(-4\), 6}, {\(-2\), 3}}]\), "\[IndentingNewLine]", \(Eigensystem[mat] // MatrixForm\), "\[IndentingNewLine]", \(sol = DSolve[Thread[{\(x'\)[t], \(y'\)[t]} \[Equal] mat . {x[t], y[t]}], {x[ t], y[t]}, t]\)}], "Input"], Cell[BoxData[{ \(funs = Table[\({x[t], y[t]} /. sol\) /. {C[1] \[Rule] i, C[2] \[Rule] j}, {i, \(-6\), 6, 3}, {j, \(-6\), 6, 3}]; toplot = Flatten[funs, 1]; Length[toplot];\), "\[IndentingNewLine]", \(\(pptwo = ParametricPlot[Evaluate[toplot], {t, \(-2\), 1}, Compiled \[Rule] False, PlotRange \[Rule] {{\(-10\), 10}, {\(-10\), 10}}, DisplayFunction \[Rule] Identity];\)\), "\[IndentingNewLine]", \(\(graph4 = PlotVectorField[mat . {x, y}, {x, \(-10\), 10}, {y, \(-10\), 10}, DisplayFunction \[Rule] Identity];\)\), "\[IndentingNewLine]", \(\(Show[pptwo, graph4, PlotRange \[Rule] {{\(-10\), 10}, {\(-10\), 10}}, AspectRatio \[Rule] 1, \ DisplayFunction \[Rule] $DisplayFunction];\)\)}], "Input"], Cell["\<\ What is different about this compared to the problems above? What impact did \ the zero eigenvalue have on the solutions? Why?\ \>", "Text"] }, Closed]], Cell[CellGroupData[{ Cell["Example 5 - Repeated Root", "Subsection"], Cell[BoxData[{ \(Clear[x, y, sol, mat, t]\), "\[IndentingNewLine]", \(MatrixForm[mat = {{2, 1}, {\(-1\), 4}}]\), "\[IndentingNewLine]", \(Eigensystem[mat] // MatrixForm\), "\n", \(sol = DSolve[Thread[{\(x'\)[t], \(y'\)[t]} \[Equal] mat . {x[t], y[t]}], {x[ t], y[t]}, t]\)}], "Input"], Cell[BoxData[{ \(funs = Table[\({x[t], y[t]} /. sol\) /. {C[1] \[Rule] i, C[2] \[Rule] j}, {i, \(-6\), 6, 3}, {j, \(-6\), 6, 3}]; toplot = Flatten[funs, 1]; Length[toplot];\), "\[IndentingNewLine]", \(\(pptwo = ParametricPlot[Evaluate[toplot], {t, \(-2\), 1}, Compiled \[Rule] False, PlotRange \[Rule] {{\(-10\), 10}, {\(-10\), 10}}, DisplayFunction \[Rule] Identity];\)\), "\[IndentingNewLine]", \(\(graph4 = PlotVectorField[mat . {x, y}, {x, \(-10\), 10}, {y, \(-10\), 10}, DisplayFunction \[Rule] Identity];\)\), "\[IndentingNewLine]", \(\(Show[pptwo, graph4, PlotRange \[Rule] {{\(-10\), 10}, {\(-10\), 10}}, AspectRatio \[Rule] 1, \ DisplayFunction \[Rule] $DisplayFunction];\)\)}], "Input"] }, Closed]] }, Open ]], Cell[CellGroupData[{ Cell["Assignment", "Section"], Cell[TextData[{ "Try out two other systems of linear homogeneous differential equations - \ from your text or from your imagination - and see what happens. The code used \ in examples 3-4-5 will probably be the easiest to use, since all you will \ need to change is your coefficient matrix. Briefly describe what you tried \ and the results (no ", StyleBox["Mathematica", FontSlant->"Italic"], " handouts for this part - just YOUR words). Tell me what the visualization \ of the vector field and the set of solutions does to enhance your \ understanding of the nature of the solutions. \nWrite two paragraphs telling \ me what the eigenvalues of the coefficient matrix tell you about the \ stability of the equilibrium point (0,0)? \n", StyleBox["As a final page, printout one of your plots (a different one for \ each student - so don't use my examples) showing a set of solutions where \ your eigenvectors were real (make sure your arrows go in the same direction \ as your solutions) and draw your eigenvectors on that graph in some different \ color.", FontWeight->"Bold"] }], "Text"] }, Closed]] }, Open ]] }, FrontEndVersion->"4.1 for Microsoft Windows", ScreenRectangle->{{0, 1024}, {0, 695}}, WindowSize->{654, 599}, WindowMargins->{{92, Automatic}, {32, Automatic}}, PrintingCopies->1, PrintingPageRange->{Automatic, Automatic} ] (******************************************************************* 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[1727, 52, 74, 0, 93, "Subtitle"], Cell[CellGroupData[{ Cell[1826, 56, 33, 0, 59, "Section"], Cell[CellGroupData[{ Cell[1884, 60, 62, 0, 47, "Subsection"], Cell[1949, 62, 211, 4, 52, "Text"], Cell[2163, 68, 268, 7, 41, "Input"], Cell[2434, 77, 201, 4, 52, "Text"], Cell[2638, 83, 638, 12, 190, "Input"], Cell[3279, 97, 325, 5, 71, "Text"], Cell[3607, 104, 55, 1, 30, "Input"], Cell[3665, 107, 315, 6, 70, "Input"], Cell[3983, 115, 179, 4, 52, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[4199, 124, 54, 0, 31, "Subsection"], Cell[4256, 126, 454, 7, 90, "Text"], Cell[4713, 135, 121, 2, 50, "Input"], Cell[4837, 139, 87, 2, 33, "Text"], Cell[4927, 143, 293, 6, 90, "Input"], Cell[5223, 151, 87, 2, 33, "Text"], Cell[5313, 155, 746, 14, 170, "Input"], Cell[6062, 171, 84, 2, 33, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[6183, 178, 71, 0, 31, "Subsection"], Cell[6257, 180, 450, 9, 103, "Input"], Cell[6710, 191, 820, 15, 170, "Input"], Cell[7533, 208, 84, 2, 33, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[7654, 215, 49, 0, 31, "Subsection"], Cell[7706, 217, 344, 6, 90, "Input"], Cell[8053, 225, 820, 15, 170, "Input"], Cell[8876, 242, 150, 3, 52, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[9063, 250, 47, 0, 31, "Subsection"], Cell[9113, 252, 322, 6, 90, "Input"], Cell[9438, 260, 820, 15, 170, "Input"] }, Closed]] }, Open ]], Cell[CellGroupData[{ Cell[10307, 281, 29, 0, 59, "Section"], Cell[10339, 283, 1104, 19, 204, "Text"] }, Closed]] }, Open ]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)