(************** 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[ 27752, 830]*) (*NotebookOutlinePosition[ 28450, 854]*) (* CellTagsIndexPosition[ 28406, 850]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell["Constant Coefficient Homogeneous System Examples", "Title", CellFrame->True, TextAlignment->Center, Background->RGBColor[0, 1, 0]], Cell["\<\ This notebook is by Steven Amgott. Please send any questions or \ comments to samgott1@swarthmore.edu. Feel free to use and distribute this \ notebook, but keep this author information in any copy you use or distribute.\ \ \>", "SmallText"], Cell[TextData[{ "This notebook used the add-on package ", StyleBox["VisualDSolve", FontColor->RGBColor[0, 0, 1]], " to create the plots. ", StyleBox["VisualDSolve", FontColor->RGBColor[0, 0, 1]], " is not part of the standard ", StyleBox["Mathematica", FontSlant->"Italic"], " media set. It is a commercial third-party package available (together \ with an accompanying book) from Telos at" }], "Text"], Cell[TextData[{ " ", StyleBox["http://www.telospub.com/catalog/MATHEMATICA/VisualDSolve.html", FontColor->RGBColor[0, 0, 0.996109]], "." }], "Text", TextAlignment->Center, TextJustification->0], Cell["or by download from Wolfram Research at", "Text"], Cell[TextData[{ StyleBox[" ", TextAlignment->Center, TextJustification->0, FontFamily->"Times New Roman", FontVariations->{"CompatibilityType"->0}], StyleBox["http://store.wolfram.com/view/book/D0706.str.", TextAlignment->Center, TextJustification->0, FontFamily->"Times New Roman", FontColor->RGBColor[0, 0, 0.996109], FontVariations->{"CompatibilityType"->0}] }], "Text", TextAlignment->Center, TextJustification->0], Cell["\<\ Without this package you will not be able to create the plots in \ this notebook.\ \>", "Text"], Cell[TextData[{ "In any input cell containing ", StyleBox["xxx", FontColor->RGBColor[1, 0, 1]], " , you must replace it with your input before evaluating the cell. In \ general, anything in ", StyleBox["magenta", FontColor->RGBColor[1, 0, 1]], " is something you can, and possibly should, change." }], "Text"], Cell["\<\ The following cell is an initialization cell which will be \ automatically evaluated, provided you answer \"Yes\" to the initialization \ prompt. If you do not, you will need to evaluate it manually before \ evaluating any of the cells in this notebook which create the plots.\ \>", \ "Text"], Cell[BoxData[ \(Needs["\"]\)], "Input", InitializationCell->True], Cell[TextData[{ "You can check to see if the package loaded by evaluating the next cell. \ The output should include ", StyleBox["VisualDSolve`", FontColor->RGBColor[1, 0, 0]], ". If it does not, either the package is not on your computer or it did \ not load correctly, and you will be unable to produce the plots." }], "Text"], Cell[BoxData[ \($Packages\)], "Input"], Cell[CellGroupData[{ Cell["What this notebook does", "Section"], Cell[TextData[{ "This notebook draws the phase plot of a constant coefficient homogeneous \ system of equations. It then uses eigenvalue-eigenvector methods to find the \ solutions, and compares a plot of the exact solution to that obtained by the \ ", StyleBox["PhasePlot", FontColor->RGBColor[1, 0, 0]], " command in ", StyleBox["VisualDSolve", FontColor->RGBColor[0, 0, 1]], ". It also demonstrates some of the options to the ", StyleBox["PhasePlot", FontColor->RGBColor[1, 0, 0]], " command." }], "Text"] }, Closed]], Cell[CellGroupData[{ Cell["Example 1", "Section"], Cell[CellGroupData[{ Cell["Phase Plot", "Subsection"], Cell["\<\ This shows several trajectories superimposed on the vector field.\ \ \>", "Text"], Cell[BoxData[{ \(Clear[x, y, t]\), "\n", \(\(PhasePlot[{\(x'\)[t] == \(-2\)\ x[t] - y[t], \(y'\)[ t] == \(-y[t]\)}, {x[t], y[t]}, \n\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {t, 0, 10}, {x, \(-2\), 2}, {\ y, \(-2\), 2}, \n\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ VectorField \ -> True, \n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ InitialValues\ \ -> Flatten[Table[{ .5\ i, .5 j}, {i, \(-3\), 3}, {j, \(-3\), 3}], 1]];\)\ \)}], "Input"], Cell[CellGroupData[{ Cell["A few option changes", "Subsubsection"], Cell[TextData[{ "This shows only the trajectories, and not the vector field, by leaving out \ the ", StyleBox["VectorField", FontColor->RGBColor[1, 0, 0]], " option. (The same effect can be had by using ", StyleBox["VectorField\[Rule]False", FontColor->RGBColor[1, 0, 0]], ".)" }], "Text"], Cell[BoxData[{ \(Clear[x, y, t]\), \(\(PhasePlot[{\(x'\)[t] == \(-2\)\ x[t] - y[t], \(y'\)[t] == \(-y[t]\)}, {x[t], y[t]}, \n \t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {t, 0, 10}, {x, \(-2\), 2}, {\ y, \(-2\), 2}, \n \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ InitialValues\ -> Flatten[Table[{ .5\ i, .5 j}, {i, \(-3\), 3}, {j, \(-3\), 3}], 1]]; \)\ \)}], "Input"], Cell[TextData[{ "This plots one trajectory, and uses ", StyleBox["DirectionArrow\[Rule]True", FontColor->RGBColor[1, 0, 0]], " to put an arrowhead indicating the direction of motion." }], "Text"], Cell[BoxData[{ \(Clear[x, y, t]\), \(\(PhasePlot[{\(x'\)[t] == \(-2\)\ x[t] - y[t], \(y'\)[t] == \(-y[t]\)}, {x[t], y[t]}, \n \t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {t, 0, 10}, {x, \(-2\), 2}, {\ y, \(-2\), 2}, \n \t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ DirectionArrow \[Rule] True, \n \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ InitialValues\ -> {{2, 1}}]; \)\ \)}], "Input"], Cell[TextData[{ "This includes the ", StyleBox["FieldLogScale", FontColor->RGBColor[1, 0, 0]], " option which scales the lengths of the vectors in the vector field. When \ set to 10, it makes all the vectors the same length. If we use a ", StyleBox["FieldLogScale", FontColor->RGBColor[1, 0, 0]], " less than 10, we can scale the vectors each by different factors to make \ them closer to the same length." }], "Text"], Cell[BoxData[{\(Clear[x, y, t]\), "\n", RowBox[{ RowBox[{ RowBox[{"PhasePlot", "[", RowBox[{\({\(x'\)[t] == \(-2\)\ x[t] - y[t], \(y'\)[ t] == \(-y[t]\)}\), ",", \({x[t], y[t]}\), ",", "\n", "\t\t ", \({t, 0, 10}\), ",", \({x, \(-2\), 2}\), ",", \({\ y, \(-2\), 2}\), ",", "\n", "\t ", \(VectorField -> True\), ",", RowBox[{"FieldLogScale", "\[Rule]", StyleBox["10", FontColor->RGBColor[1, 0, 1]]}], ",", "\n", " ", \(InitialValues\ -> Flatten[Table[{ .5\ i, .5 j}, {i, \(-3\), 3}, {j, \(-3\), 3}], 1]\)}], "]"}], ";"}], " "}]}], "Input"], Cell[TextData[{ "This uses ", StyleBox["FlowField\[Rule]True", FontColor->RGBColor[1, 0, 0]], " to make \"fish shapes\" instead of vectors." }], "Text"], Cell[BoxData[{ \(Clear[x, y, t]\), \(\(PhasePlot[{\(x'\)[t] == \(-2\)\ x[t] - y[t], \(y'\)[t] == \(-y[t]\)}, {x[t], y[t]}, \n \t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {t, 0, 10}, {x, \(-2\), 2}, {\ y, \(-2\), 2}, \n \t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ FlowField -> True, \n \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ InitialValues\ -> Flatten[Table[{ .5\ i, .5 j}, {i, \(-3\), 3}, {j, \(-3\), 3}], 1]]; \)\ \)}], "Input"], Cell[TextData[{ "We can make all the \"fish shapes\" the same size. If we use a ", StyleBox["FieldLogScale", FontColor->RGBColor[1, 0, 0]], " less than 10, we can scale the \"fish\" each by different factors to make \ them closer to the same size." }], "Text"], Cell[BoxData[{\(Clear[x, y, t]\), "\n", RowBox[{ RowBox[{ RowBox[{"PhasePlot", "[", RowBox[{\({\(x'\)[t] == \(-2\)\ x[t] - y[t], \(y'\)[ t] == \(-y[t]\)}\), ",", \({x[t], y[t]}\), ",", "\n", "\t\t ", \({t, 0, 10}\), ",", \({x, \(-2\), 2}\), ",", \({\ y, \(-2\), 2}\), ",", "\n", "\t ", \(FlowField -> True\), ",", RowBox[{"FieldLogScale", "\[Rule]", StyleBox["10", FontColor->RGBColor[1, 0, 1]]}], ",", "\n", " ", \(InitialValues\ -> Flatten[Table[{ .5\ i, .5 j}, {i, \(-3\), 3}, {j, \(-3\), 3}], 1]\)}], "]"}], ";"}], " "}]}], "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["Solution", "Subsection"], Cell["Let's find the solution using eigenvectors and eigenvalues.", "Text"], Cell[BoxData[{\(Clear[a]\), "\n", RowBox[{ RowBox[{"a", "=", RowBox[{"(", GridBox[{ {\(-2\), \(-1\)}, {"0", \(-1\)} }], ")"}]}], ";"}]}], "Input"], Cell[BoxData[{ \(Clear[\[Lambda]]\), "\n", \(\[Lambda] = Eigenvalues[a]\)}], "Input"], Cell[BoxData[{ \(\nClear[v]\), "\n", \(v = Eigenvectors[a]\)}], "Input"], Cell["\<\ Since we have found two distinct eigenvectors, we know the \ solution.\ \>", "Text"], Cell[BoxData[{ \(Clear[x, t, c1, c2]\), "\n", \(x[t_] = c1\ v[\([1]\)] \[ExponentialE]\^\(\[Lambda][\([1]\)]\ t\) + c2\ v[\([2]\)]\ \[ExponentialE]\^\(\[Lambda][\([2]\)]\ t\)\)}], \ "Input"], Cell["Here's a plot of a particular solution.", "Text"], Cell[BoxData[{ \(Clear[c1, c2, t]\), "\n", \(\(c1 = 3;\)\), "\n", \(\(c2 = 1;\)\), "\n", \(\(ParametricPlot[x[t], {t, 0, 10}];\)\)}], "Input"], Cell["Let's compare to PhasePlot.", "Text"], Cell[BoxData[{ \(Clear[x, y, t]\), "\n", \(\(PhasePlot[{\(x'\)[t] == \(-2\)\ x[t] - y[t], \(y'\)[ t] == \(-y[t]\)}, {x[t], y[t]}, \n\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {t, 0, 10}, {x, \(-2\), 2}, {\ y, \(-2\), 2}, \n\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ DirectionArrow \[Rule] True, \n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ InitialValues\ -> {{2, 1}}];\)\ \)}], "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["Example 2", "Section"], Cell[CellGroupData[{ Cell["Phase Plot", "Subsection"], Cell["\<\ This shows several trajectories superimposed on the vector field.\ \ \>", "Text"], Cell[BoxData[{ \(Clear[x, y, t]\), "\n", \(\(PhasePlot[{\(x'\)[t] == \(-x[t]\) + 2 y[t], \(y'\)[ t] == \(-y[t]\)}, {x[t], y[t]}, \n\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {t, 0, 10}, {x, \(-2\), 2}, {\ y, \(-2\), 2}, \n\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ VectorField \ -> True, \n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ InitialValues\ \ -> Flatten[Table[{ .5\ i, .5 j}, {i, \(-3\), 3}, {j, \(-3\), 3}], 1]];\)\ \)}], "Input"], Cell[CellGroupData[{ Cell["A few option changes", "Subsubsection"], Cell[TextData[{ "This shows only the trajectories, and not the vector field, by leaving out \ the ", StyleBox["VectorField", FontColor->RGBColor[1, 0, 0]], " option. (The same effect can be had by using ", StyleBox["VectorField\[Rule]False", FontColor->RGBColor[1, 0, 0]], ".)" }], "Text"], Cell[BoxData[{ \(Clear[x, y, t]\), "\n", \(\(PhasePlot[{\(x'\)[t] == \(-x[t]\) + 2 y[t], \(y'\)[ t] == \(-y[t]\)}, {x[t], y[t]}, \n\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {t, 0, 10}, {x, \(-2\), 2}, {\ y, \(-2\), 2}, \n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ InitialValues\ -> Flatten[Table[{ .5\ i, .5 j}, {i, \(-3\), 3}, {j, \(-3\), 3}], 1]];\)\ \)}], "Input"], Cell[TextData[{ "This plots one trajectory, and uses ", StyleBox["DirectionArrow\[Rule]True", FontColor->RGBColor[1, 0, 0]], " to put an arrowhead indicating the direction of motion." }], "Text"], Cell[BoxData[{ \(Clear[x, y, t]\), "\n", \(\(PhasePlot[{\(x'\)[t] == \(-x[t]\) + 2 y[t], \(y'\)[ t] == \(-y[t]\)}, {x[t], y[t]}, \n\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {t, 0, 10}, {x, \(-2\), 2}, {\ y, \(-2\), 2}, \n\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ DirectionArrow \[Rule] True, \n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ InitialValues\ -> {{2, 1}}];\)\ \)}], "Input"], Cell[TextData[{ "This includes the ", StyleBox["FieldLogScale", FontColor->RGBColor[1, 0, 0]], " option which scales the lengths of the vectors in the vector field. When \ set to 10, it makes all the vectors the same length. If we use a ", StyleBox["FieldLogScale", FontColor->RGBColor[1, 0, 0]], " less than 10, we can scale the vectors each by different factors to make \ them closer to the same length." }], "Text"], Cell[BoxData[{\(Clear[x, y, t]\), "\n", RowBox[{ RowBox[{ RowBox[{"PhasePlot", "[", RowBox[{\({\(x'\)[t] == \(-x[t]\) + 2 y[t], \(y'\)[ t] == \(-y[t]\)}\), ",", \({x[t], y[t]}\), ",", "\n", "\t\t ", \({t, 0, 10}\), ",", \({x, \(-2\), 2}\), ",", \({\ y, \(-2\), 2}\), ",", "\n", "\t ", \(VectorField -> True\), ",", RowBox[{"FieldLogScale", "\[Rule]", StyleBox["10", FontColor->RGBColor[1, 0, 1]]}], ",", "\n", " ", \(InitialValues\ -> Flatten[Table[{ .5\ i, .5 j}, {i, \(-3\), 3}, {j, \(-3\), 3}], 1]\)}], "]"}], ";"}], " "}]}], "Input"], Cell[TextData[{ "This uses ", StyleBox["FlowField\[Rule]True", FontColor->RGBColor[1, 0, 0]], " to make \"fish shapes\" instead of vectors." }], "Text"], Cell[BoxData[{ \(Clear[x, y, t]\), "\n", \(\(PhasePlot[{\(x'\)[t] == \(-x[t]\) + 2 y[t], \(y'\)[ t] == \(-y[t]\)}, {x[t], y[t]}, \n\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {t, 0, 10}, {x, \(-2\), 2}, {\ y, \(-2\), 2}, \n\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ FlowField -> True, \n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ InitialValues\ -> Flatten[Table[{ .5\ i, .5 j}, {i, \(-3\), 3}, {j, \(-3\), 3}], 1]];\)\ \)}], "Input"], Cell[TextData[{ "We can make all the \"fish shapes\" the same size. If we use a ", StyleBox["FieldLogScale", FontColor->RGBColor[1, 0, 0]], " less than 10, we can scale the \"fish\" each by different factors to make \ them closer to the same size." }], "Text"], Cell[BoxData[{\(Clear[x, y, t]\), "\n", RowBox[{ RowBox[{ RowBox[{"PhasePlot", "[", RowBox[{\({\(x'\)[t] == \(-x[t]\) + 2 y[t], \(y'\)[ t] == \(-y[t]\)}\), ",", \({x[t], y[t]}\), ",", "\n", "\t\t ", \({t, 0, 10}\), ",", \({x, \(-2\), 2}\), ",", \({\ y, \(-2\), 2}\), ",", "\n", "\t ", \(FlowField -> True\), ",", RowBox[{"FieldLogScale", "\[Rule]", StyleBox["10", FontColor->RGBColor[1, 0, 1]]}], ",", "\n", " ", \(InitialValues\ -> Flatten[Table[{ .5\ i, .5 j}, {i, \(-3\), 3}, {j, \(-3\), 3}], 1]\)}], "]"}], ";"}], " "}]}], "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["Solution", "Subsection"], Cell["Let's find the solution using eigenvectors and eigenvalues.", "Text"], Cell[BoxData[{\(Clear[a]\), "\n", RowBox[{ RowBox[{"a", "=", RowBox[{"(", GridBox[{ {\(-1\), "2"}, {"0", \(-1\)} }], ")"}]}], ";"}]}], "Input"], Cell[BoxData[{ \(Clear[\[Lambda]]\), \(\[Lambda] = Eigenvalues[a]\)}], "Input"], Cell[BoxData[{ \(\nClear[v]\), \(v = Eigenvectors[a]\)}], "Input"], Cell["\<\ This time we have a problem that we don't yet know how to get \ around. We have only found one linearly independent eigenvector. Notice \ that this showed up in the phase portrait. We'll learn to deal with this \ later.\ \>", "Text"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["Example 3", "Section"], Cell[CellGroupData[{ Cell["Phase Plot", "Subsection"], Cell["\<\ This shows several trajectories superimposed on the vector field.\ \ \>", "Text"], Cell[BoxData[{ \(Clear[x, y, t]\), \(\(PhasePlot[{\(x'\)[t] == x[t], \(y'\)[t] == x[t] - y[t]}, {x[t], y[t]}, \n\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {t, \(-10\), 10}, {x, \(-2\), 2}, {\ y, \(-2\), 2}, \n \t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ VectorField -> True, \n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ InitialValues\ -> Flatten[Table[{0, .5\ i, .5 j}, {i, \(-3\), 3}, {j, \(-3\), 3}], 1]]; \)\ \)}], "Input"], Cell[CellGroupData[{ Cell["A few option changes", "Subsubsection"], Cell[TextData[{ "This shows only the trajectories, and not the vector field, by leaving out \ the ", StyleBox["VectorField", FontColor->RGBColor[1, 0, 0]], " option. (The same effect can be had by using ", StyleBox["VectorField\[Rule]False", FontColor->RGBColor[1, 0, 0]], ".)" }], "Text"], Cell[BoxData[{ \(Clear[x, y, t]\), \(\(PhasePlot[{\(x'\)[t] == x[t], \(y'\)[t] == x[t] - y[t]}, {x[t], y[t]}, \n\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {t, \(-10\), 10}, {x, \(-2\), 2}, {\ y, \(-2\), 2}, \n \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ InitialValues\ -> Flatten[Table[{0, .5\ i, .5 j}, {i, \(-3\), 3}, {j, \(-3\), 3}], 1]]; \)\ \)}], "Input"], Cell[TextData[{ "This plots one trajectory, and uses ", StyleBox["DirectionArrow\[Rule]True", FontColor->RGBColor[1, 0, 0]], " to put an arrowhead indicating the direction of motion." }], "Text"], Cell[BoxData[{ \(Clear[x, y, t]\), \(\(PhasePlot[{\(x'\)[t] == x[t], \(y'\)[t] == x[t] - y[t]}, {x[t], y[t]}, \n\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {t, \(-10\), 10}, {x, \(-2\), 2}, {\ y, \(-2\), 2}, \n \t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ DirectionArrow \[Rule] True, \n \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ InitialValues\ -> {{0, 2, 1}}]; \)\ \)}], "Input"], Cell[TextData[{ "This includes the ", StyleBox["FieldLogScale", FontColor->RGBColor[1, 0, 0]], " option which scales the lengths of the vectors in the vector field. When \ set to 10, it makes all the vectors the same length. If we use a ", StyleBox["FieldLogScale", FontColor->RGBColor[1, 0, 0]], " less than 10, we can scale the vectors each by different factors to make \ them closer to the same length." }], "Text"], Cell[BoxData[{\(Clear[x, y, t]\), "\n", RowBox[{ RowBox[{ RowBox[{"PhasePlot", "[", RowBox[{\({\(x'\)[t] == x[t], \(y'\)[t] == x[t] - y[t]}\), ",", \({x[t], y[t]}\), ",", "\n", "\t\t ", \({t, \(-10\), 10}\), ",", \({x, \(-2\), 2}\), ",", \({\ y, \(-2\), 2}\), ",", "\n", "\t ", \(VectorField -> True\), ",", RowBox[{"FieldLogScale", "\[Rule]", StyleBox["10", FontColor->RGBColor[1, 0, 1]]}], ",", "\n", " ", \(InitialValues\ -> Flatten[Table[{0, .5\ i, .5 j}, {i, \(-3\), 3}, {j, \(-3\), 3}], 1]\)}], "]"}], ";"}], " "}]}], "Input"], Cell[TextData[{ "This uses ", StyleBox["FlowField\[Rule]True", FontColor->RGBColor[1, 0, 0]], " to make \"fish shapes\" instead of vectors." }], "Text"], Cell[BoxData[{ \(Clear[x, y, t]\), \(\(PhasePlot[{\(x'\)[t] == x[t], \(y'\)[t] == x[t] - y[t]}, {x[t], y[t]}, \n\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {t, \(-10\), 10}, {x, \(-2\), 2}, {\ y, \(-2\), 2}, \n \t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ FlowField -> True, \n \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ InitialValues\ -> Flatten[Table[{0, .5\ i, .5 j}, {i, \(-3\), 3}, {j, \(-3\), 3}], 1]]; \)\ \)}], "Input"], Cell[TextData[{ "We can make all the \"fish shapes\" the same size. If we use a ", StyleBox["FieldLogScale", FontColor->RGBColor[1, 0, 0]], " less than 10, we can scale the \"fish\" each by different factors to make \ them closer to the same size." }], "Text"], Cell[BoxData[{\(Clear[x, y, t]\), "\n", RowBox[{ RowBox[{ RowBox[{"PhasePlot", "[", RowBox[{\({\(x'\)[t] == x[t], \(y'\)[t] == x[t] - y[t]}\), ",", \({x[t], y[t]}\), ",", "\n", "\t\t ", \({t, \(-10\), 10}\), ",", \({x, \(-2\), 2}\), ",", \({\ y, \(-2\), 2}\), ",", "\n", "\t ", \(FlowField -> True\), ",", RowBox[{"FieldLogScale", "\[Rule]", StyleBox["10", FontColor->RGBColor[1, 0, 1]]}], ",", "\n", " ", \(InitialValues\ -> Flatten[Table[{0, .5\ i, .5 j}, {i, \(-3\), 3}, {j, \(-3\), 3}], 1]\)}], "]"}], ";"}], " "}]}], "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["Solution", "Subsection"], Cell["Let's find the solution using eigenvectors and eigenvalues.", "Text"], Cell[BoxData[{\(Clear[a]\), "\n", RowBox[{ RowBox[{"a", "=", RowBox[{"(", GridBox[{ {"1", "0"}, {"1", \(-1\)} }], ")"}]}], ";"}]}], "Input"], Cell[BoxData[{ \(Clear[\[Lambda]]\), "\n", \(\[Lambda] = Eigenvalues[a]\)}], "Input"], Cell[BoxData[{ \(Clear[v]\), "\n", \(v = Eigenvectors[a]\)}], "Input"], Cell[BoxData[{ \(Clear[x, t, c1, c2]\), \(x[t_] = c1\ v[\([1]\)] \[ExponentialE]\^\(\[Lambda][\([1]\)]\ t\) + c2\ v[\([2]\)]\ \[ExponentialE]\^\(\[Lambda][\([2]\)]\ t\)\)}], "Input"], Cell["Here's a plot of a particular solution.", "Text"], Cell[BoxData[{ \(Clear[c1, c2, t]\), \(c1 = 2.5; \nc2 = \(- .5\); \nParametricPlot[x[t], {t, 0, .5}]; \)}], "Input"], Cell["Let's compare to PhasePlot.", "Text"], Cell[BoxData[{ \(Clear[x, y, t]\), \(\(PhasePlot[{\(x'\)[t] == x[t], \(y'\)[t] == x[t] - y[t]}, {x[t], y[t]}, \n\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {t, 0, 10}, { x, \(-2\), 2}, {\ y, \(-2\), 2}, \n \t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ DirectionArrow \[Rule] True, \n \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ InitialValues\ -> {{\(-1\), 2}}]; \)\ \)}], "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["Example 4", "Section"], Cell[CellGroupData[{ Cell["Phase Plot", "Subsection"], Cell["\<\ This shows several trajectories superimposed on the vector field.\ \ \>", "Text"], Cell[BoxData[{ \(Clear[x, y, t]\), "\n", \(\(PhasePlot[{\(x'\)[t] == \(-x[t]\) - 4\ y[t], \(y'\)[t] == x[t] - y[t]}, {x[t], y[t]}, \n\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {t, 0, 10}, {x, \(-3\), 3}, {\ y, \(-3\), 3}, \n\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ VectorField \ -> True, FieldLogScale \[Rule] 10, \n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ InitialValues\ -> Flatten[Table[{\ i, j}, {i, \(-2\), 2}, {j, \(-2\), 2}], 1]];\)\ \)}], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Solution", "Subsection"], Cell["Let's find the solution using eigenvectors and eigenvalues.", "Text"], Cell[BoxData[{\(Clear[a]\), RowBox[{ RowBox[{"a", "=", RowBox[{"(", GridBox[{ {\(-1\), \(-4\)}, {"1", \(-1\)} }], ")"}]}], ";"}]}], "Input"], Cell[BoxData[{ \(Clear[\[Lambda]]\), "\n", \(\[Lambda] = Eigenvalues[a]\)}], "Input"], Cell[BoxData[{ \(\nClear[v]\), "\n", \(v = Eigenvectors[a]\)}], "Input"], Cell["\<\ We have complex eigenvalues and eigenvectors. We only need to use \ one eigenvalue-eigenvector pair.\ \>", "Text"], Cell["Using -1+2I and {2I,1}:", "Text"], Cell[BoxData[ \(\(\[ExponentialE]\^\(\((\(-1\) + 2\ I)\)\ t\)\) {2\ I, 1}\)], "Input"], Cell[BoxData[ \(ComplexExpand[%]\)], "Input"], Cell[BoxData[{ \(Clear[x, t, c1, c2]\), \(x[t_] = c1\ \ \(\[ExponentialE]\^\(-\ t\)\) {\(-2\) Sin[2\ t], Cos[2\ t]} + c2\ \ \(\[ExponentialE]\^\(-\ t\)\) {2\ Cos[2\ t], Sin[2\ t]}\)}], "Input"], Cell["\<\ Here's a plot of a particular solution (both phase plane and \ solutions).\ \>", "Text"], Cell[BoxData[{ \(Clear[c1, c2, t]\), \(c1 = 2.5; \nc2 = \(- .5\); \nParametricPlot[x[t], {t, 0, 5}]; \n Plot[{\(x[t]\)[\([1]\)], \(x[t]\)[\([2]\)]}, {t, 0, 5}, PlotRange \[Rule] {\(-3\), 3}]; \)}], "Input"], Cell["Let's compare to PhasePlot and SystemSolutionPlot.", "Text"], Cell[BoxData[{ \(Clear[x, y, t]\), \(PhasePlot[{\(x'\)[t] == \(-x[t]\) - 4\ y[t], \(y'\)[t] == x[t] - y[t]}, {x[t], y[t]}, \n \t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {t, 0, 5}, {x, \(-3\), 3}, {\ y, \(-3\), 3}, \n \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ InitialValues\ -> {{\(-1\), 2.5}}]; \ \n SystemSolutionPlot[{\(x'\)[t] == \(-x[t]\) - 4\ y[t], \(y'\)[t] == x[t] - y[t]}, {x[t], y[t]}, \n \t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {t, 0, 5}, PlotRange \[Rule] {\(-3\), 3}, \n \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ InitialValues\ -> {{\(-1\), 2.5}}]; \ \)}], "Input"] }, Closed]] }, Closed]] }, Open ]] }, FrontEndVersion->"4.1 for Microsoft Windows", ScreenRectangle->{{0, 1024}, {0, 722}}, AutoGeneratedPackage->None, WindowToolbars->"EditBar", WindowSize->{571, 575}, WindowMargins->{{2, Automatic}, {Automatic, 0}} ] (******************************************************************* 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, 142, 3, 241, "Title"], Cell[1872, 57, 252, 5, 44, "SmallText"], Cell[2127, 64, 430, 12, 71, "Text"], Cell[2560, 78, 207, 7, 33, "Text"], Cell[2770, 87, 55, 0, 33, "Text"], Cell[2828, 89, 462, 14, 33, "Text"], Cell[3293, 105, 105, 3, 33, "Text"], Cell[3401, 110, 328, 9, 52, "Text"], Cell[3732, 121, 303, 6, 71, "Text"], Cell[4038, 129, 87, 2, 27, "Input", InitializationCell->True], Cell[4128, 133, 340, 7, 62, "Text"], Cell[4471, 142, 42, 1, 30, "Input"], Cell[CellGroupData[{ Cell[4538, 147, 42, 0, 53, "Section"], Cell[4583, 149, 536, 14, 90, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[5156, 168, 28, 0, 33, "Section"], Cell[CellGroupData[{ Cell[5209, 172, 32, 0, 47, "Subsection"], Cell[5244, 174, 91, 3, 33, "Text"], Cell[5338, 179, 530, 9, 130, "Input"], Cell[CellGroupData[{ Cell[5893, 192, 45, 0, 43, "Subsubsection"], Cell[5941, 194, 308, 9, 52, "Text"], Cell[6252, 205, 440, 9, 110, "Input"], Cell[6695, 216, 205, 5, 52, "Text"], Cell[6903, 223, 462, 9, 110, "Input"], Cell[7368, 234, 438, 10, 71, "Text"], Cell[7809, 246, 800, 15, 130, "Input"], Cell[8612, 263, 162, 5, 33, "Text"], Cell[8777, 270, 518, 10, 130, "Input"], Cell[9298, 282, 271, 6, 52, "Text"], Cell[9572, 290, 798, 15, 130, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[10419, 311, 30, 0, 31, "Subsection"], Cell[10452, 313, 75, 0, 33, "Text"], Cell[10530, 315, 208, 6, 62, "Input"], Cell[10741, 323, 94, 2, 50, "Input"], Cell[10838, 327, 81, 2, 70, "Input"], Cell[10922, 331, 94, 3, 33, "Text"], Cell[11019, 336, 215, 5, 50, "Input"], Cell[11237, 343, 55, 0, 33, "Text"], Cell[11295, 345, 161, 4, 90, "Input"], Cell[11459, 351, 43, 0, 33, "Text"], Cell[11505, 353, 477, 9, 110, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[12031, 368, 28, 0, 33, "Section"], Cell[CellGroupData[{ Cell[12084, 372, 32, 0, 47, "Subsection"], Cell[12119, 374, 91, 3, 33, "Text"], Cell[12213, 379, 530, 9, 130, "Input"], Cell[CellGroupData[{ Cell[12768, 392, 45, 0, 43, "Subsubsection"], Cell[12816, 394, 308, 9, 52, "Text"], Cell[13127, 405, 466, 9, 110, "Input"], Cell[13596, 416, 205, 5, 52, "Text"], Cell[13804, 423, 477, 9, 110, "Input"], Cell[14284, 434, 438, 10, 71, "Text"], Cell[14725, 446, 800, 15, 130, "Input"], Cell[15528, 463, 162, 5, 33, "Text"], Cell[15693, 470, 548, 10, 130, "Input"], Cell[16244, 482, 271, 6, 52, "Text"], Cell[16518, 490, 798, 15, 130, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[17365, 511, 30, 0, 31, "Subsection"], Cell[17398, 513, 75, 0, 33, "Text"], Cell[17476, 515, 205, 6, 62, "Input"], Cell[17684, 523, 88, 2, 50, "Input"], Cell[17775, 527, 75, 2, 70, "Input"], Cell[17853, 531, 246, 5, 71, "Text"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[18148, 542, 28, 0, 33, "Section"], Cell[CellGroupData[{ Cell[18201, 546, 32, 0, 47, "Subsection"], Cell[18236, 548, 91, 3, 33, "Text"], Cell[18330, 553, 515, 9, 130, "Input"], Cell[CellGroupData[{ Cell[18870, 566, 45, 0, 43, "Subsubsection"], Cell[18918, 568, 308, 9, 52, "Text"], Cell[19229, 579, 435, 8, 110, "Input"], Cell[19667, 589, 205, 5, 52, "Text"], Cell[19875, 596, 451, 8, 110, "Input"], Cell[20329, 606, 438, 10, 71, "Text"], Cell[20770, 618, 790, 15, 130, "Input"], Cell[21563, 635, 162, 5, 33, "Text"], Cell[21728, 642, 513, 9, 130, "Input"], Cell[22244, 653, 271, 6, 52, "Text"], Cell[22518, 661, 788, 15, 130, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[23355, 682, 30, 0, 31, "Subsection"], Cell[23388, 684, 75, 0, 33, "Text"], Cell[23466, 686, 202, 6, 62, "Input"], Cell[23671, 694, 94, 2, 50, "Input"], Cell[23768, 698, 79, 2, 50, "Input"], Cell[23850, 702, 210, 5, 50, "Input"], Cell[24063, 709, 55, 0, 33, "Text"], Cell[24121, 711, 129, 3, 90, "Input"], Cell[24253, 716, 43, 0, 33, "Text"], Cell[24299, 718, 447, 8, 110, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[24795, 732, 28, 0, 33, "Section"], Cell[CellGroupData[{ Cell[24848, 736, 32, 0, 47, "Subsection"], Cell[24883, 738, 91, 3, 33, "Text"], Cell[24977, 743, 570, 11, 150, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[25584, 759, 30, 0, 31, "Subsection"], Cell[25617, 761, 75, 0, 33, "Text"], Cell[25695, 763, 202, 6, 62, "Input"], Cell[25900, 771, 94, 2, 50, "Input"], Cell[25997, 775, 81, 2, 70, "Input"], Cell[26081, 779, 125, 3, 33, "Text"], Cell[26209, 784, 39, 0, 33, "Text"], Cell[26251, 786, 90, 1, 30, "Input"], Cell[26344, 789, 49, 1, 30, "Input"], Cell[26396, 792, 221, 5, 50, "Input"], Cell[26620, 799, 98, 3, 33, "Text"], Cell[26721, 804, 226, 4, 110, "Input"], Cell[26950, 810, 66, 0, 33, "Text"], Cell[27019, 812, 693, 13, 190, "Input"] }, Closed]] }, Closed]] }, Open ]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)