(* Content-type: application/vnd.wolfram.mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 10.4' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 158, 7] NotebookDataLength[ 51045, 1474] NotebookOptionsPosition[ 47758, 1367] NotebookOutlinePosition[ 48116, 1383] CellTagsIndexPosition[ 48073, 1380] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["Matrices and Vectors", "Subsection", CellChangeTimes->{{3.618749138518262*^9, 3.618749147133906*^9}, { 3.688924505813448*^9, 3.688924509772258*^9}}], Cell["\<\ Matrices can be declared in Mathematica as a list of lists of the form \ A={{a,b},{c,d}}, where {a, b} is the first row of the matrix and {c,d} is the \ second row of the matrix. The Mathematica front end also provides an \ Insert->Table/Matrix submenu for creating and editing arrays with any \ specified number of rows and columns. Once you have such an array, you can \ edit it to fill in whatever elements you want.\ \>", "Text", CellChangeTimes->{{3.6187492587709017`*^9, 3.618749273529153*^9}, { 3.618749823821348*^9, 3.6187498371461906`*^9}, {3.689788328678886*^9, 3.689788436902767*^9}}], Cell[BoxData[{ RowBox[{"A", "=", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "0", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "1", ",", "1"}], "}"}]}], "}"}]}], "\[IndentingNewLine]", RowBox[{"A", "=", RowBox[{"(", "\[NoBreak]", GridBox[{ {"1", "0", "0"}, {"1", "1", "1"} }], "\[NoBreak]", ")"}]}], "\[IndentingNewLine]", RowBox[{"v", "=", RowBox[{"(", "\[NoBreak]", GridBox[{ {"1"}, {"2"}, {"3"} }], "\[NoBreak]", ")"}]}]}], "Input", CellChangeTimes->{{3.6187499445038223`*^9, 3.618749963982069*^9}, { 3.6889242323283863`*^9, 3.688924241362441*^9}, {3.6889242823277493`*^9, 3.688924283226098*^9}, {3.689788292503346*^9, 3.689788311917509*^9}, { 3.6897923777176523`*^9, 3.6897923783957777`*^9}}, Background->RGBColor[0.87, 0.94, 1]], Cell[TextData[{ "If you compile these examples, we can see that Mathematica treats a matrix \ like a list of lists. To see these matrices in standard matrix form, use the \ command ", StyleBox["MatrixForm[ ]", FontWeight->"Bold"], ". A vector in ", StyleBox["Mathematica", FontSlant->"Italic"], " is a list. Column vectors and row vectors are represented identically." }], "Text", CellChangeTimes->{{3.618750014907218*^9, 3.618750038266217*^9}, { 3.618880378095418*^9, 3.618880403395008*^9}, {3.688920169573598*^9, 3.6889201911743517`*^9}, {3.688924362172069*^9, 3.688924365447434*^9}, { 3.6889323185210447`*^9, 3.6889323410003433`*^9}, {3.689788463160774*^9, 3.6897884655755377`*^9}}], Cell[BoxData[{ RowBox[{"MatrixForm", "[", RowBox[{"IdentityMatrix", "[", "3", "]"}], "]"}], "\[IndentingNewLine]", RowBox[{"w", "=", RowBox[{"{", RowBox[{"1", ",", "2", ",", "3"}], "}"}]}], "\[IndentingNewLine]", RowBox[{"MatrixForm", "[", "w", "]"}]}], "Input", CellChangeTimes->{{3.688920194672627*^9, 3.6889202187258244`*^9}, { 3.6889243206843233`*^9, 3.688924321590732*^9}, {3.6897923573813763`*^9, 3.6897923728687143`*^9}}, Background->RGBColor[0.87, 0.94, 1]] }, Open ]], Cell[CellGroupData[{ Cell["The inverse of a matrix", "Subsection", CellChangeTimes->{{3.6889252291403837`*^9, 3.688925249677278*^9}, { 3.689788503520482*^9, 3.689788503936264*^9}, {3.6897910849305058`*^9, 3.68979108549016*^9}}], Cell[TextData[{ StyleBox["Inverse[A]", FontWeight->"Bold"], " computes the inverse of an nxn square matrix A, if the matrix is \ invertible, and displays an error message otherwise. A matrix whose \ determinant is different from 0 is invertible. Its inverse is the unique nxn \ square matrix B wih the property that AB = BA = IdentityMatrix[n]." }], "Text", CellChangeTimes->{{3.688924935972577*^9, 3.688924943442913*^9}, { 3.688925168404255*^9, 3.688925203282329*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{"M", "=", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "2"}], "}"}], ",", RowBox[{"{", RowBox[{"3", ",", "4"}], "}"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"Inverse", "[", "M", "]"}], "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{ RowBox[{ RowBox[{"MatrixForm", "[", "M", "]"}], RowBox[{"MatrixForm", "[", RowBox[{"Inverse", "[", "M", "]"}], "]"}]}], ",", "\"\<=\>\"", ",", RowBox[{ RowBox[{"MatrixForm", "[", RowBox[{"Inverse", "[", "M", "]"}], "]"}], RowBox[{"MatrixForm", "[", "M", "]"}]}], ",", "\"\<=\>\"", ",", RowBox[{"MatrixForm", "[", RowBox[{"IdentityMatrix", "[", "2", "]"}], "]"}]}], "]"}]}], "Input", CellChangeTimes->{{3.688924966349895*^9, 3.688925150076127*^9}}, Background->RGBColor[0.87, 0.94, 1]] }, Open ]], Cell[CellGroupData[{ Cell["Matrix and Vector Operations", "Subsection", CellChangeTimes->{{3.618751105193527*^9, 3.6187511372141237`*^9}, { 3.618751673706723*^9, 3.618751676336491*^9}}], Cell["\<\ We can perform matrix addition A+B and scalar multiplication 3A in the usual \ way. However, to do matrix multiplication we cannot use the symbol * , \ instead we have to use a dot!\ \>", "Text", CellChangeTimes->{{3.618751330382312*^9, 3.61875136816485*^9}, { 3.6187535600369043`*^9, 3.618753581644103*^9}, 3.689788579172842*^9}], Cell[BoxData[{ RowBox[{ RowBox[{"A", "=", RowBox[{"(", "\[NoBreak]", GridBox[{ {"1", "0", "0"}, {"1", "1", "1"} }], "\[NoBreak]", ")"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"w", "=", RowBox[{"{", RowBox[{"1", ",", "2", ",", "3"}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"MatrixForm", "[", RowBox[{"3", "A"}], "]"}], "\[IndentingNewLine]", RowBox[{"MatrixForm", "[", RowBox[{"A", "+", "A"}], "]"}], "\[IndentingNewLine]", RowBox[{"v", "=", RowBox[{"A", ".", "w"}]}], "\[IndentingNewLine]", RowBox[{"MatrixForm", "[", "v", "]"}]}], "Input", CellChangeTimes->{{3.618751142297217*^9, 3.6187511704166927`*^9}, { 3.61888090461197*^9, 3.618880918967786*^9}, {3.6188809490295477`*^9, 3.618880949235373*^9}, {3.6889203022540197`*^9, 3.688920342588678*^9}, { 3.689788592724162*^9, 3.689788644563632*^9}}, Background->RGBColor[0.87, 0.94, 1]], Cell[TextData[{ "For square matrices, we can compute the power of a matrix ", Cell[BoxData[ FormBox[ SuperscriptBox["A", "n"], TraditionalForm]]], " using the command ", StyleBox["MatrixPower[matrix, power]", FontWeight->"Bold"] }], "Text", CellChangeTimes->{{3.6187536227169323`*^9, 3.61875366160083*^9}, { 3.6187537033656054`*^9, 3.6187537327897778`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"B", "=", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "1"}], "}"}]}], "}"}]}], ";", " ", RowBox[{"MatrixPower", "[", RowBox[{"B", ",", "2"}], "]"}]}]], "Input", CellChangeTimes->{{3.618753664502377*^9, 3.618753688392681*^9}, { 3.618753744938005*^9, 3.618753768477441*^9}}, Background->RGBColor[0.87, 0.94, 1]], Cell[TextData[{ "To access the element on row i and column j of matrix A, we use ", StyleBox["A[[i, j]] ", FontWeight->"Bold"], "or ", StyleBox["A[[ i ]] [[ j ]]", FontWeight->"Bold"], "." }], "Text", CellChangeTimes->{{3.688932392026164*^9, 3.688932473037099*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"B", "[", RowBox[{"[", RowBox[{"2", ",", "1"}], "]"}], "]"}], "=", "10"}], ";"}], "\[IndentingNewLine]", RowBox[{"MatrixForm", "[", "B", "]"}]}], "Input", CellChangeTimes->{{3.688932501907317*^9, 3.688932521462216*^9}}, Background->RGBColor[0.87, 0.94, 1]] }, Open ]], Cell[CellGroupData[{ Cell["Linear Algebra - Eigenvectors and Eigenvalues", "Subsection", CellChangeTimes->{{3.688924476117079*^9, 3.6889244969411507`*^9}, { 3.688925266268701*^9, 3.688925274747867*^9}}], Cell[TextData[{ "The function ", StyleBox["Eigenvalues[A]", FontWeight->"Bold"], " returns a list with the eigenvalues of the square matrix A. The function \ ", StyleBox["Eigensystem[A]", FontWeight->"Bold"], " finds both the eigenvalues and a complete linearly independent set of \ eigenvectors for each eigenvalue.The output is given in the form ", StyleBox["{list of eigenvalues, list of eigenvectors}", FontWeight->"Bold"], ". If the geometric multiplicity of an eigenvalue is less than its algebraic \ multiplicity, then the list of eigenvectors is completed with 0 vectors. " }], "Text", CellChangeTimes->{{3.688924083925561*^9, 3.688924196719234*^9}, { 3.688924700008912*^9, 3.6889247007756233`*^9}, 3.6889256525488987`*^9, { 3.6898195648444357`*^9, 3.6898195691235733`*^9}}, TextJustification->0.75], Cell[TextData[{ "Consider an nxn matrix A. The Jordan Decomposition Theorem says there \ exists an invertible matrix S such that ", Cell[BoxData[ FormBox[ RowBox[{ RowBox[{ SuperscriptBox["S", RowBox[{"-", "1"}]], "A", " ", "S"}], "=", "J"}], TraditionalForm]]], " , where J is called the Jordan canonical form of A (J is an upper \ triangular matrix whose diagonal entries are the eigenvalues of A, and \ immediately above the diagonal some entries are equal to 1). The function ", StyleBox["JordanDecomposition[A]", FontWeight->"Bold"], " returns a list of the form {S, J}, where J is the Jordan canonical form of \ A. S is one choice of matrix satisfying ", Cell[BoxData[ FormBox[ RowBox[{ RowBox[{ SuperscriptBox["S", RowBox[{"-", "1"}]], "A", " ", "S"}], "=", "J"}], TraditionalForm]]], ", although it\[CloseCurlyQuote]s not the usually the one that we would get \ when doing the computations by hand." }], "Text", CellChangeTimes->{{3.688927205253468*^9, 3.6889272836828117`*^9}, { 3.688927383371907*^9, 3.688927502237399*^9}, 3.688927543247259*^9, { 3.688927688499289*^9, 3.688927690849292*^9}, {3.688927927852591*^9, 3.688927962677896*^9}, {3.688927996794561*^9, 3.688928267365918*^9}, { 3.689789922044322*^9, 3.68978995092348*^9}, {3.689790174130645*^9, 3.689790289638935*^9}}] }, Open ]], Cell[CellGroupData[{ Cell["The Matrix Exponential ", "Subsection", CellChangeTimes->{{3.6897909843405523`*^9, 3.6897910028431387`*^9}}], Cell[TextData[{ "Given any matrix A, we can compute the matrix exponential ", Cell[BoxData[ FormBox[ SuperscriptBox["e", "At"], TraditionalForm]]], "by using the Mathematica command ", StyleBox["MatrixExp[A*t]", FontWeight->"Bold"], ". If ", Cell[BoxData[ FormBox[ RowBox[{ RowBox[{ SuperscriptBox["S", RowBox[{"-", "1"}]], "A", " ", "S"}], "=", "J"}], TraditionalForm]]], ", where J is the Jordan canonical form of A, then ", Cell[BoxData[ FormBox[ RowBox[{ SuperscriptBox["e", "At"], "=", " ", RowBox[{ SuperscriptBox["Se", "Jt"], SuperscriptBox["S", RowBox[{"-", "1"}]]}]}], TraditionalForm]]], ". We can test this relation for our previous example." }], "Text", CellChangeTimes->{{3.689791010206719*^9, 3.689791044368814*^9}, { 3.689791227795026*^9, 3.6897913713795033`*^9}, {3.6897914476538143`*^9, 3.689791506567998*^9}, {3.689791650604085*^9, 3.689791650604123*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{"M", " ", "=", " ", TagBox[ RowBox[{"(", GridBox[{ {"2", "0", "1"}, {"0", "1", RowBox[{"-", "1"}]}, { RowBox[{"-", "1"}], "0", "0"} }, GridBoxAlignment->{ "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}, "Items" -> {}, "ItemsIndexed" -> {}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.7]}, Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}, "RowsIndexed" -> {}, "Items" -> {}, "ItemsIndexed" -> {}}], ")"}], Function[BoxForm`e$, MatrixForm[BoxForm`e$]]]}], ";"}], "\[IndentingNewLine]", RowBox[{"Clear", "[", "t", "]"}], "\[IndentingNewLine]", RowBox[{"Print", "[", "\"\\"", "]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"MatrixExp", "[", RowBox[{"M", "*", "t"}], "]"}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{"Print", "[", "\"\\"", "]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"MatrixForm", "[", RowBox[{"MatrixExp", "[", RowBox[{"M", "*", "t"}], "]"}], "]"}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{"Print", "[", "\"\\"", "]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ RowBox[{"{", RowBox[{"S", ",", "J"}], "}"}], "=", RowBox[{"JordanDecomposition", "[", "M", "]"}]}], ";"}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{"Print", "[", "\"\\"", "]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"MatrixForm", "[", RowBox[{"MatrixExp", "[", RowBox[{"J", "*", "t"}], "]"}], "]"}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{"Print", "[", "\"\\"", "]"}], "\[IndentingNewLine]", RowBox[{"MatrixForm", "[", RowBox[{"S", ".", RowBox[{"MatrixExp", "[", RowBox[{"J", "*", "t"}], "]"}], ".", RowBox[{"Inverse", "[", "S", "]"}]}], "]"}]}], "Input", CellChangeTimes->{{3.689791432878594*^9, 3.6897914431188374`*^9}, { 3.6897914986874237`*^9, 3.6897915500187263`*^9}, {3.689791585003625*^9, 3.689792181645915*^9}, {3.6897922250813847`*^9, 3.689792296081506*^9}}, Background->RGBColor[0.87, 0.94, 1]], Cell[TextData[{ "We can now solve the system of differential equations ", StyleBox["x\[CloseCurlyQuote] = Mx", FontWeight->"Bold"], " using matrix exponential ", Cell[BoxData[ FormBox[ SuperscriptBox["e", "At"], TraditionalForm]]], ", or using a fundamental matrix given by ", Cell[BoxData[ RowBox[{" ", SuperscriptBox["Se", "Jt"]}]]], ". The general solution can be expressed as x(t)=", Cell[BoxData[ FormBox[ SuperscriptBox["e", "At"], TraditionalForm]]], "c, but also as x(t)=", Cell[BoxData[ SuperscriptBox["Se", "Jt"]]], "d, where the coefficients c and d are related by the equation d=", Cell[BoxData[ FormBox[ SuperscriptBox["S", RowBox[{"-", "1"}]], TraditionalForm]]], "c." }], "Text", CellChangeTimes->{{3.689791010206719*^9, 3.689791044368814*^9}, { 3.689791227795026*^9, 3.6897913713795033`*^9}, {3.6897914476538143`*^9, 3.689791506567998*^9}, {3.689791650604085*^9, 3.689791650604123*^9}, { 3.689822383344997*^9, 3.689822475909026*^9}, {3.689822522419786*^9, 3.689822640471628*^9}, {3.68982282245063*^9, 3.689822823265584*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"Clear", "[", RowBox[{"c", ",", "d", ",", "t"}], "]"}], ";"}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{"Print", "[", "\"\\"", "]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"c", "=", RowBox[{"{", RowBox[{"c1", ",", "c2", ",", "c3"}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"sol", "=", RowBox[{"MatrixExp", "[", RowBox[{ RowBox[{"M", "*", "t"}], ",", "c"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"MatrixForm", "[", "sol", "]"}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"d", "=", RowBox[{"{", RowBox[{"d1", ",", " ", "d2", ",", " ", "d3"}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"sol", "=", RowBox[{"S", ".", RowBox[{"MatrixExp", "[", RowBox[{"J", "*", "t"}], "]"}], ".", "d"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"MatrixForm", "[", "sol", "]"}]}], "Input", CellChangeTimes->{{3.68982248164843*^9, 3.689822500628714*^9}, { 3.6898226499281*^9, 3.6898227979465313`*^9}, {3.68982284207588*^9, 3.689822886551649*^9}, {3.6898233100102577`*^9, 3.689823422132914*^9}}, Background->RGBColor[0.87, 0.94, 1]] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Nonhomogeneous Systems of first order differential equations in Mathematica\ \>", "Subsection", CellChangeTimes->{{3.6889287158666983`*^9, 3.688928754094119*^9}, { 3.6897926039157867`*^9, 3.689792606738779*^9}, {3.689828364742902*^9, 3.689828386215064*^9}}], Cell[TextData[{ "We can use the method of Variation of Parameters to solve a nonhomogeneous \ system of the form x\[CloseCurlyQuote]=Ax+f(t). A particular solution is \ given by x(t)=", Cell[BoxData[ FormBox[ RowBox[{ RowBox[{ SuperscriptBox["e", "At"], RowBox[{"\[Integral]", RowBox[{ SuperscriptBox["e", RowBox[{"-", "At"}]], RowBox[{"f", "(", "t", ")"}], "dt"}]}]}], "=", RowBox[{ RowBox[{"\[Phi]", "(", "t", ")"}], RowBox[{"\[Integral]", RowBox[{ SuperscriptBox[ RowBox[{"\[Phi]", "(", "t", ")"}], RowBox[{"-", "1"}]], RowBox[{"f", "(", "t", ")"}], "dt"}]}]}]}], TraditionalForm]], FormatType->"TraditionalForm"], ", where \[Phi](t) is any fundamental matrix of the homogeneous system x\ \[CloseCurlyQuote]=Ax, and the integral denotes an antiderivative. This \ computation can be automated in Mathematica using the command ", StyleBox["Integrate[f], ", FontWeight->"Bold"], "which returns an antiderivative of f." }], "Text", CellChangeTimes->{{3.689828390507666*^9, 3.6898286602468576`*^9}, { 3.689828874280327*^9, 3.689828905712068*^9}, {3.6898293172851753`*^9, 3.689829410725569*^9}}], Cell["\<\ Consider the system x' = A x + f (t), where A and f(t) are given below:\ \>", "Text", CellChangeTimes->{{3.689828741096727*^9, 3.68982881999695*^9}, { 3.68982945963944*^9, 3.689829486112463*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{"A", " ", "=", " ", TagBox[ RowBox[{"(", GridBox[{ {"2", "1", "0"}, {"0", "2", "0"}, {"0", "0", "5"} }, GridBoxAlignment->{ "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}, "Items" -> {}, "ItemsIndexed" -> {}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.7]}, Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}, "RowsIndexed" -> {}, "Items" -> {}, "ItemsIndexed" -> {}}], ")"}], Function[BoxForm`e$, MatrixForm[BoxForm`e$]]]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"f", "[", "z_", "]"}], ":=", RowBox[{"{", RowBox[{ RowBox[{"Sin", "[", "z", "]"}], ",", "3", ",", RowBox[{"2", "z"}]}], "}"}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"sol", "=", RowBox[{ RowBox[{"MatrixExp", "[", RowBox[{"A", "*", "t"}], "]"}], ".", RowBox[{"(", RowBox[{"Integrate", "[", RowBox[{ RowBox[{ RowBox[{"MatrixExp", "[", RowBox[{ RowBox[{"-", "A"}], "*", "t"}], "]"}], ".", RowBox[{"f", "[", "t", "]"}]}], ",", "t"}], "]"}], ")"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{"MatrixForm", "[", "sol", "]"}]}], "Input", CellChangeTimes->{{3.689828967820573*^9, 3.689829165475945*^9}, { 3.6898292430909557`*^9, 3.689829275598803*^9}, {3.689829426687179*^9, 3.6898294578794394`*^9}, {3.6898294950660057`*^9, 3.68982958882307*^9}}, Background->RGBColor[0.87, 0.94, 1]] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Systems of homegeneous first order differential equations in Mathematica\ \>", "Subsection", CellChangeTimes->{{3.6889287158666983`*^9, 3.688928754094119*^9}, { 3.6897926039157867`*^9, 3.689792606738779*^9}}], Cell[TextData[{ "There are several ways to Solve linear homogeneous systems in Mathematica, \ and we have already seen one above, using matrix exponentials and fundamental \ matrices. Another way is to use the function ", StyleBox["DSolve[..]", FontWeight->"Bold"] }], "Text", CellChangeTimes->{{3.689822911089891*^9, 3.68982306716365*^9}, { 3.689823656115419*^9, 3.6898236567621927`*^9}}] }, Open ]], Cell[CellGroupData[{ Cell["DSolve", "Subsection", CellChangeTimes->{{3.622986243655888*^9, 3.622986245135376*^9}}], Cell[TextData[{ StyleBox["DSolve[eqn,y,x]", FontWeight->"Bold", FontColor->GrayLevel[0]], "\nsolves a differential equation for the function y, with independent \ variable\[NonBreakingSpace]x.\n", StyleBox["DSolve[{eqn1,eqn2,\[Ellipsis]},{y1,y2,\[Ellipsis]},\[Ellipsis]]", FontWeight->"Bold", FontColor->GrayLevel[0]], "\nsolves a list of differential equations for y1, y2, ... ." }], "Text", CellChangeTimes->{{3.62279315990394*^9, 3.622793181075354*^9}, { 3.622793284298519*^9, 3.6227933050293694`*^9}, 3.622793355472322*^9, { 3.622975874472082*^9, 3.622975922490847*^9}, {3.689826153314043*^9, 3.689826153936865*^9}}], Cell[TextData[{ ButtonBox["DSolve", BaseStyle->"Hyperlink", ButtonData->{ FrontEnd`FileName[{"language", "ref"}, "DSolve.html?q=DSolve", CharacterEncoding -> "UTF-8"], None}], " returns results as lists of rules. This makes it possible to return \ multiple solutions to an equation. For a system of equations, possibly \ multiple solution sets are grouped together inside curly brackets { }. You \ can use the rules to substitute the solutions into other calculations." }], "Text", CellChangeTimes->{{3.622975685875296*^9, 3.622975706029318*^9}, { 3.6229757423730907`*^9, 3.6229757704722233`*^9}, {3.622983982863151*^9, 3.622983988615279*^9}}, TextJustification->1.], Cell[BoxData[{ RowBox[{"Clear", "[", RowBox[{"x", ",", "y", ",", "z", ",", "t"}], "]"}], "\[IndentingNewLine]", RowBox[{"Print", "[", "\"\\"", "]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"sol", "=", RowBox[{"DSolve", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{ RowBox[{"x", "'"}], "[", "t", "]"}], "\[Equal]", RowBox[{ RowBox[{"x", "[", "t", "]"}], "+", RowBox[{"y", "[", "t", "]"}]}]}], ",", " ", RowBox[{ RowBox[{ RowBox[{"y", "'"}], "[", "t", "]"}], "\[Equal]", RowBox[{ RowBox[{"4", RowBox[{"x", "[", "t", "]"}]}], "+", RowBox[{"y", "[", "t", "]"}]}]}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"x", "[", "t", "]"}], ",", RowBox[{"y", "[", "t", "]"}]}], "}"}], ",", "t"}], "]"}]}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{"Print", "[", "\"\\"", "]"}], "\[IndentingNewLine]", RowBox[{"solivp", "=", RowBox[{"DSolve", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{ RowBox[{"x", "'"}], "[", "t", "]"}], "\[Equal]", RowBox[{ RowBox[{"x", "[", "t", "]"}], "+", RowBox[{"y", "[", "t", "]"}]}]}], ",", " ", RowBox[{ RowBox[{ RowBox[{"y", "'"}], "[", "t", "]"}], "\[Equal]", RowBox[{ RowBox[{"4", RowBox[{"x", "[", "t", "]"}]}], "+", RowBox[{"y", "[", "t", "]"}]}]}], ",", RowBox[{ RowBox[{"x", "[", "0", "]"}], "\[Equal]", "2"}], ",", RowBox[{ RowBox[{"y", "[", "0", "]"}], "\[Equal]", "0"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"x", "[", "t", "]"}], ",", RowBox[{"y", "[", "t", "]"}]}], "}"}], ",", "t"}], "]"}]}]}], "Input", CellChangeTimes->{{3.688931049046969*^9, 3.688931049048181*^9}, { 3.688931082675045*^9, 3.6889310903622513`*^9}, {3.689823671724051*^9, 3.6898237159652243`*^9}, {3.689823769207115*^9, 3.6898238087667522`*^9}, { 3.689823905915024*^9, 3.689823935147685*^9}, {3.689824041481903*^9, 3.689824164875812*^9}}, Background->RGBColor[0.87, 0.94, 1]], Cell[TextData[{ "The solution is given as a transformation rule x[t] -> function1, y[t] -> \ function2. To use x[t] and y[t] in later computations, for instance to plot \ the solution of the initial value problem, we use the ", StyleBox["replacement operator /. ", FontWeight->"Bold"] }], "Text", CellChangeTimes->{{3.689824185922186*^9, 3.689824231469427*^9}, { 3.689824352530335*^9, 3.689824442195472*^9}}], Cell[BoxData[ RowBox[{"ParametricPlot", "[", RowBox[{ RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"x", "[", "t", "]"}], ",", RowBox[{"y", "[", "t", "]"}]}], "}"}], " ", "/.", " ", "solivp"}], ",", RowBox[{"{", RowBox[{"t", ",", RowBox[{"-", "2"}], ",", "1"}], "}"}]}], "]"}]], "Input", CellChangeTimes->{{3.689824308305229*^9, 3.689824337552919*^9}}, Background->RGBColor[0.87, 0.94, 1]] }, Open ]], Cell[CellGroupData[{ Cell["Generalized Eigenvectors", "Subsection", CellChangeTimes->{{3.68982356495266*^9, 3.6898235814584503`*^9}, { 3.689826015573935*^9, 3.6898260158106337`*^9}}], Cell["\<\ We can also use Mathematica to solve the system the classical way, by \ Analyzing the eigenvalues of the coefficient matrix, finding a complete set \ of linearly independent eigenvectors and generalized eigenvectors, and \ writing the general solution of the system as a combination of linearly \ independent solutions. This method is outlined below.\ \>", "Text", CellChangeTimes->{{3.6898230793251877`*^9, 3.689823126133443*^9}}], Cell[TextData[{ "Let\[CloseCurlyQuote]s consider the system x\[CloseCurlyQuote]=Mx whose \ coefficient matrix of the system is exactly the matrix M from the section \ above. The matrix has a repeated eigenvalue 1, with algebraic multiplicity 3, \ and geometric multiplicity 1. We have one linearly independent eigenvector \ v1={0,1,0}, as we discover by using the command ", StyleBox["Eigensystem[..]", FontWeight->"Bold"] }], "Text", CellChangeTimes->{{3.6889312795681667`*^9, 3.6889312960039177`*^9}, { 3.689792465984823*^9, 3.6897925190905743`*^9}, {3.689823860889312*^9, 3.689823872576576*^9}, {3.689826025098405*^9, 3.6898260465069847`*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{"M", " ", "=", " ", TagBox[ RowBox[{"(", GridBox[{ {"2", "0", "1"}, {"0", "1", RowBox[{"-", "1"}]}, { RowBox[{"-", "1"}], "0", "0"} }, GridBoxAlignment->{ "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}, "Items" -> {}, "ItemsIndexed" -> {}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.7]}, Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}, "RowsIndexed" -> {}, "Items" -> {}, "ItemsIndexed" -> {}}], ")"}], Function[BoxForm`e$, MatrixForm[BoxForm`e$]]]}], ";"}], "\[IndentingNewLine]", RowBox[{"e", "=", RowBox[{"Eigensystem", "[", "M", "]"}]}], "\[IndentingNewLine]", RowBox[{"v1", "=", " ", RowBox[{ RowBox[{"e", "[", RowBox[{"[", "2", "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], " ", RowBox[{"(*", " ", RowBox[{"the", " ", "only", " ", "eigenvector"}], " ", "*)"}]}]}], "Input",\ CellChangeTimes->{{3.688931157184304*^9, 3.688931157185691*^9}, { 3.688932888395514*^9, 3.688932889381357*^9}, {3.688933251611136*^9, 3.688933252121306*^9}, {3.6889334136145372`*^9, 3.688933419660918*^9}, { 3.6889334864145823`*^9, 3.688933580998559*^9}, {3.688933749723297*^9, 3.6889337924111643`*^9}, {3.689823145718354*^9, 3.689823154926712*^9}}, Background->RGBColor[0.87, 0.94, 1]], Cell[BoxData[ RowBox[{"MatrixForm", "[", RowBox[{ RowBox[{"JordanDecomposition", "[", "M", "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], "]"}]], "Input", CellChangeTimes->{{3.688933328702466*^9, 3.688933346594761*^9}, { 3.6897900408558807`*^9, 3.6897901458021173`*^9}, {3.689823183342824*^9, 3.689823197486251*^9}}, Background->RGBColor[0.87, 0.94, 1]], Cell[TextData[{ "The matrix has a repeated eigenvalue 1, with algebraic multiplicity 3, and \ geometric multiplicity 1. We have one linearly independent eigenvector \ v1={0,1,0}. We need two more generalized eigenvectors. We can use the command \ ", StyleBox["Solve[equation, variables] ", FontWeight->"Bold"], "to solve the two equations (M-\[Lambda]", Cell[BoxData[ FormBox[ RowBox[{ RowBox[{ RowBox[{ SubscriptBox["I", "3"], ")"}], SubscriptBox["v", "2"]}], "="}], TraditionalForm]], FormatType->"TraditionalForm"], Cell[BoxData[ FormBox[ SubscriptBox["v", "1"], TraditionalForm]]], "and (M-\[Lambda]", Cell[BoxData[ FormBox[ RowBox[{ RowBox[{ RowBox[{ SubscriptBox["I", "3"], ")"}], SubscriptBox["v", "3"]}], "="}], TraditionalForm]], FormatType->"TraditionalForm"], Cell[BoxData[ FormBox[ SubscriptBox["v", "2"], TraditionalForm]]], "." }], "Text", CellChangeTimes->{{3.6889329046305447`*^9, 3.688932945605278*^9}, { 3.688933272714837*^9, 3.688933273202867*^9}, {3.688933699146768*^9, 3.688933742321718*^9}, {3.68893403244392*^9, 3.688934042299223*^9}, 3.689820154096171*^9, {3.689820234219056*^9, 3.689820291411901*^9}, { 3.689820401055675*^9, 3.689820501262196*^9}}], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{"Clear", "[", RowBox[{"v2", ",", "x"}], "]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"v2", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"x", "[", "j", "]"}], ",", RowBox[{"{", RowBox[{"j", ",", "3"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"Solve", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"M", "-", RowBox[{"IdentityMatrix", "[", "3", "]"}]}], ")"}], ".", "v2"}], "\[Equal]", "v1"}], ",", "v2"}], "]"}]}], "Input", CellChangeTimes->{{3.68893386414534*^9, 3.688933924374187*^9}}, Background->RGBColor[0.87, 0.94, 1]], Cell[BoxData[ RowBox[{"{", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"x", "[", "1", "]"}], "\[Rule]", "1"}], ",", RowBox[{ RowBox[{"x", "[", "3", "]"}], "\[Rule]", RowBox[{"-", "1"}]}]}], "}"}], "}"}]], "Output", CellChangeTimes->{{3.688933880902235*^9, 3.688933925161709*^9}, 3.68982017156139*^9}] }, Open ]], Cell["\<\ Therefore v2 has the form v2 ={x[1],x[2],x[3]}={1, x[2], -1} = x[2]*v1 + {1, \ 0, -1}. We can pick v2 to be {1, 0, -1}.\ \>", "Text", CellChangeTimes->{{3.688933930361717*^9, 3.688934009940836*^9}, { 3.689820553763015*^9, 3.689820568155827*^9}}], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"v2", "=", RowBox[{"{", RowBox[{"1", ",", "0", ",", RowBox[{"-", "1"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"Clear", "[", RowBox[{"v3", ",", "x"}], "]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"v3", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"x", "[", "j", "]"}], ",", RowBox[{"{", RowBox[{"j", ",", "3"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"Solve", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"M", "-", RowBox[{"IdentityMatrix", "[", "3", "]"}]}], ")"}], ".", "v3"}], "\[Equal]", "v2"}], ",", "v3"}], "]"}]}], "Input", CellChangeTimes->{{3.688934002593453*^9, 3.6889340035371227`*^9}, { 3.688934245482767*^9, 3.688934267819249*^9}}, Background->RGBColor[0.87, 0.94, 1]], Cell[BoxData[ RowBox[{"{", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"x", "[", "1", "]"}], "\[Rule]", "1"}], ",", RowBox[{ RowBox[{"x", "[", "3", "]"}], "\[Rule]", "0"}]}], "}"}], "}"}]], "Output",\ CellChangeTimes->{{3.688934262744965*^9, 3.688934268728889*^9}, 3.6898201968069973`*^9}] }, Open ]], Cell["\<\ Therefore v3 has the form v3 = {1, x[2], 0} = x[2]*v1 + {1, 0, 0}. We can \ pick v3 to be {1, 0, 0}.\ \>", "Text", CellChangeTimes->{{3.688933930361717*^9, 3.688934009940836*^9}, { 3.688934286747632*^9, 3.688934309650769*^9}}], Cell["\<\ A complete set of linearly independent eigenvectors and generalized \ eigenvectors is :\ \>", "Text", CellChangeTimes->{{3.689820848205162*^9, 3.6898208871944523`*^9}}], Cell[BoxData[{ RowBox[{"v1", "=", RowBox[{"{", RowBox[{"0", ",", "1", ",", "0"}], "}"}]}], "\[IndentingNewLine]", RowBox[{"v2", "=", RowBox[{"{", RowBox[{"1", ",", "0", ",", RowBox[{"-", "1"}]}], "}"}]}], "\[IndentingNewLine]", RowBox[{"v3", "=", RowBox[{"{", RowBox[{"1", ",", "0", ",", "0"}], "}"}]}]}], "Input", CellChangeTimes->{{3.688934431161318*^9, 3.688934457145814*^9}, { 3.689820606442194*^9, 3.6898206929826183`*^9}}, Background->RGBColor[0.87, 0.94, 1]] }, Open ]], Cell[CellGroupData[{ Cell["StreamPlot and Phase Portraits", "Subsection", CellChangeTimes->{{3.622982848170567*^9, 3.6229828667141848`*^9}, { 3.6898245717121687`*^9, 3.6898246015361843`*^9}}], Cell[TextData[{ "As before, we can visualize the phase portraits of systems of differential \ equations using the command ", StyleBox["StreamPlot[..]. ", FontWeight->"Bold"], "To plot the phase portrait of the system x\[CloseCurlyQuote]=x+y, y\ \[CloseCurlyQuote]=y, we write:" }], "Text", CellChangeTimes->{{3.689824583878503*^9, 3.689824695678845*^9}}], Cell[BoxData[ RowBox[{"StreamPlot", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"x", "+", "y"}], ",", "y"}], "}"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{"-", "5"}], ",", "5"}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", RowBox[{"-", "5"}], ",", "5"}], "}"}], ",", RowBox[{"StreamScale", "\[Rule]", "Automatic"}], ",", RowBox[{"StreamPoints", "\[Rule]", RowBox[{"{", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "1"}], "}"}], ",", "Red"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "1"}], "}"}], ",", "Green"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "3"}], ",", "2"}], "}"}], ",", "Orange"}], "}"}], ",", "Automatic"}], "}"}], "}"}]}]}], "]"}]], "Input", CellChangeTimes->{{3.62276968948569*^9, 3.622769690093495*^9}, { 3.622769880915023*^9, 3.6227698946364*^9}, {3.622776734529896*^9, 3.622776742090095*^9}}, FontSize->14, Background->RGBColor[0.87, 0.94, 1]], Cell["Another system: x\[CloseCurlyQuote]=y, y\[CloseCurlyQuote]=-x", "Text", CellChangeTimes->{{3.6898250939985037`*^9, 3.689825119479184*^9}}], Cell[BoxData[ RowBox[{"StreamPlot", "[", RowBox[{ RowBox[{"{", RowBox[{"y", ",", RowBox[{"-", "x"}]}], "}"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{"-", "5"}], ",", "5"}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", RowBox[{"-", "5"}], ",", "5"}], "}"}], ",", RowBox[{"StreamScale", "\[Rule]", "Automatic"}], ",", RowBox[{"StreamPoints", "\[Rule]", RowBox[{"{", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "1"}], "}"}], ",", "Red"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "1"}], "}"}], ",", "Green"}], "}"}], ",", "Automatic"}], "}"}], "}"}]}]}], "]"}]], "Input", CellChangeTimes->{{3.622769839832032*^9, 3.6227698454783173`*^9}}, FontSize->14, Background->RGBColor[0.87, 0.94, 1]] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Interactive plot of the vector field of various systems of linear \ differential equations, using StreamPlot[..] and Manipulate[..]\ \>", "Subsection", CellChangeTimes->{{3.622798789879664*^9, 3.622798845551744*^9}, { 3.6898249669990263`*^9, 3.689824985671026*^9}}], Cell["\<\ This plot shows the various types of stability of the unique equilibrium \ point of a 2x2 system x\[CloseCurlyQuote]=mx, defined by a 2x2 matrix m.\ \>", "Text", CellChangeTimes->{{3.6898251308491373`*^9, 3.689825216136579*^9}}], Cell[BoxData[ RowBox[{"Manipulate", "[", RowBox[{ RowBox[{"Row", "[", RowBox[{"{", RowBox[{ RowBox[{"Column", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Text", "[", "\"\\"", "]"}], ",", RowBox[{"MatrixForm", "[", "m", "]"}], ",", RowBox[{"Text", "[", "\"\\"", "]"}], ",", " ", RowBox[{"N", "[", RowBox[{"Eigenvalues", "[", "m", "]"}], "]"}]}], "}"}], ",", " ", RowBox[{"Spacings", "\[Rule]", "2"}]}], "]"}], ",", " ", RowBox[{"StreamPlot", "[", RowBox[{ RowBox[{"m", ".", RowBox[{"{", RowBox[{"x", ",", "y"}], "}"}]}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{"-", "1"}], ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", RowBox[{"-", "1"}], ",", "1"}], "}"}], ",", RowBox[{"StreamScale", "\[Rule]", "Large"}], ",", RowBox[{"StreamColorFunction", "\[Rule]", "\"\\""}], ",", RowBox[{"ImageSize", "\[Rule]", "Large"}]}], "]"}]}], "}"}], "\[IndentingNewLine]", "]"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"m", ",", RowBox[{"(", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "2"}], "}"}]}], "}"}], ")"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "2"}], "}"}]}], "}"}], ")"}], "\[Rule]", "\"\\""}], ",", RowBox[{ RowBox[{"(", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "1"}], "}"}]}], "}"}], ")"}], "\[Rule]", "\"\\""}], ",", RowBox[{ RowBox[{"(", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "1"}], "}"}]}], "}"}], ")"}], "\[Rule]", "\"\\""}], ",", RowBox[{ RowBox[{"(", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", RowBox[{"-", "1"}]}], "}"}]}], "}"}], ")"}], "\[Rule]", "\"\\""}], ",", RowBox[{ RowBox[{"(", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", RowBox[{"-", "2"}]}], "}"}]}], "}"}], ")"}], "\[Rule]", "\"\\""}], ",", RowBox[{ RowBox[{"(", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", RowBox[{"-", "1"}]}], "}"}]}], "}"}], ")"}], "\[Rule]", "\"\\""}], ",", RowBox[{ RowBox[{"(", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", RowBox[{"-", "1"}]}], "}"}]}], "}"}], ")"}], "\[Rule]", "\"\\""}], ",", RowBox[{ RowBox[{"(", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "0"}], "}"}]}], "}"}], ")"}], "\[Rule]", "\"\\""}], ",", RowBox[{ RowBox[{"(", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", RowBox[{"-", "2"}]}], "}"}]}], "}"}], ")"}], "\[Rule]", "\"\\""}]}], "}"}]}], "\[IndentingNewLine]", "}"}]}], "\[IndentingNewLine]", "]"}]], "Input", CellChangeTimes->{{3.6227978003575974`*^9, 3.622797800358923*^9}, { 3.6228088899258833`*^9, 3.622808896869586*^9}, {3.622808931099204*^9, 3.6228090422874107`*^9}, {3.62280908417439*^9, 3.62280910126234*^9}, { 3.6228091652398977`*^9, 3.6228091758856287`*^9}, {3.622809420458909*^9, 3.622809443850986*^9}, {3.622809480241043*^9, 3.62280949164086*^9}, { 3.622809538458753*^9, 3.622809574482749*^9}, {3.622809619858317*^9, 3.622809622491767*^9}, {3.622983296591627*^9, 3.622983304161804*^9}, { 3.6229865872264767`*^9, 3.6229865920381413`*^9}, {3.689824912278017*^9, 3.689824920326722*^9}}, FontSize->12, Background->RGBColor[0.87, 0.94, 1]] }, Open ]], Cell[CellGroupData[{ Cell["Visualize Bifurcations using Manipulate[..]:", "Subsection", CellChangeTimes->{{3.689825014332453*^9, 3.6898250505093412`*^9}}], Cell["\<\ Consider a system of differential equations which depends on a real parameter \ \[Alpha], say \ \>", "Text", CellChangeTimes->{{3.68982522378721*^9, 3.68982524548991*^9}, { 3.689825295781877*^9, 3.689825307490951*^9}, {3.689825436399432*^9, 3.6898254402315187`*^9}, {3.6898259023998203`*^9, 3.689825903193434*^9}}] }, Open ]], Cell[CellGroupData[{ Cell[TextData[{ " ", Cell[BoxData[ FormBox[ TagBox[GridBox[{ {"\[Piecewise]", GridBox[{ { RowBox[{ RowBox[{"x", "'"}], "=", RowBox[{ RowBox[{"-", "x"}], "+", RowBox[{"\[Alpha]", "*", "y"}]}]}], RowBox[{"(", "1", ")"}]}, { RowBox[{ RowBox[{"y", "'"}], "=", RowBox[{ RowBox[{"-", "x"}], "-", "y"}]}], RowBox[{"(", "2", ")"}]} }, AllowedDimensions->{2, Automatic}, Editable->True, GridBoxAlignment->{ "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}}, GridBoxItemSize->{ "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.84]}, Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}, "RowsIndexed" -> {}}, Selectable->True]} }, GridBoxAlignment->{ "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}}, GridBoxItemSize->{ "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.35]}, Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}, "RowsIndexed" -> {}}], "Piecewise", DeleteWithContents->True, Editable->False, SelectWithContents->True, Selectable->False], TraditionalForm]]] }], "Subsection", CellChangeTimes->{{3.6227922426259937`*^9, 3.62279231309624*^9}, { 3.6227927369105253`*^9, 3.622792744486435*^9}, {3.622805954711268*^9, 3.6228060525702353`*^9}, {3.622815694267383*^9, 3.6228156945063753`*^9}, { 3.622973160147009*^9, 3.622973167010988*^9}, {3.622973244164934*^9, 3.6229732511893044`*^9}, {3.6898252695460663`*^9, 3.689825283906603*^9}, { 3.689825314139711*^9, 3.68982531754354*^9}, {3.689825890187739*^9, 3.689825898277431*^9}, {3.689825939722395*^9, 3.6898259423865213`*^9}}], Cell[TextData[{ "To see how the system changes when we change the parameter \[Alpha] in the \ interval [-4,4], we use the command \n", StyleBox["Manipulate[Plotting-Function-which-depends-on-parameter-\[Alpha], \ {\[Alpha],-4,4}]", FontWeight->"Bold"] }], "Text", CellChangeTimes->{{3.689825322006008*^9, 3.6898254610723257`*^9}, { 3.689825908474187*^9, 3.689825932551878*^9}}], Cell[BoxData[ RowBox[{"Manipulate", "[", " ", "\[IndentingNewLine]", RowBox[{ RowBox[{"StreamPlot", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"-", "x"}], "+", RowBox[{"\[Alpha]", "*", "y"}]}], ",", RowBox[{ RowBox[{"-", "x"}], "-", "y"}]}], "}"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{"-", "3"}], ",", "3"}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", RowBox[{"-", "3"}], ",", "3"}], "}"}], ",", RowBox[{"StreamScale", "\[Rule]", "Large"}], ",", RowBox[{"StreamColorFunction", "\[Rule]", "\"\\""}], ",", RowBox[{"ImageSize", "\[Rule]", "Large"}]}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"\[Alpha]", ",", RowBox[{"-", "4"}], ",", "4"}], "}"}]}], "]"}]], "Input", CellChangeTimes->{{3.689825817134838*^9, 3.689825830781152*^9}}, Background->RGBColor[0.87, 0.94, 1]], Cell["\<\ We do the same thing, but plotting the eigenvalues of the matrix, together \ with the Phase Portrait.\ \>", "Text", CellChangeTimes->{{3.689825854628786*^9, 3.689825884781221*^9}}], Cell[BoxData[ RowBox[{"Manipulate", "[", RowBox[{ RowBox[{"Row", "[", RowBox[{"{", RowBox[{ RowBox[{"Column", "[", RowBox[{"{", RowBox[{ RowBox[{"Text", "[", "\"\\"", "]"}], ",", " ", RowBox[{"N", "[", RowBox[{"Eigenvalues", "[", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "\[Alpha]"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", RowBox[{"-", "1"}]}], "}"}]}], "}"}], "]"}], "]"}]}], "}"}], "]"}], ",", " ", RowBox[{"StreamPlot", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"-", "x"}], "+", RowBox[{"\[Alpha]", "*", "y"}]}], ",", RowBox[{ RowBox[{"-", "x"}], "-", "y"}]}], "}"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{"-", "3"}], ",", "3"}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", RowBox[{"-", "3"}], ",", "3"}], "}"}], ",", RowBox[{"StreamScale", "\[Rule]", "Large"}], ",", RowBox[{"StreamColorFunction", "\[Rule]", "\"\\""}], ",", RowBox[{"ImageSize", "\[Rule]", "Large"}]}], "]"}]}], "}"}], "]"}], ",", RowBox[{"{", RowBox[{"\[Alpha]", ",", RowBox[{"-", "4"}], ",", "4"}], "}"}]}], "]"}]], "Input", Background->RGBColor[0.87, 0.94, 1]] }, Open ]] }, WindowSize->{919, 606}, WindowMargins->{{54, Automatic}, {Automatic, 45}}, FrontEndVersion->"10.4 for Mac OS X x86 (32-bit, 64-bit Kernel) (February 25, \ 2016)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[580, 22, 157, 2, 44, "Subsection"], Cell[740, 26, 611, 10, 87, "Text"], Cell[1354, 38, 837, 24, 135, "Input"], Cell[2194, 64, 705, 15, 68, "Text"], Cell[2902, 81, 487, 10, 79, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[3426, 96, 212, 3, 44, "Subsection"], Cell[3641, 101, 476, 9, 68, "Text"], Cell[4120, 112, 866, 23, 96, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[5023, 140, 167, 2, 44, "Subsection"], Cell[5193, 144, 344, 6, 49, "Text"], Cell[5540, 152, 918, 23, 149, "Input"], Cell[6461, 177, 371, 10, 31, "Text"], Cell[6835, 189, 447, 13, 44, "Input"], Cell[7285, 204, 276, 9, 30, "Text"], Cell[7564, 215, 321, 9, 62, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[7922, 229, 184, 2, 44, "Subsection"], Cell[8109, 233, 828, 18, 87, "Text"], Cell[8940, 253, 1355, 30, 108, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[10332, 288, 115, 1, 44, "Subsection"], Cell[10450, 291, 948, 28, 51, "Text"], Cell[11401, 321, 2735, 69, 351, "Input"], Cell[14139, 392, 1094, 30, 72, "Text"], Cell[15236, 424, 1325, 38, 198, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[16598, 467, 273, 5, 44, "Subsection"], Cell[16874, 474, 1213, 32, 92, "Text"], Cell[18090, 508, 208, 4, 30, "Text"], Cell[18301, 514, 1677, 46, 135, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[20015, 565, 221, 4, 44, "Subsection"], Cell[20239, 571, 396, 8, 49, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[20672, 584, 94, 1, 44, "Subsection"], Cell[20769, 587, 643, 14, 87, "Text"], Cell[21415, 603, 689, 14, 68, "Text"], Cell[22107, 619, 2329, 64, 130, "Input"], Cell[24439, 685, 415, 8, 49, "Text"], Cell[24857, 695, 433, 13, 44, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[25327, 713, 164, 2, 44, "Subsection"], Cell[25494, 717, 442, 7, 68, "Text"], Cell[25939, 726, 656, 11, 68, "Text"], Cell[26598, 739, 1549, 39, 118, "Input"], Cell[28150, 780, 368, 8, 44, "Input"], Cell[28521, 790, 1266, 37, 70, "Text"], Cell[CellGroupData[{ Cell[29812, 831, 643, 19, 79, "Input"], Cell[30458, 852, 333, 10, 28, "Output"] }, Open ]], Cell[30806, 865, 258, 5, 30, "Text"], Cell[CellGroupData[{ Cell[31089, 874, 844, 25, 96, "Input"], Cell[31936, 901, 317, 10, 28, "Output"] }, Open ]], Cell[32268, 914, 239, 5, 30, "Text"], Cell[32510, 921, 179, 4, 30, "Text"], Cell[32692, 927, 500, 13, 79, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[33229, 945, 173, 2, 44, "Subsection"], Cell[33405, 949, 360, 8, 49, "Text"], Cell[33768, 959, 1160, 35, 64, "Input"], Cell[34931, 996, 145, 1, 30, "Text"], Cell[35079, 999, 902, 28, 64, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[36018, 1032, 278, 5, 69, "Subsection"], Cell[36299, 1039, 239, 4, 30, "Text"], Cell[36541, 1045, 5205, 147, 203, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[41783, 1197, 134, 1, 44, "Subsection"], Cell[41920, 1200, 330, 6, 30, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[42287, 1211, 2388, 63, 71, "Subsection"], Cell[44678, 1276, 385, 8, 49, "Text"], Cell[45066, 1286, 954, 26, 96, "Input"], Cell[46023, 1314, 191, 4, 30, "Text"], Cell[46217, 1320, 1525, 44, 96, "Input"] }, Open ]] } ] *)