(* Content-type: application/mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 6.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       145,          7]
NotebookDataLength[     65689,       1927]
NotebookOptionsPosition[     59743,       1760]
NotebookOutlinePosition[     60162,       1778]
CellTagsIndexPosition[     60119,       1775]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{
Cell[TextData[StyleBox["2301520 Fundamentals of AMCS\nDifferential Equations",
 FontWeight->"Bold",
 FontColor->RGBColor[0, 0, 1]]], "Title",
 CellChangeTimes->{{3.488197862671875*^9, 3.48819787875*^9}, {
   3.514152368078125*^9, 3.514152388265625*^9}, {3.54654180040625*^9, 
   3.5465418080625*^9}, 3.54666746734375*^9, {3.5765310955*^9, 
   3.57653109815625*^9}, {3.576543610390625*^9, 3.576543611296875*^9}, {
   3.6131248871606865`*^9, 3.613124891364032*^9}, 3.613126084548465*^9, 
   3.6131262384849825`*^9, {3.6446651862686405`*^9, 3.6446651890971684`*^9}, {
   3.6760023563892155`*^9, 3.676002362869237*^9}, {3.676002706229884*^9, 
   3.676002715402915*^9}, 3.7413298847257304`*^9, 3.741331127951836*^9},
 TextAlignment->Center],

Cell[CellGroupData[{

Cell["Vector Field Plots", "Section",
 CellChangeTimes->{
  3.576531172015625*^9, {3.57653120315625*^9, 3.576531203625*^9}, {
   3.7413303523905807`*^9, 3.741330357970028*^9}}],

Cell[CellGroupData[{

Cell[TextData[StyleBox["Vector Field Plots",
 FontColor->RGBColor[0, 0, 1]]], "Subsection",
 CellChangeTimes->{
  3.576531282015625*^9, {3.576533930796875*^9, 3.57653393790625*^9}, {
   3.741330337090951*^9, 3.7413303383937435`*^9}}],

Cell[TextData[{
 Cell[BoxData[
  RowBox[{
   ButtonBox["VectorPlot",
    BaseStyle->"Link",
    ButtonData->"paclet:ref/VectorPlot"], "[", 
   RowBox[{
    RowBox[{"{", 
     RowBox[{
      SubscriptBox[
       StyleBox["v", "TI"], 
       StyleBox["x", "TI"]], ",", 
      SubscriptBox[
       StyleBox["v", "TI"], 
       StyleBox["y", "TI"]]}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{
      StyleBox["x", "TI"], ",", 
      SubscriptBox[
       StyleBox["x", "TI"], 
       StyleBox["min", "TI"]], ",", 
      SubscriptBox[
       StyleBox["x", "TI"], 
       StyleBox["max", "TI"]]}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{
      StyleBox["y", "TI"], ",", 
      SubscriptBox[
       StyleBox["y", "TI"], 
       StyleBox["min", "TI"]], ",", 
      SubscriptBox[
       StyleBox["y", "TI"], 
       StyleBox["max", "TI"]]}], "}"}]}], "]"}]], "InlineFormula"],
 "  generates a vector plot of the vector field ",
 Cell[BoxData[
  RowBox[{"{", 
   RowBox[{
    SubscriptBox[
     StyleBox["v", "TI"], 
     StyleBox["x", "TI"]], ",", 
    SubscriptBox[
     StyleBox["v", "TI"], 
     StyleBox["y", "TI"]]}], "}"}]], "InlineFormula"],
 " as a function of ",
 Cell[BoxData[
  StyleBox["x", "TI"]], "InlineFormula"],
 " and ",
 Cell[BoxData[
  StyleBox["y", "TI"]], "InlineFormula"],
 ".",
 StyleBox["\n", "TI",
  FontColor->RGBColor[1, 0, 0]],
 Cell[BoxData[
  RowBox[{
   ButtonBox["StreamPlot",
    BaseStyle->"Link",
    ButtonData->"paclet:ref/StreamPlot"], "[", 
   RowBox[{
    RowBox[{"{", 
     RowBox[{
      SubscriptBox[
       StyleBox["v", "TI"], 
       StyleBox["x", "TI"]], ",", 
      SubscriptBox[
       StyleBox["v", "TI"], 
       StyleBox["y", "TI"]]}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{
      StyleBox["x", "TI"], ",", 
      SubscriptBox[
       StyleBox["x", "TI"], 
       StyleBox["min", "TI"]], ",", 
      SubscriptBox[
       StyleBox["x", "TI"], 
       StyleBox["max", "TI"]]}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{
      StyleBox["y", "TI"], ",", 
      SubscriptBox[
       StyleBox["y", "TI"], 
       StyleBox["min", "TI"]], ",", 
      SubscriptBox[
       StyleBox["y", "TI"], 
       StyleBox["max", "TI"]]}], "}"}]}], "]"}]], "InlineFormula"],
 " \[LineSeparator]generates a stream plot of the vector field ",
 Cell[BoxData[
  RowBox[{"{", 
   RowBox[{
    SubscriptBox[
     StyleBox["v", "TI"], 
     StyleBox["x", "TI"]], ",", 
    SubscriptBox[
     StyleBox["v", "TI"], 
     StyleBox["y", "TI"]]}], "}"}]], "InlineFormula"],
 " as a function of ",
 Cell[BoxData[
  StyleBox["x", "TI"]], "InlineFormula"],
 " and ",
 Cell[BoxData[
  StyleBox["y", "TI"]], "InlineFormula"],
 "."
}], "DisplayText",
 CellChangeTimes->{{3.576533984328125*^9, 3.57653400271875*^9}}],

Cell[BoxData[
 RowBox[{"VectorPlot", "[", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{
     RowBox[{
      RowBox[{"-", "1"}], "-", 
      RowBox[{"x", "^", "2"}], "+", "y"}], ",", 
     RowBox[{"1", "+", "x", "-", 
      RowBox[{"y", "^", "2"}]}]}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"x", ",", 
     RowBox[{"-", "3"}], ",", "3"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"y", ",", 
     RowBox[{"-", "3"}], ",", "3"}], "}"}]}], "]"}]], "Input"],

Cell[BoxData[
 RowBox[{"StreamPlot", "[", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{
     RowBox[{
      RowBox[{"-", "1"}], "-", 
      RowBox[{"x", "^", "2"}], "+", "y"}], ",", 
     RowBox[{"1", "+", "x", "-", 
      RowBox[{"y", "^", "2"}]}]}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"x", ",", 
     RowBox[{"-", "3"}], ",", "3"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"y", ",", 
     RowBox[{"-", "3"}], ",", "3"}], "}"}]}], "]"}]], "Input"]
}, Closed]]
}, Open  ]],

Cell[CellGroupData[{

Cell["Differential Equations", "Section",
 CellChangeTimes->{{3.54654189859375*^9, 3.54654189909375*^9}, {
   3.546667286796875*^9, 3.546667289484375*^9}, {3.54666745584375*^9, 
   3.546667463171875*^9}, 3.57653093740625*^9, {3.6132750284654417`*^9, 
   3.613275029704513*^9}, {3.6760027198869305`*^9, 3.6760027224299393`*^9}}],

Cell[CellGroupData[{

Cell[TextData[StyleBox["1. First-Order Ordinary Differntial Equations (ODEs)",
 FontColor->RGBColor[0, 0, 1]]], "Subsection",
 CellChangeTimes->{{3.546542232921875*^9, 3.54654223584375*^9}, {
  3.54666747703125*^9, 3.546667495875*^9}, {3.5466687368125*^9, 
  3.54666874565625*^9}, {3.54672635203125*^9, 3.546726358640625*^9}, {
  3.5765309393125*^9, 3.576530942453125*^9}, {3.676002728792961*^9, 
  3.6760027358629847`*^9}}],

Cell[TextData[{
 StyleBox["DSolve[", "MR",
  FontColor->RGBColor[1, 0, 0]],
 StyleBox["eqn", "TI",
  FontColor->RGBColor[1, 0, 0]],
 StyleBox[",", "MR",
  FontColor->RGBColor[1, 0, 0]],
 StyleBox[" ",
  FontColor->RGBColor[1, 0, 0]],
 StyleBox["y", "TI",
  FontColor->RGBColor[1, 0, 0]],
 StyleBox[",", "MR",
  FontColor->RGBColor[1, 0, 0]],
 StyleBox[" ",
  FontColor->RGBColor[1, 0, 0]],
 StyleBox["x", "TI",
  FontColor->RGBColor[1, 0, 0]],
 StyleBox["]", "MR",
  FontColor->RGBColor[1, 0, 0]],
 StyleBox[" solves a differential equation for the function ",
  FontColor->RGBColor[1, 0, 0]],
 Cell[BoxData[
  StyleBox["y", "TI"]], "InlineFormula",
  FontColor->RGBColor[1, 0, 0]],
 StyleBox[", with independent variable\[NonBreakingSpace]",
  FontColor->RGBColor[1, 0, 0]],
 Cell[BoxData[
  StyleBox["x", "TI"]], "InlineFormula",
  FontColor->RGBColor[1, 0, 0]],
 StyleBox[".\n",
  FontColor->RGBColor[1, 0, 0]],
 Cell[BoxData[
  FormBox[GridBox[{
     {Cell[BoxData[
       FormBox[
        StyleBox[
         RowBox[{
          RowBox[{"DSolve", "[", 
           RowBox[{
            RowBox[{"{", 
             RowBox[{
              SubscriptBox[
               StyleBox["eqn", "TI"], 
               StyleBox["1", "TR"]], ",", 
              SubscriptBox[
               StyleBox["eqn", "TI"], 
               StyleBox["2", "TR"]], ",", 
              StyleBox["\[Ellipsis]", "TR"]}], "}"}], ",", 
            RowBox[{"{", 
             RowBox[{
              SubscriptBox[
               StyleBox["y", "TI"], 
               StyleBox["1", "TR"]], ",", 
              SubscriptBox[
               StyleBox["y", "TI"], 
               StyleBox["2", "TR"]], ",", 
              StyleBox["\[Ellipsis]", "TR"]}], "}"}], ",", 
            StyleBox["x", "TI"]}], "]"}], " "}],
         FontWeight->"Plain"], TraditionalForm]]], Cell[BoxData[
       FormBox[
        RowBox[{
        "solves", " ", "a", " ", "list", " ", "of", " ", "differential", " ", 
         RowBox[{"equations", "."}]}], TraditionalForm]]]}
    },
    GridBoxAlignment->{
     "Columns" -> {Right, {Left}}, "ColumnsIndexed" -> {}, 
      "Rows" -> {{Baseline}}, "RowsIndexed" -> {}}], TraditionalForm]],
  FontColor->RGBColor[1, 0, 0],
  GridBoxOptions->{
  GridBoxDividers->{
   "Columns" -> {{False}}, "ColumnsIndexed" -> {}, "Rows" -> {{False}}, 
    "RowsIndexed" -> {}},
  GridBoxSpacings->{"Columns" -> {
      Offset[0.27999999999999997`], {
       Offset[0.5599999999999999]}, 
      Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
      Offset[0.2], {
       Offset[0.16]}, 
      Offset[0.2]}, "RowsIndexed" -> {}}}]
}], "DisplayText",
 CellChangeTimes->{{3.546542278359375*^9, 3.54654231034375*^9}, {
  3.5466675973125*^9, 3.5466676661875*^9}, {3.54666800525*^9, 
  3.546668032859375*^9}, {3.54666881775*^9, 3.546668823578125*^9}}],

Cell[CellGroupData[{

Cell["\<\
1.1. First-Order ODE General Solution (Without Initial Conditions)\
\>", "Subsubsection",
 CellChangeTimes->{{3.546542250234375*^9, 3.546542251921875*^9}, {
   3.546724634765625*^9, 3.546724696625*^9}, {3.546725303359375*^9, 
   3.546725306671875*^9}, {3.546726361421875*^9, 3.546726368*^9}, 
   3.576530953796875*^9, {3.676002742229007*^9, 3.6760027425590086`*^9}}],

Cell[BoxData[
 RowBox[{"Clear", "[", 
  RowBox[{"x", ",", "y"}], "]"}]], "Input",
 CellChangeTimes->{{3.57654086340625*^9, 3.576540869671875*^9}}],

Cell[BoxData[
 RowBox[{"sol1", "=", 
  RowBox[{"DSolve", "[", 
   RowBox[{
    RowBox[{
     RowBox[{
      RowBox[{
       RowBox[{"y", "'"}], "[", "x", "]"}], "-", 
      RowBox[{"y", "[", "x", "]"}], "-", 
      RowBox[{"Exp", "[", 
       RowBox[{"-", "x"}], "]"}]}], "\[Equal]", "0"}], ",", " ", "y", ",", 
    "x"}], "]"}]}]], "Input",
 CellChangeTimes->{
  3.546724133359375*^9, {3.54672421003125*^9, 3.54672421478125*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{
    RowBox[{
     RowBox[{"y", "'"}], "[", "x", "]"}], "-", 
    RowBox[{"y", "[", "x", "]"}], "-", 
    RowBox[{"Exp", "[", 
     RowBox[{"-", "x"}], "]"}]}], "\[Equal]", "0"}], " ", "/.", " ", 
  RowBox[{"sol1", "[", 
   RowBox[{"[", "1", "]"}], "]"}], " ", 
  RowBox[{"(*", " ", "Verifying", " ", "*)"}]}]], "Input",
 CellChangeTimes->{{3.54672515296875*^9, 3.546725167375*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"f1", "[", "x_", "]"}], ":=", 
  RowBox[{
   RowBox[{
    RowBox[{"y", "[", "x", "]"}], "/.", " ", 
    RowBox[{"sol1", "[", 
     RowBox[{"[", "1", "]"}], "]"}]}], " ", "/.", " ", 
   RowBox[{
    RowBox[{"C", "[", "1", "]"}], "\[Rule]", " ", 
    RowBox[{"-", "10"}]}]}]}]], "Input",
 CellChangeTimes->{{3.546724188765625*^9, 3.546724238765625*^9}, {
   3.5467242690625*^9, 3.54672428275*^9}, {3.546724405609375*^9, 
   3.546724411046875*^9}, {3.546724443890625*^9, 3.5467244485625*^9}, 
   3.5467263935*^9}],

Cell[BoxData[
 RowBox[{"f1", "[", "z", "]"}]], "Input",
 CellChangeTimes->{{3.546724454890625*^9, 3.5467244621875*^9}, 
   3.54672639546875*^9}],

Cell[BoxData[
 RowBox[{
  RowBox[{"f1", "[", 
   RowBox[{"x_", ",", "k_"}], "]"}], ":=", 
  RowBox[{
   RowBox[{
    RowBox[{"y", "[", "x", "]"}], "/.", " ", 
    RowBox[{"sol1", "[", 
     RowBox[{"[", "1", "]"}], "]"}]}], " ", "/.", " ", 
   RowBox[{
    RowBox[{"C", "[", "1", "]"}], "\[Rule]", " ", "k"}]}]}]], "Input",
 CellChangeTimes->{{3.546724491*^9, 3.546724507625*^9}, 3.546726398828125*^9}],

Cell[BoxData[
 RowBox[{"f1", "[", 
  RowBox[{"x", ",", "k"}], "]"}]], "Input",
 CellChangeTimes->{{3.5467245106875*^9, 3.546724513703125*^9}, 
   3.546726399875*^9}],

Cell[BoxData[
 RowBox[{"tab", "=", 
  RowBox[{"Table", "[", 
   RowBox[{
    RowBox[{"f1", "[", 
     RowBox[{"x", ",", "k"}], "]"}], ",", " ", 
    RowBox[{"{", 
     RowBox[{"k", ",", " ", 
      RowBox[{"-", "80"}], ",", " ", "80", ",", " ", "40"}], "}"}]}], 
   "]"}]}]], "Input",
 CellChangeTimes->{{3.546724544765625*^9, 3.546724548859375*^9}, 
   3.546726403765625*^9, 3.57654113825*^9}],

Cell[BoxData[
 RowBox[{"Plot", "[", 
  RowBox[{
   RowBox[{"Evaluate", "[", "tab", "]"}], ",", " ", 
   RowBox[{"{", 
    RowBox[{"x", ",", " ", "0", ",", " ", "7"}], "}"}], ",", " ", 
   RowBox[{"PlotLegends", "\[Rule]", 
    RowBox[{"{", 
     RowBox[{
     "\"\<k=-80\>\"", ",", " ", "\"\<k=-40\>\"", ",", " ", "\"\<k=0\>\"", ",",
       " ", "\"\<k=40\>\"", ",", " ", "\"\<k=80\>\""}], "}"}]}]}], 
  "]"}]], "Input",
 CellChangeTimes->{{3.546724525953125*^9, 3.546724531921875*^9}, {
   3.5467248356875*^9, 3.54672490375*^9}, {3.546724946890625*^9, 
   3.54672501434375*^9}, {3.54672504771875*^9, 3.546725052890625*^9}, {
   3.5467257983125*^9, 3.5467258400625*^9}, {3.576534063125*^9, 
   3.57653406675*^9}, 3.57653429078125*^9, {3.7413302169852724`*^9, 
   3.741330224581276*^9}}],

Cell[BoxData[
 RowBox[{"plot1", "=", 
  RowBox[{"Plot", "[", 
   RowBox[{
    RowBox[{"f1", "[", 
     RowBox[{"x", ",", "0.5"}], "]"}], ",", " ", 
    RowBox[{"{", 
     RowBox[{"x", ",", " ", "0", ",", " ", "3"}], "}"}], ",", 
    RowBox[{"PlotStyle", "\[Rule]", " ", "Red"}]}], "]"}]}]], "Input",
 CellChangeTimes->{{3.576534300578125*^9, 3.576534309140625*^9}, 
   3.57653440203125*^9, {3.57653444078125*^9, 3.57653451771875*^9}, {
   3.576534567015625*^9, 3.576534568109375*^9}, {3.7413315653115816`*^9, 
   3.7413315901920843`*^9}}],

Cell[BoxData[
 RowBox[{"splot", "=", 
  RowBox[{"StreamPlot", "[", 
   RowBox[{
    RowBox[{"{", 
     RowBox[{"1", ",", 
      RowBox[{"y", "+", 
       RowBox[{"Exp", "[", 
        RowBox[{"-", "x"}], "]"}]}]}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{"x", ",", "0", ",", "7"}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{"y", ",", 
      RowBox[{"-", "10"}], ",", "10"}], "}"}]}], "]"}]}]], "Input",
 CellChangeTimes->{{3.576534098265625*^9, 3.57653425834375*^9}, {
   3.576534324734375*^9, 3.576534362515625*^9}, 3.576534396703125*^9, {
   3.576534530734375*^9, 3.576534552125*^9}, {3.7413307093427*^9, 
   3.741330713244367*^9}, 3.7413315699926205`*^9}],

Cell[BoxData[
 RowBox[{"Show", "[", 
  RowBox[{"plot1", ",", "splot"}], "]"}]], "Input",
 CellChangeTimes->{{3.5765342664375*^9, 3.57653427365625*^9}, {
  3.741330724602155*^9, 3.7413307264356956`*^9}}],

Cell[BoxData[
 RowBox[{"vplot", "=", 
  RowBox[{"VectorPlot", "[", 
   RowBox[{
    RowBox[{"{", 
     RowBox[{"1", ",", 
      RowBox[{"y", "+", 
       RowBox[{"Exp", "[", 
        RowBox[{"-", "x"}], "]"}]}]}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{"x", ",", "0", ",", "7"}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{"y", ",", 
      RowBox[{"-", "10"}], ",", "10"}], "}"}], ",", " ", 
    RowBox[{"VectorScale", "\[Rule]", 
     RowBox[{"{", 
      RowBox[{"Tiny", ",", 
       RowBox[{"Scaled", "[", "0.4", "]"}], ",", "None"}], "}"}]}]}], 
   "]"}]}]], "Input",
 CellChangeTimes->{{3.741330396700581*^9, 3.7413304051695976`*^9}, {
  3.7413305766006093`*^9, 3.7413306044276958`*^9}, {3.7413306424766006`*^9, 
  3.741330649290919*^9}, {3.7413307342924395`*^9, 3.741330737125965*^9}, {
  3.74133132785448*^9, 3.741331354530989*^9}, {3.7413313933258057`*^9, 
  3.7413315096079025`*^9}, {3.741331604912036*^9, 3.7413316122128944`*^9}}],

Cell[BoxData[
 RowBox[{"Show", "[", 
  RowBox[{"plot1", ",", "vplot"}], "]"}]], "Input",
 CellChangeTimes->{
  3.7413304492971797`*^9, {3.741330743045034*^9, 3.741330744328105*^9}}]
}, Closed]],

Cell[CellGroupData[{

Cell["\<\
1.2. First-Order ODE Particular Solution (With Initial Conditions)\
\>", "Subsubsection",
 CellChangeTimes->{{3.546542250234375*^9, 3.546542251921875*^9}, {
   3.546725108734375*^9, 3.546725114109375*^9}, {3.546725249140625*^9, 
   3.546725284796875*^9}, {3.54672542909375*^9, 3.546725429953125*^9}, 
   3.546726378265625*^9, 3.57653095575*^9, {3.6760027440490136`*^9, 
   3.676002744329014*^9}}],

Cell[BoxData[
 RowBox[{"sol2", "=", 
  RowBox[{"DSolve", "[", 
   RowBox[{
    RowBox[{"{", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{
         RowBox[{"y", "'"}], "[", "x", "]"}], "-", 
        RowBox[{"y", "[", "x", "]"}], "-", 
        RowBox[{"Exp", "[", 
         RowBox[{"-", "x"}], "]"}]}], "\[Equal]", "0"}], ",", 
      RowBox[{
       RowBox[{"y", "[", "2", "]"}], "\[Equal]", 
       RowBox[{"-", "0.1"}]}]}], "}"}], ",", " ", "y", ",", "x"}], 
   "]"}]}]], "Input",
 CellChangeTimes->{{3.54672545078125*^9, 3.54672545415625*^9}}],

Cell["This test is not obvious:", "Commentary",
 CellChangeTimes->{{3.5467255183125*^9, 3.54672552721875*^9}, {
  3.546725574234375*^9, 3.54672557825*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{
    RowBox[{
     RowBox[{"y", "'"}], "[", "x", "]"}], "-", 
    RowBox[{"y", "[", "x", "]"}], "-", 
    RowBox[{"Exp", "[", 
     RowBox[{"-", "x"}], "]"}]}], "==", "0"}], " ", "/.", " ", 
  RowBox[{"sol2", "[", 
   RowBox[{"[", "1", "]"}], "]"}], " "}]], "Input",
 CellChangeTimes->{{3.546725468390625*^9, 3.546725508375*^9}}],

Cell["Another way to test:", "Commentary",
 CellChangeTimes->{{3.546725562921875*^9, 3.54672556790625*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{
    RowBox[{"y", "'"}], "[", "x", "]"}], "-", 
   RowBox[{"y", "[", "x", "]"}], "-", 
   RowBox[{"Exp", "[", 
    RowBox[{"-", "x"}], "]"}]}], " ", "/.", " ", 
  RowBox[{"sol2", "[", 
   RowBox[{"[", "1", "]"}], "]"}], " "}]], "Input",
 CellChangeTimes->{{3.546725583390625*^9, 3.546725587515625*^9}}],

Cell[BoxData[
 RowBox[{"Simplify", "[", "%", "]"}]], "Input",
 CellChangeTimes->{{3.546725591046875*^9, 3.54672559796875*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"f2", "[", "x_", "]"}], ":=", 
  RowBox[{
   RowBox[{"y", "[", "x", "]"}], "/.", " ", 
   RowBox[{"sol2", "[", 
    RowBox[{"[", "1", "]"}], "]"}], " "}]}]], "Input",
 CellChangeTimes->{{3.546725634921875*^9, 3.54672564184375*^9}}],

Cell[BoxData[
 RowBox[{"f2", "[", "z", "]"}]], "Input",
 CellChangeTimes->{{3.54672564575*^9, 3.546725648328125*^9}, 
   3.54672571071875*^9}],

Cell[BoxData[
 RowBox[{"plot2", "=", 
  RowBox[{"Plot", "[", 
   RowBox[{
    RowBox[{"f2", "[", "x", "]"}], ",", " ", 
    RowBox[{"{", 
     RowBox[{"x", ",", " ", "0", ",", " ", "7"}], "}"}], ",", " ", 
    RowBox[{"PlotStyle", "\[Rule]", "Red"}]}], "]"}]}]], "Input",
 CellChangeTimes->{{3.5467257356875*^9, 3.546725740453125*^9}, {
  3.546725775*^9, 3.54672578225*^9}, {3.576541685078125*^9, 
  3.576541687875*^9}, {3.576541720328125*^9, 3.576541729046875*^9}, {
  3.7413307502854214`*^9, 3.741330751152274*^9}}],

Cell[BoxData[
 RowBox[{"Show", "[", 
  RowBox[{"plot2", ",", "splot"}], "]"}]], "Input",
 CellChangeTimes->{{3.576541693625*^9, 3.576541699765625*^9}, {
  3.741330756448491*^9, 3.741330757793714*^9}}],

Cell[BoxData[
 RowBox[{"Show", "[", 
  RowBox[{"plot2", ",", "vplot"}], "]"}]], "Input",
 CellChangeTimes->{{3.7413307809982986`*^9, 3.741330781232669*^9}}],

Cell["Sometimes DSolve couldn't find the solution:", "Commentary",
 CellChangeTimes->{{3.54672590878125*^9, 3.546725941265625*^9}}],

Cell[BoxData[
 RowBox[{"DSolve", "[", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{
     RowBox[{
      RowBox[{
       RowBox[{"y", "'"}], "[", "x", "]"}], "==", 
      RowBox[{
       RowBox[{"y", "[", "x", "]"}], 
       RowBox[{"Cos", "[", 
        RowBox[{"x", "+", 
         RowBox[{"y", "[", "x", "]"}]}], "]"}]}]}], ",", 
     RowBox[{
      RowBox[{"y", "[", "0", "]"}], "==", "1"}]}], "}"}], ",", "y", ",", 
   "x"}], "]"}]], "Input",
 CellChangeTimes->{{3.54672587759375*^9, 3.546725888171875*^9}, 
   3.546725923203125*^9}],

Cell["In that case, numerical solution should be used :", "Commentary",
 CellChangeTimes->{{3.546725956078125*^9, 3.546725996375*^9}}],

Cell[TextData[Cell[BoxData[Cell[TextData[{
  Cell[BoxData[
   RowBox[{
    ButtonBox["NDSolve",
     BaseStyle->"Link",
     ButtonData->"paclet:ref/NDSolve"], "[", 
    RowBox[{
     StyleBox["eqns", "TI"], ",", 
     StyleBox["y", "TI"], ",", 
     RowBox[{"{", 
      RowBox[{
       StyleBox["x", "TI"], ",", 
       SubscriptBox[
        StyleBox["x", "TI"], 
        StyleBox["min", "TI"]], ",", 
       SubscriptBox[
        StyleBox["x", "TI"], 
        StyleBox["max", "TI"]]}], "}"}]}], "]"}]], "InlineFormula",
   FontColor->RGBColor[1, 0, 0]],
  StyleBox[
  "finds a numerical solution to the ordinary differential equations ",
   FontColor->RGBColor[1, 0, 0]],
  Cell[BoxData[
   StyleBox["eqns", "TI"]], "InlineFormula",
   FontColor->RGBColor[1, 0, 0]],
  StyleBox[" for the function ",
   FontColor->RGBColor[1, 0, 0]],
  Cell[BoxData[
   StyleBox["y", "TI"]], "InlineFormula",
   FontColor->RGBColor[1, 0, 0]],
  StyleBox[" with the independent variable ",
   FontColor->RGBColor[1, 0, 0]],
  Cell[BoxData[
   StyleBox["x", "TI"]], "InlineFormula",
   FontColor->RGBColor[1, 0, 0]],
  StyleBox[" in the range ",
   FontColor->RGBColor[1, 0, 0]],
  Cell[BoxData[
   SubscriptBox[
    StyleBox["x", "TI"], 
    StyleBox["min", "TI"]]], "InlineFormula",
   FontColor->RGBColor[1, 0, 0]],
  StyleBox[" to ",
   FontColor->RGBColor[1, 0, 0]],
  Cell[BoxData[
   SubscriptBox[
    StyleBox["x", "TI"], 
    StyleBox["max", "TI"]]], "InlineFormula",
   FontColor->RGBColor[1, 0, 0]],
  StyleBox[". ",
   FontColor->RGBColor[1, 0, 0]]
 }]]],
 GridBoxOptions->{
 GridBoxBackground->{
  "Columns" -> {{None}}, "ColumnsIndexed" -> {}, 
   "Rows" -> {None, None, {None}}, "RowsIndexed" -> {}}}]], "DisplayText",
 CellChangeTimes->{{3.546542278359375*^9, 3.54654231034375*^9}, {
  3.5466675973125*^9, 3.5466676661875*^9}, {3.546667957234375*^9, 
  3.546667979109375*^9}, {3.546726011140625*^9, 3.54672602353125*^9}}],

Cell[BoxData[
 RowBox[{"sol3", "=", 
  RowBox[{"NDSolve", "[", 
   RowBox[{
    RowBox[{"{", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"y", "'"}], "[", "x", "]"}], "==", 
       RowBox[{
        RowBox[{"y", "[", "x", "]"}], 
        RowBox[{"Cos", "[", 
         RowBox[{"x", "+", 
          RowBox[{"y", "[", "x", "]"}]}], "]"}]}]}], ",", 
      RowBox[{
       RowBox[{"y", "[", "0", "]"}], "==", "1"}]}], "}"}], ",", "y", ",", 
    RowBox[{"{", 
     RowBox[{"x", ",", "0", ",", "30"}], "}"}]}], "]"}]}]], "Input",
 CellChangeTimes->{{3.5467260580625*^9, 3.546726059453125*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"f3", "[", "x_", "]"}], ":=", 
  RowBox[{
   RowBox[{"y", "[", "x", "]"}], "/.", " ", 
   RowBox[{"sol3", "[", 
    RowBox[{"[", "1", "]"}], "]"}], " "}]}]], "Input",
 CellChangeTimes->{{3.54672608515625*^9, 3.5467260894375*^9}}],

Cell[BoxData[
 RowBox[{"plot3", "=", 
  RowBox[{"Plot", "[", 
   RowBox[{
    RowBox[{"f3", "[", "x", "]"}], ",", 
    RowBox[{"{", 
     RowBox[{"x", ",", "0", ",", "30"}], "}"}], ",", 
    RowBox[{"PlotRange", "\[Rule]", "All"}], ",", " ", 
    RowBox[{"PlotStyle", "\[Rule]", " ", "Red"}]}], "]"}]}]], "Input",
 CellChangeTimes->{{3.54672610759375*^9, 3.546726109765625*^9}, {
  3.576541907265625*^9, 3.576541909125*^9}, {3.57654197534375*^9, 
  3.576541980296875*^9}, {3.7413308692536993`*^9, 3.741330870302023*^9}}],

Cell[BoxData[
 RowBox[{"splot3", "=", 
  RowBox[{"StreamPlot", "[", 
   RowBox[{
    RowBox[{"{", 
     RowBox[{"1", ",", 
      RowBox[{"y", " ", 
       RowBox[{"Cos", "[", 
        RowBox[{"x", "+", "y"}], "]"}]}]}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{"x", ",", "0", ",", "30"}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{"y", ",", "0", ",", "1.5"}], "}"}]}], "]"}]}]], "Input",
 CellChangeTimes->{{3.576541915953125*^9, 3.576541959234375*^9}, {
  3.576542016359375*^9, 3.576542036734375*^9}, {3.741330877822768*^9, 
  3.741330886655305*^9}}],

Cell[BoxData[
 RowBox[{"Show", "[", 
  RowBox[{"plot3", ",", "splot3"}], "]"}]], "Input",
 CellChangeTimes->{{3.57654199090625*^9, 3.576541996953125*^9}, {
  3.741330893335189*^9, 3.7413309008671627`*^9}}],

Cell[BoxData[
 RowBox[{"vplot3", "=", 
  RowBox[{"VectorPlot", "[", 
   RowBox[{
    RowBox[{"{", 
     RowBox[{"1", ",", 
      RowBox[{"y", " ", 
       RowBox[{"Cos", "[", 
        RowBox[{"x", "+", "y"}], "]"}]}]}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{"x", ",", "0", ",", "30"}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{"y", ",", "0", ",", "1.5"}], "}"}], ",", " ", 
    RowBox[{"VectorScale", "\[Rule]", 
     RowBox[{"{", 
      RowBox[{"Tiny", ",", 
       RowBox[{"Scaled", "[", "1", "]"}], ",", "None"}], "}"}]}]}], 
   "]"}]}]], "Input",
 CellChangeTimes->{{3.741330922156189*^9, 3.7413309324343014`*^9}, {
  3.7413317183724136`*^9, 3.7413317388529963`*^9}}],

Cell[BoxData[
 RowBox[{"Show", "[", 
  RowBox[{"plot3", ",", "vplot3"}], "]"}]], "Input",
 CellChangeTimes->{3.7413309550026503`*^9}]
}, Closed]]
}, Open  ]],

Cell[CellGroupData[{

Cell[TextData[StyleBox["2. Second Order ODEs",
 FontColor->RGBColor[0, 0, 1]]], "Subsection",
 CellChangeTimes->{{3.546542232921875*^9, 3.54654223584375*^9}, {
   3.54666747703125*^9, 3.546667495875*^9}, {3.5466687368125*^9, 
   3.54666874565625*^9}, {3.546726199859375*^9, 3.546726235484375*^9}, 
   3.57653094440625*^9, {3.676002738642994*^9, 3.6760027401789994`*^9}}],

Cell[CellGroupData[{

Cell["\<\
2.1. Second-Order ODE General Solution (Without Initial Conditions)\
\>", "Subsubsection",
 CellChangeTimes->{{3.546542250234375*^9, 3.546542251921875*^9}, {
   3.546724634765625*^9, 3.546724696625*^9}, {3.546725303359375*^9, 
   3.546725306671875*^9}, {3.546726361421875*^9, 3.546726368*^9}, {
   3.5467264658125*^9, 3.54672647109375*^9}, 3.57653096821875*^9, {
   3.676002749717035*^9, 3.676002750002036*^9}}],

Cell[BoxData[
 RowBox[{"sol4", "=", 
  RowBox[{"DSolve", "[", 
   RowBox[{
    RowBox[{
     RowBox[{
      RowBox[{
       RowBox[{"y", "''"}], "[", "x", "]"}], "-", 
      RowBox[{"4", " ", 
       RowBox[{"y", "[", "x", "]"}]}]}], "\[Equal]", "0"}], ",", " ", "y", 
    ",", "x"}], "]"}]}]], "Input",
 CellChangeTimes->{
  3.546724133359375*^9, {3.54672421003125*^9, 3.54672421478125*^9}, {
   3.546726482328125*^9, 3.546726515359375*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{
    RowBox[{
     RowBox[{"y", "''"}], "[", "x", "]"}], "-", 
    RowBox[{"4", " ", 
     RowBox[{"y", "[", "x", "]"}]}]}], "\[Equal]", "0"}], "/.", " ", 
  RowBox[{"sol4", "[", 
   RowBox[{"[", "1", "]"}], "]"}], " "}]], "Input",
 CellChangeTimes->{{3.54672515296875*^9, 3.546725167375*^9}, {
  3.546726532140625*^9, 3.546726546203125*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{
    RowBox[{"y", "''"}], "[", "x", "]"}], "-", 
   RowBox[{"4", " ", 
    RowBox[{"y", "[", "x", "]"}]}]}], "/.", " ", 
  RowBox[{"sol4", "[", 
   RowBox[{"[", "1", "]"}], "]"}], " "}]], "Input",
 CellChangeTimes->{{3.5467265696875*^9, 3.546726571234375*^9}}],

Cell[BoxData[
 RowBox[{"Simplify", "[", "%", "]"}]], "Input",
 CellChangeTimes->{{3.546726574921875*^9, 3.5467265839375*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"f4", "[", 
   RowBox[{"x_", ",", "k1_", ",", " ", "k2_"}], "]"}], ":=", 
  RowBox[{
   RowBox[{
    RowBox[{"y", "[", "x", "]"}], "/.", " ", 
    RowBox[{"sol4", "[", 
     RowBox[{"[", "1", "]"}], "]"}]}], " ", "/.", " ", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{
      RowBox[{"C", "[", "1", "]"}], "\[Rule]", " ", "k1"}], ",", " ", 
     RowBox[{
      RowBox[{"C", "[", "2", "]"}], "\[Rule]", " ", "k2"}]}], 
    "}"}]}]}]], "Input",
 CellChangeTimes->{{3.546724491*^9, 3.546724507625*^9}, 
   3.546726398828125*^9, {3.546726614*^9, 3.54672664996875*^9}}],

Cell[BoxData[
 RowBox[{"f4", "[", 
  RowBox[{"x", ",", "k1", ",", " ", "k2"}], "]"}]], "Input",
 CellChangeTimes->{{3.5467245106875*^9, 3.546724513703125*^9}, 
   3.546726399875*^9, {3.546726653671875*^9, 3.5467266594375*^9}}],

Cell[BoxData[
 RowBox[{"Plot", "[", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{
     RowBox[{"f4", "[", 
      RowBox[{"x", ",", 
       RowBox[{"k1", "=", "2"}], ",", " ", 
       RowBox[{"k2", "=", "3"}]}], "]"}], ",", 
     RowBox[{"f4", "[", 
      RowBox[{"x", ",", " ", 
       RowBox[{"k1", "=", "1"}], ",", " ", 
       RowBox[{"k2", "=", "2"}]}], "]"}]}], "}"}], ",", " ", 
   RowBox[{"{", 
    RowBox[{"x", ",", " ", "0", ",", " ", "7"}], "}"}], ",", " ", 
   RowBox[{"PlotLegends", "\[Rule]", 
    RowBox[{"{", 
     RowBox[{
     "\"\<\!\(\*SubscriptBox[\(k\), \(1\)]\)=2, \!\(\*SubscriptBox[\(k\), \(2\
\)]\)=3\>\"", ",", " ", 
      "\"\< \!\(\*SubscriptBox[\(k\), \(1\)]\)=1, \!\(\*SubscriptBox[\(k\), \
\(2\)]\)=2\>\""}], "}"}]}]}], "]"}]], "Input",
 CellChangeTimes->{{3.546724525953125*^9, 3.546724531921875*^9}, {
  3.5467248356875*^9, 3.54672490375*^9}, {3.546724946890625*^9, 
  3.54672501434375*^9}, {3.54672504771875*^9, 3.546725052890625*^9}, {
  3.5467257983125*^9, 3.5467258400625*^9}, {3.546726816296875*^9, 
  3.546726858609375*^9}, {3.54672689*^9, 3.546726974015625*^9}, {
  3.5467270065625*^9, 3.54672702778125*^9}, {3.7413309882720733`*^9, 
  3.741330992385793*^9}}]
}, Closed]],

Cell[CellGroupData[{

Cell["\<\
2.2. Second-Order ODE Particular Solution (With Initial Conditions)\
\>", "Subsubsection",
 CellChangeTimes->{{3.546542250234375*^9, 3.546542251921875*^9}, {
   3.546724634765625*^9, 3.546724696625*^9}, {3.546725303359375*^9, 
   3.546725306671875*^9}, {3.546726361421875*^9, 3.546726368*^9}, {
   3.5467264658125*^9, 3.54672647109375*^9}, {3.54672707696875*^9, 
   3.5467270865625*^9}, 3.576530970078125*^9, {3.6760027534620485`*^9, 
   3.67600275373505*^9}}],

Cell[BoxData[
 RowBox[{"sol5", "=", 
  RowBox[{"DSolve", "[", 
   RowBox[{
    RowBox[{"{", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{
         RowBox[{"y", "''"}], "[", "x", "]"}], "-", 
        RowBox[{"4", " ", 
         RowBox[{"y", "[", "x", "]"}]}]}], "\[Equal]", "0"}], ",", "   ", 
      RowBox[{
       RowBox[{"y", "[", "2", "]"}], "\[Equal]", "1"}], ",", " ", 
      RowBox[{
       RowBox[{
        RowBox[{"y", "'"}], "[", "3", "]"}], "\[Equal]", "0"}]}], " ", "}"}], 
    ",", " ", "y", ",", "x"}], "]"}]}]], "Input",
 CellChangeTimes->{
  3.546724133359375*^9, {3.54672421003125*^9, 3.54672421478125*^9}, {
   3.546726482328125*^9, 3.546726515359375*^9}, {3.546727151609375*^9, 
   3.5467272069375*^9}, {3.546727342234375*^9, 3.54672736221875*^9}, {
   3.546727477296875*^9, 3.546727483890625*^9}, {3.546728005734375*^9, 
   3.54672801734375*^9}, {3.546728273203125*^9, 3.546728328765625*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{
    RowBox[{"y", "''"}], "[", "x", "]"}], "-", 
   RowBox[{"4", " ", 
    RowBox[{"y", "[", "x", "]"}]}]}], "/.", " ", 
  RowBox[{"sol5", "[", 
   RowBox[{"[", "1", "]"}], "]"}], " "}]], "Input",
 CellChangeTimes->{{3.5467265696875*^9, 3.546726571234375*^9}, {
  3.546728097140625*^9, 3.546728097484375*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"y", "[", "2", "]"}], " ", "/.", " ", 
  RowBox[{"sol5", "[", 
   RowBox[{"[", "1", "]"}], "]"}], " "}]], "Input",
 CellChangeTimes->{{3.54672812265625*^9, 3.546728129765625*^9}}],

Cell[BoxData[
 RowBox[{"Simplify", "[", "%", "]"}]], "Input",
 CellChangeTimes->{{3.546726574921875*^9, 3.5467265839375*^9}}],

Cell[BoxData[
 RowBox[{" ", 
  RowBox[{
   RowBox[{
    RowBox[{"y", "'"}], "[", "3", "]"}], "/.", " ", 
   RowBox[{"sol5", "[", 
    RowBox[{"[", "1", "]"}], "]"}], " "}]}]], "Input",
 CellChangeTimes->{3.546728149796875*^9}],

Cell[BoxData[
 RowBox[{
  RowBox[{"f5", "[", "x_", "]"}], ":=", 
  RowBox[{
   RowBox[{"y", "[", "x", "]"}], "/.", " ", 
   RowBox[{"sol5", "[", 
    RowBox[{"[", "1", "]"}], "]"}], " "}]}]], "Input",
 CellChangeTimes->{{3.546724491*^9, 3.546724507625*^9}, 
   3.546726398828125*^9, {3.546726614*^9, 3.54672664996875*^9}, {
   3.54672816221875*^9, 3.546728172625*^9}}],

Cell[BoxData[
 RowBox[{"f5", "[", "x", "]"}]], "Input",
 CellChangeTimes->{{3.5467245106875*^9, 3.546724513703125*^9}, 
   3.546726399875*^9, {3.546726653671875*^9, 3.5467266594375*^9}, {
   3.54672818115625*^9, 3.546728183828125*^9}}],

Cell[BoxData[
 RowBox[{"Plot", "[", 
  RowBox[{
   RowBox[{"f5", "[", "x", "]"}], ",", " ", 
   RowBox[{"{", 
    RowBox[{"x", ",", " ", 
     RowBox[{"-", "2"}], ",", " ", "7"}], "}"}]}], "]"}]], "Input",
 CellChangeTimes->{{3.546724525953125*^9, 3.546724531921875*^9}, {
  3.5467248356875*^9, 3.54672490375*^9}, {3.546724946890625*^9, 
  3.54672501434375*^9}, {3.54672504771875*^9, 3.546725052890625*^9}, {
  3.5467257983125*^9, 3.5467258400625*^9}, {3.546726816296875*^9, 
  3.546726858609375*^9}, {3.54672689*^9, 3.546726974015625*^9}, {
  3.5467270065625*^9, 3.54672702778125*^9}, {3.546728190734375*^9, 
  3.5467282374375*^9}}],

Cell[BoxData[
 RowBox[{"sol6", "=", 
  RowBox[{"DSolve", "[", 
   RowBox[{
    RowBox[{"{", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{
         RowBox[{"y", "''"}], "[", "x", "]"}], "-", 
        RowBox[{"4", " ", 
         RowBox[{"y", "[", "x", "]"}]}]}], "\[Equal]", "0"}], ",", "   ", 
      RowBox[{
       RowBox[{"y", "[", "1", "]"}], "\[Equal]", 
       RowBox[{"-", "1"}]}], ",", " ", 
      RowBox[{
       RowBox[{"y", "[", "3", "]"}], "\[Equal]", "2"}]}], " ", "}"}], ",", 
    " ", "y", ",", "x"}], "]"}]}]], "Input",
 CellChangeTimes->{{3.546728406046875*^9, 3.546728436578125*^9}, {
  3.54672879240625*^9, 3.546728800140625*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{
    RowBox[{"y", "''"}], "[", "x", "]"}], "-", 
   RowBox[{"4", " ", 
    RowBox[{"y", "[", "x", "]"}]}]}], "/.", " ", 
  RowBox[{"sol6", "[", 
   RowBox[{"[", "1", "]"}], "]"}], " "}]], "Input",
 CellChangeTimes->{3.546728459375*^9}],

Cell[BoxData[
 RowBox[{"Simplify", "[", "%", "]"}]], "Input",
 CellChangeTimes->{{3.5467284631875*^9, 3.546728467546875*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"y", "[", "1", "]"}], "/.", " ", 
  RowBox[{"sol6", "[", 
   RowBox[{"[", "1", "]"}], "]"}], " "}]], "Input",
 CellChangeTimes->{{3.5467284830625*^9, 3.54672848796875*^9}, 
   3.546728826390625*^9}],

Cell[BoxData[
 RowBox[{"Simplify", "[", "%", "]"}]], "Input",
 CellChangeTimes->{{3.546728831796875*^9, 3.54672883528125*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"y", "[", "3", "]"}], "/.", " ", 
  RowBox[{"sol6", "[", 
   RowBox[{"[", "1", "]"}], "]"}], " "}]], "Input",
 CellChangeTimes->{{3.5467284999375*^9, 3.54672850178125*^9}, 
   3.5467288416875*^9}],

Cell[BoxData[
 RowBox[{"Simplify", "[", "%", "]"}]], "Input",
 CellChangeTimes->{{3.54672850496875*^9, 3.54672851015625*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"f6", "[", "x_", "]"}], ":=", 
  RowBox[{
   RowBox[{"y", "[", "x", "]"}], "/.", " ", 
   RowBox[{"sol6", "[", 
    RowBox[{"[", "1", "]"}], "]"}], " "}]}]], "Input",
 CellChangeTimes->{{3.546728525328125*^9, 3.546728531546875*^9}}],

Cell[BoxData[
 RowBox[{"f6", "[", "x", "]"}]], "Input",
 CellChangeTimes->{{3.546728535109375*^9, 3.5467285375625*^9}}],

Cell[BoxData[
 RowBox[{"Plot", "[", 
  RowBox[{
   RowBox[{"f6", "[", "x", "]"}], ",", " ", 
   RowBox[{"{", 
    RowBox[{"x", ",", " ", "0", ",", " ", "4"}], "}"}]}], "]"}]], "Input",
 CellChangeTimes->{{3.54672870315625*^9, 3.546728716421875*^9}}]
}, Closed]]
}, Open  ]],

Cell[CellGroupData[{

Cell[TextData[StyleBox["3 Partial Differential Equations (PDEs) ",
 FontColor->RGBColor[0, 0, 1]]], "Subsection",
 CellChangeTimes->{{3.54654226884375*^9, 3.546542270078125*^9}, {
   3.54666874775*^9, 3.546668794359375*^9}, {3.5467262370625*^9, 
   3.546726237453125*^9}, 3.5765309471875*^9, {3.676002760112075*^9, 
   3.6760027603720756`*^9}}],

Cell[TextData[{
 "A partial differential equation (PDE) is a relationship between an unknown \
function ",
 Cell[BoxData[
  FormBox[
   RowBox[{"u", "(", 
    RowBox[{
     SubscriptBox["x", "1"], ",", 
     SubscriptBox["x", "2"], ",", "\[Ellipsis]", ",", 
     SubscriptBox["x", "n"]}], ")"}], TraditionalForm]], "InlineMath"],
 " and its derivatives with respect to the variables ",
 Cell[BoxData[
  FormBox[
   RowBox[{
    SubscriptBox["x", "1"], ",", 
    SubscriptBox["x", "2"], ",", "\[Ellipsis]", ",", 
    SubscriptBox["x", "n"]}], TraditionalForm]], "InlineMath"],
 ". \n\nExample: Solving the following PDE ",
 Cell[BoxData[
  FormBox[
   RowBox[{
    RowBox[{
     FractionBox[
      RowBox[{"\[PartialD]", 
       RowBox[{"u", "(", 
        RowBox[{"x", ",", "y"}], ")"}]}], 
      RowBox[{"\[PartialD]", "x"}],
      MultilineFunction->None], "+", 
     RowBox[{"x", " ", 
      FractionBox[
       RowBox[{"\[PartialD]", 
        RowBox[{"u", "(", 
         RowBox[{"x", ",", "y"}], ")"}]}], 
       RowBox[{"\[PartialD]", "y"}],
       MultilineFunction->None]}]}], "\[LongEqual]", 
    RowBox[{"sin", "(", "x", ")"}]}], TraditionalForm]],
  TextAlignment->Left]
}], "DisplayText",
 CellChangeTimes->{{3.546542278359375*^9, 3.54654231034375*^9}, {
  3.5466675973125*^9, 3.5466676661875*^9}, {3.546667957234375*^9, 
  3.546667979109375*^9}, {3.546728898078125*^9, 3.546728900015625*^9}, {
  3.546728997078125*^9, 3.546729009140625*^9}}],

Cell[BoxData[
 RowBox[{"sol7", "=", 
  RowBox[{"DSolve", "[", 
   RowBox[{
    RowBox[{
     RowBox[{
      RowBox[{
       SubscriptBox["\[PartialD]", "x"], " ", 
       RowBox[{"u", "[", 
        RowBox[{"x", ",", "y"}], "]"}]}], "+", 
      RowBox[{"x", " ", 
       RowBox[{
        SubscriptBox["\[PartialD]", "y"], " ", 
        RowBox[{"u", "[", 
         RowBox[{"x", ",", "y"}], "]"}]}]}]}], " ", "\[Equal]", " ", 
     RowBox[{"Sin", "[", "x", "]"}]}], ",", " ", "u", ",", 
    RowBox[{"{", 
     RowBox[{"x", ",", "y"}], "}"}]}], "]"}]}]], "Input",
 CellChangeTimes->{{3.546727906515625*^9, 3.546727959359375*^9}, {
  3.54672892765625*^9, 3.54672908971875*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{
    RowBox[{
     SubscriptBox["\[PartialD]", "x"], " ", 
     RowBox[{"u", "[", 
      RowBox[{"x", ",", "y"}], "]"}]}], "+", 
    RowBox[{"x", " ", 
     RowBox[{
      SubscriptBox["\[PartialD]", "y"], " ", 
      RowBox[{"u", "[", 
       RowBox[{"x", ",", "y"}], "]"}]}]}]}], " ", "\[Equal]", " ", 
   RowBox[{"Sin", "[", "x", "]"}]}], " ", "/.", " ", 
  RowBox[{"sol7", "[", 
   RowBox[{"[", "1", "]"}], "]"}]}]], "Input",
 CellChangeTimes->{{3.546729116828125*^9, 3.546729125265625*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"f7", "[", 
   RowBox[{"x_", ",", "y_"}], "]"}], ":=", " ", 
  RowBox[{
   RowBox[{
    RowBox[{"u", "[", 
     RowBox[{"x", ",", "y"}], "]"}], "/.", " ", 
    RowBox[{"sol7", "[", 
     RowBox[{"[", "1", "]"}], "]"}]}], " ", "/.", 
   RowBox[{
    RowBox[{
     RowBox[{"C", "[", "1", "]"}], "[", "a_", "]"}], "\[Rule]", " ", 
    RowBox[{"Sin", "[", "a", "]"}]}]}]}]], "Input",
 CellChangeTimes->{{3.54672914253125*^9, 3.546729224453125*^9}, {
  3.546730293875*^9, 3.546730300203125*^9}, {3.54673036096875*^9, 
  3.5467303655*^9}}],

Cell[BoxData[
 RowBox[{"f7", "[", 
  RowBox[{"x", ",", "y"}], "]"}]], "Input",
 CellChangeTimes->{{3.54672917371875*^9, 3.546729178125*^9}}],

Cell[BoxData[
 RowBox[{"Plot3D", "[", 
  RowBox[{
   RowBox[{"f7", "[", 
    RowBox[{"x", ",", "y"}], "]"}], ",", " ", 
   RowBox[{"{", 
    RowBox[{"x", ",", 
     RowBox[{"-", "2"}], ",", "2"}], "}"}], ",", " ", 
   RowBox[{"{", 
    RowBox[{"y", ",", 
     RowBox[{"-", "7"}], ",", "7"}], "}"}], ",", " ", 
   RowBox[{"PlotPoints", " ", "\[Rule]", " ", "30"}]}], "]"}]], "Input",
 CellChangeTimes->{{3.546730583828125*^9, 3.546730590625*^9}}]
}, Closed]],

Cell[CellGroupData[{

Cell[TextData[StyleBox["4 Linear System of ODEs",
 FontColor->RGBColor[0, 0, 1]]], "Subsection",
 CellChangeTimes->{{3.54654226884375*^9, 3.546542270078125*^9}, {
   3.54666874775*^9, 3.546668794359375*^9}, {3.5467262370625*^9, 
   3.546726237453125*^9}, 3.5765309471875*^9, {3.676002760112075*^9, 
   3.6760027603720756`*^9}, {3.7413326183536983`*^9, 
   3.7413326400814824`*^9}, {3.7413573360608597`*^9, 3.7413573450312886`*^9}}],

Cell[TextData[{
 "Consider the different equation  \n        2 y\[CloseCurlyQuote]\
\[CloseCurlyQuote]-5y\[CloseCurlyQuote]+y=0, y(3)=6, \
y\[CloseCurlyQuote](3)=-1 \nLet ",
 Cell[BoxData[
  FormBox[
   SubscriptBox["x", "1"], TraditionalForm]]],
 "(t)=y(t) and ",
 Cell[BoxData[
  FormBox[
   SubscriptBox["x", "2"], TraditionalForm]]],
 "(t)= y\[CloseCurlyQuote](t).\nThe different equation can be written as \
system of first order equations:\n       ",
 Cell[BoxData[
  FormBox[
   SubscriptBox["x", "1"], TraditionalForm]],
  FormatType->"TraditionalForm"],
 "\[CloseCurlyQuote]  = ",
 Cell[BoxData[
  FormBox[
   SubscriptBox["x", "2"], TraditionalForm]],
  FormatType->"TraditionalForm"],
 "\n",
 Cell[BoxData[
  FormBox[
   RowBox[{"         ", 
    SubscriptBox["x", "2"]}], TraditionalForm]],
  FormatType->"TraditionalForm"],
 "\[CloseCurlyQuote] = ",
 Cell[BoxData[
  FormBox[
   RowBox[{
    RowBox[{"-", 
     FractionBox["1", "2"]}], 
    SubscriptBox["x", "1"]}], TraditionalForm]],
  FormatType->"TraditionalForm"],
 "+",
 Cell[BoxData[
  FormBox[
   RowBox[{
    FractionBox["5", "2"], 
    SubscriptBox["x", "2"]}], TraditionalForm]]],
 "\n       ",
 Cell[BoxData[
  FormBox[
   SubscriptBox["x", "1"], TraditionalForm]]],
 "(3)=y(3)=6\n       ",
 Cell[BoxData[
  FormBox[
   SubscriptBox["x", "2"], TraditionalForm]]],
 "(3)= y\[CloseCurlyQuote](3)=-1\nIn matrix form X\[CloseCurlyQuote] = AX \
where X\[CloseCurlyQuote]= ",
 Cell[BoxData[
  FormBox[
   SuperscriptBox[
    RowBox[{"[", 
     RowBox[{
      RowBox[{
       FormBox[
        SubscriptBox["x", "1"],
        TraditionalForm], "'"}], ",", 
      RowBox[{
       FormBox[
        SubscriptBox["x", "2"],
        TraditionalForm], "'"}]}], "]"}], "T"], TraditionalForm]],
  FormatType->"TraditionalForm"],
 " and X = ",
 Cell[BoxData[
  FormBox[
   SuperscriptBox[
    RowBox[{"[", " ", 
     RowBox[{
      SubscriptBox["x", "1"], ",", 
      SubscriptBox["x", "2"]}], "]"}], "T"], TraditionalForm]]],
 ", we have \n      A =",
 Cell[BoxData[
  FormBox[
   RowBox[{"(", GridBox[{
      {"0", "1"},
      {
       RowBox[{
        RowBox[{"-", "1"}], "/", "2"}], 
       RowBox[{"5", "/", "2"}]}
     }], ")"}], TraditionalForm]],
  FormatType->"TraditionalForm"]
}], "DisplayText",
 CellChangeTimes->{{3.546542278359375*^9, 3.54654231034375*^9}, {
   3.5466675973125*^9, 3.5466676661875*^9}, {3.546667957234375*^9, 
   3.546667979109375*^9}, {3.546728898078125*^9, 3.546728900015625*^9}, {
   3.546728997078125*^9, 3.546729009140625*^9}, {3.741332666341694*^9, 
   3.74133272171808*^9}, {3.7413327543240147`*^9, 3.7413327555148582`*^9}, {
   3.7413328108063955`*^9, 3.7413328830907516`*^9}, {3.74133296267768*^9, 
   3.7413329964394627`*^9}, {3.7413330336768184`*^9, 
   3.7413330963384995`*^9}, {3.7413342263056965`*^9, 3.7413342280826597`*^9}, 
   3.7413342878640485`*^9, {3.7413573749561567`*^9, 3.7413574283020897`*^9}, {
   3.7413574732088776`*^9, 3.741357604073131*^9}, {3.741358098396883*^9, 
   3.7413582801933603`*^9}, {3.7413588069967995`*^9, 3.741358835006422*^9}, {
   3.74135907086059*^9, 3.741359101630169*^9}, {3.7413591833966756`*^9, 
   3.7413592579631524`*^9}, {3.7413596394730873`*^9, 
   3.7413597013568945`*^9}, {3.741360135403685*^9, 3.7413602293136177`*^9}}],

Cell[TextData[{
 "Method1: Solve for ",
 Cell[BoxData[
  FormBox[
   SubscriptBox["x", "1"], TraditionalForm]]],
 "[t] and ",
 Cell[BoxData[
  FormBox[
   SubscriptBox["x", "2"], TraditionalForm]],
  FormatType->"TraditionalForm"],
 "[t] using linear system in ",
 "explicit",
 " form:"
}], "Commentary",
 CellChangeTimes->{{3.5467255183125*^9, 3.54672552721875*^9}, {
  3.546725574234375*^9, 3.54672557825*^9}, {3.741333384370398*^9, 
  3.7413334289381742`*^9}, {3.7413577342087975`*^9, 3.7413577660069127`*^9}, {
  3.741357954107794*^9, 3.7413579582250137`*^9}, {3.7413580159596305`*^9, 
  3.7413580533814344`*^9}, {3.7413583272042465`*^9, 3.741358340586994*^9}}],

Cell[BoxData[
 RowBox[{"sol1", "=", 
  RowBox[{"DSolve", "[", 
   RowBox[{
    RowBox[{"{", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"x1", "'"}], "[", "t", "]"}], "\[Equal]", 
       RowBox[{"x2", "[", "t", "]"}]}], ",", 
      RowBox[{
       RowBox[{
        RowBox[{"x2", "'"}], "[", "t", "]"}], "\[Equal]", 
       RowBox[{
        RowBox[{
         RowBox[{"-", 
          RowBox[{"x1", "[", "t", "]"}]}], "/", "2"}], "+", 
        RowBox[{"5", " ", 
         RowBox[{
          RowBox[{"x2", "[", "t", "]"}], "/", "2"}]}]}]}]}], "}"}], ",", " ", 
    RowBox[{"{", 
     RowBox[{"x1", ",", "x2"}], "}"}], ",", "t"}], "]"}]}]], "Input",
 CellChangeTimes->{
  3.546724133359375*^9, {3.54672421003125*^9, 3.54672421478125*^9}, {
   3.74133321733014*^9, 3.7413332178868847`*^9}, {3.7413332530167503`*^9, 
   3.741333315693125*^9}, {3.741357633569087*^9, 3.7413577110730615`*^9}, {
   3.7413585111021357`*^9, 3.741358540287645*^9}, {3.7413592738549395`*^9, 
   3.741359290327222*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"f11", "[", "t_", "]"}], ":=", 
  RowBox[{"Simplify", "[", 
   RowBox[{
    RowBox[{"x1", "[", "t", "]"}], "/.", " ", 
    RowBox[{"sol1", "[", 
     RowBox[{"[", "1", "]"}], "]"}]}], " ", "]"}]}]], "Input",
 CellChangeTimes->{{3.741333486305134*^9, 3.741333499232849*^9}, {
   3.741333554276622*^9, 3.7413335694197397`*^9}, {3.74135779731043*^9, 
   3.741357801887706*^9}, 3.7413578375879545`*^9, 3.741359433263219*^9, {
   3.7413603512397413`*^9, 3.7413603598254223`*^9}}],

Cell[BoxData[
 RowBox[{"f11", "[", "t", "]"}]], "Input",
 CellChangeTimes->{{3.741333503101139*^9, 3.7413335094138107`*^9}, {
   3.7413335593770742`*^9, 3.741333573125555*^9}, 3.741359435105879*^9}],

Cell[BoxData[
 RowBox[{
  RowBox[{"f21", "[", "t_", "]"}], ":=", 
  RowBox[{"Simplify", "[", 
   RowBox[{
    RowBox[{"x2", "[", "t", "]"}], "/.", " ", 
    RowBox[{"sol1", "[", 
     RowBox[{"[", "1", "]"}], "]"}]}], " ", "]"}]}]], "Input",
 CellChangeTimes->{{3.74135788642883*^9, 3.7413578922253313`*^9}, {
   3.741357925302774*^9, 3.741357926896161*^9}, 3.741359436765885*^9, {
   3.7413603721073055`*^9, 3.741360377236894*^9}}],

Cell[BoxData[
 RowBox[{"f21", "[", "t", "]"}]], "Input",
 CellChangeTimes->{{3.7413578978960123`*^9, 3.7413579019061213`*^9}, 
   3.7413594379892035`*^9}],

Cell[TextData[{
 "Method2: Solve for ",
 Cell[BoxData[
  FormBox[
   SubscriptBox["x", "1"], TraditionalForm]]],
 "[t] and ",
 Cell[BoxData[
  FormBox[
   SubscriptBox["x", "2"], TraditionalForm]],
  FormatType->"TraditionalForm"],
 "[t] using linear system in matrix form:"
}], "Commentary",
 CellChangeTimes->{{3.5467255183125*^9, 3.54672552721875*^9}, {
  3.546725574234375*^9, 3.54672557825*^9}, {3.741333384370398*^9, 
  3.7413334289381742`*^9}, {3.741333594106167*^9, 3.7413336383529377`*^9}, {
  3.741333731087117*^9, 3.7413337317810373`*^9}, {3.7413337951937847`*^9, 
  3.7413337957846713`*^9}, {3.7413341432454576`*^9, 3.741334196477247*^9}, {
  3.7413580645011115`*^9, 3.7413580839176865`*^9}}],

Cell[BoxData[
 RowBox[{"A", " ", "=", 
  RowBox[{"{", 
   RowBox[{
    RowBox[{"{", 
     RowBox[{"0", ",", "1"}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{
       RowBox[{"-", "1"}], "/", "2"}], ",", 
      RowBox[{"5", "/", "2"}]}], "}"}]}], "}"}]}]], "Input",
 CellChangeTimes->{{3.7413336464386406`*^9, 3.7413336883248973`*^9}, {
  3.741334339204803*^9, 3.7413343404659395`*^9}, {3.741358356448679*^9, 
  3.7413583764675083`*^9}, {3.7413593549773517`*^9, 3.7413593602474527`*^9}}],

Cell[BoxData[
 RowBox[{"MatrixForm", "[", "A", "]"}]], "Input",
 CellChangeTimes->{{3.7413584226284533`*^9, 3.7413584355630317`*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"X", "[", "t_", "]"}], ":=", 
  RowBox[{"{", 
   RowBox[{
    RowBox[{"x1", "[", "t", "]"}], ",", 
    RowBox[{"x2", "[", "t", "]"}]}], "}"}]}]], "Input",
 CellChangeTimes->{{3.7413336943457623`*^9, 3.74133372310087*^9}, {
  3.7413338274866486`*^9, 3.741333828105316*^9}, {3.7413583850016437`*^9, 
  3.7413584066066475`*^9}}],

Cell[BoxData[
 RowBox[{"system", " ", "=", " ", 
  RowBox[{
   RowBox[{
    RowBox[{"X", "'"}], "[", "t", "]"}], " ", "\[Equal]", " ", 
   RowBox[{"A", ".", 
    RowBox[{"X", "[", "t", "]"}]}]}]}]], "Input",
 CellChangeTimes->{{3.7413337394787683`*^9, 3.741333741347065*^9}, {
  3.7413338307891207`*^9, 3.741333831915429*^9}, {3.741358449011317*^9, 
  3.7413584632511444`*^9}}],

Cell[BoxData[
 RowBox[{"sol2", "=", 
  RowBox[{"DSolve", "[", 
   RowBox[{"system", ",", " ", 
    RowBox[{"{", 
     RowBox[{"x1", ",", "x2"}], "}"}], ",", " ", "t"}], "]"}]}]], "Input",
 CellChangeTimes->{{3.741333779433011*^9, 3.741333782570627*^9}, {
   3.7413338772737665`*^9, 3.741333906595329*^9}, {3.7413340434502506`*^9, 
   3.741334044456477*^9}, {3.7413584770277615`*^9, 3.7413584984270515`*^9}, {
   3.741358554521947*^9, 3.7413585641067133`*^9}, 3.7413587394600334`*^9}],

Cell[BoxData[
 RowBox[{
  RowBox[{"f12", "[", "t_", "]"}], ":=", 
  RowBox[{"Simplify", "[", 
   RowBox[{
    RowBox[{"x1", "[", "t", "]"}], "/.", " ", 
    RowBox[{"sol2", "[", 
     RowBox[{"[", "1", "]"}], "]"}]}], " ", "]"}]}]], "Input",
 CellChangeTimes->{{3.7413594719824963`*^9, 3.7413594858767076`*^9}, {
  3.741360412497452*^9, 3.741360418377183*^9}}],

Cell[BoxData[
 RowBox[{"f12", "[", "t", "]"}]], "Input",
 CellChangeTimes->{{3.741359487817754*^9, 3.741359490674365*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"f22", "[", "t_", "]"}], ":=", 
  RowBox[{"Simplify", "[", 
   RowBox[{
    RowBox[{"x2", "[", "t", "]"}], "/.", " ", 
    RowBox[{"sol2", "[", 
     RowBox[{"[", "1", "]"}], "]"}]}], " ", "]"}]}]], "Input",
 CellChangeTimes->{{3.741359503184843*^9, 3.7413595217701664`*^9}, {
  3.741360430616639*^9, 3.7413604362163315`*^9}}],

Cell[BoxData[
 RowBox[{"f22", "[", "t", "]"}]], "Input",
 CellChangeTimes->{{3.7413595259394927`*^9, 3.741359528972872*^9}}],

Cell["Solve for C[1],C[2] :", "Commentary",
 CellChangeTimes->{{3.5467255183125*^9, 3.54672552721875*^9}, {
  3.546725574234375*^9, 3.54672557825*^9}, {3.741333384370398*^9, 
  3.7413334289381742`*^9}, {3.741333594106167*^9, 3.7413336383529377`*^9}, {
  3.741333731087117*^9, 3.7413337317810373`*^9}, {3.7413337910760365`*^9, 
  3.7413338134167047`*^9}, {3.7413341233500576`*^9, 3.7413341288382845`*^9}, {
  3.7413342116696296`*^9, 3.7413342460655723`*^9}, {3.741334280641903*^9, 
  3.741334293605322*^9}, {3.741359583139736*^9, 3.741359598403923*^9}}],

Cell[BoxData[
 RowBox[{"solc", "=", 
  RowBox[{"Solve", "[", 
   RowBox[{
    RowBox[{"{", 
     RowBox[{
      RowBox[{
       RowBox[{"f11", "[", "3", "]"}], "\[Equal]", "6"}], ",", 
      RowBox[{
       RowBox[{"f21", "[", "3", "]"}], "\[Equal]", 
       RowBox[{"-", "1"}]}]}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{"C", "[", "1", "]"}], ",", 
      RowBox[{"C", "[", "2", "]"}]}], "}"}]}], "]"}]}]], "Input",
 CellChangeTimes->{{3.741334107639989*^9, 3.7413341119368362`*^9}, {
   3.7413342578640823`*^9, 3.7413342972362604`*^9}, {3.7413597224043674`*^9, 
   3.7413598491386223`*^9}, {3.7413598823738785`*^9, 3.741359890685919*^9}, {
   3.7413599685986195`*^9, 3.741359971341955*^9}, 3.7413606961081*^9}],

Cell[BoxData[
 RowBox[{
  RowBox[{"y", "[", "t_", "]"}], ":=", 
  RowBox[{"Simplify", "[", 
   RowBox[{
    RowBox[{"f11", "[", "t", "]"}], "/.", " ", 
    RowBox[{"solc", "[", 
     RowBox[{"[", "1", "]"}], "]"}]}], "]"}]}]], "Input",
 CellChangeTimes->{{3.7413599142039785`*^9, 3.741359936889458*^9}, {
   3.741359974864044*^9, 3.741359982673809*^9}, {3.7413604812054377`*^9, 
   3.74136048775506*^9}, 3.7413611546035247`*^9, 3.7413611905964994`*^9}],

Cell[BoxData[
 RowBox[{
  RowBox[{"y", "[", "t", "]"}], " ", 
  RowBox[{"(*", " ", 
   RowBox[{
   "This", " ", "is", " ", "in", " ", "fact", " ", "the", " ", "particular", 
    " ", "solution", " ", "of", " ", "the", " ", "original", " ", 
    "equation"}], " ", "*)"}]}]], "Input",
 CellChangeTimes->{{3.741359985544227*^9, 3.7413599890100117`*^9}, {
  3.741361747028085*^9, 3.7413618018258877`*^9}}],

Cell[BoxData[
 RowBox[{"y", "[", "3", "]"}]], "Input",
 CellChangeTimes->{{3.741360007716423*^9, 3.7413600135449924`*^9}, {
  3.7413605258886557`*^9, 3.7413605292841973`*^9}, {3.7413605836171055`*^9, 
  3.74136059545123*^9}, {3.7413607425446854`*^9, 3.741360745067474*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"dy", "[", "t_", "]"}], ":=", " ", 
  RowBox[{"Simplify", "[", 
   RowBox[{
    RowBox[{"f21", "[", "t", "]"}], " ", "/.", " ", 
    RowBox[{"solc", "[", 
     RowBox[{"[", "1", "]"}], "]"}]}], "]"}]}]], "Input",
 CellChangeTimes->{{3.7413608332004128`*^9, 3.741360892310676*^9}, 
   3.7413611627953157`*^9, 3.7413612408450036`*^9}],

Cell[BoxData[
 RowBox[{"dy", "[", "t", "]"}]], "Input",
 CellChangeTimes->{{3.7413609002487497`*^9, 3.741360905857086*^9}}],

Cell[BoxData[
 RowBox[{"dy", "[", "3", "]"}]], "Input",
 CellChangeTimes->{{3.7413609150455246`*^9, 3.7413609190151377`*^9}}],

Cell[BoxData[
 RowBox[{"Simplify", "[", 
  RowBox[{"D", "[", 
   RowBox[{
    RowBox[{"y", "[", "t", "]"}], ",", "t"}], "]"}], "]"}]], "Input",
 CellChangeTimes->{{3.7413607659043393`*^9, 3.7413608428636403`*^9}, {
  3.7413609554699755`*^9, 3.7413609790378747`*^9}, {3.7413612590900617`*^9, 
  3.7413612852175703`*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"ddy", "[", "t_", "]"}], ":=", 
  RowBox[{"Simplify", "[", 
   RowBox[{"Evaluate", "[", 
    RowBox[{"D", "[", 
     RowBox[{
      RowBox[{"y", "[", "t", "]"}], ",", 
      RowBox[{"{", 
       RowBox[{"t", ",", "2"}], "}"}]}], "]"}], "]"}], "]"}]}]], "Input",
 CellChangeTimes->{{3.7413613455496783`*^9, 3.7413614334395857`*^9}, 
   3.7413614944042*^9}],

Cell[BoxData[
 RowBox[{"ddy", "[", "t", "]"}]], "Input",
 CellChangeTimes->{{3.74136141699651*^9, 3.7413614190505185`*^9}, 
   3.7413614996316442`*^9}],

Cell[BoxData[
 RowBox[{"Simplify", "[", 
  RowBox[{
   RowBox[{"2", " ", 
    RowBox[{"ddy", "[", "t", "]"}]}], "-", 
   RowBox[{"5", " ", 
    RowBox[{"dy", "[", "t", "]"}]}], "+", 
   RowBox[{"y", "[", "t", "]"}]}], "]"}]], "Input",
 CellChangeTimes->{{3.741361453074144*^9, 3.741361524799833*^9}}]
}, Closed]],

Cell[CellGroupData[{

Cell[TextData[StyleBox["5 Model with ODEs",
 FontColor->RGBColor[0, 0, 1]]], "Subsection",
 CellChangeTimes->{{3.54654226884375*^9, 3.546542270078125*^9}, {
   3.54666874775*^9, 3.546668794359375*^9}, {3.5467262370625*^9, 
   3.546726237453125*^9}, 3.5765309471875*^9, {3.676002760112075*^9, 
   3.6760027603720756`*^9}, {3.7413326183536983`*^9, 
   3.7413326400814824`*^9}, {3.74135733033331*^9, 3.7413573477055244`*^9}}],

Cell[TextData[{
 "It can be assumed in general that the rate of birth and the rate of death \
are proportional to the size of the population. Let N be the size of the \
population (as a function of time t) an k be a constant. Hence\n\t",
 Cell[BoxData[
  FormBox[
   FractionBox["dN", "dt"], TraditionalForm]],
  FontSize->14],
 StyleBox["=kN\t\t\t\t\t\t\t\n",
  FontSize->14],
 "If the population of Thailand is 42 million in 1975 and 56 million in 1990, \
what is the expected population in 2020?"
}], "DisplayText",
 CellChangeTimes->{{3.546542278359375*^9, 3.54654231034375*^9}, {
   3.5466675973125*^9, 3.5466676661875*^9}, {3.546667957234375*^9, 
   3.546667979109375*^9}, {3.546728898078125*^9, 3.546728900015625*^9}, {
   3.546728997078125*^9, 3.546729009140625*^9}, {3.741332666341694*^9, 
   3.74133272171808*^9}, {3.7413327543240147`*^9, 3.7413327555148582`*^9}, {
   3.7413328108063955`*^9, 3.7413328830907516`*^9}, {3.74133296267768*^9, 
   3.7413329964394627`*^9}, {3.7413330336768184`*^9, 
   3.7413330963384995`*^9}, {3.7413342263056965`*^9, 3.7413342280826597`*^9}, 
   3.7413342878640485`*^9, {3.7413591232347155`*^9, 3.741359129264493*^9}}],

Cell["\<\
Let n[t] = y[t] be the population size at  time t:\
\>", "Commentary",
 CellChangeTimes->{{3.5467255183125*^9, 3.54672552721875*^9}, {
  3.546725574234375*^9, 3.54672557825*^9}, {3.741333384370398*^9, 
  3.7413334289381742`*^9}}],

Cell[BoxData[
 RowBox[{"popsol", "=", 
  RowBox[{"DSolve", "[", 
   RowBox[{
    RowBox[{
     RowBox[{
      RowBox[{"n", "'"}], "[", "t", "]"}], "\[Equal]", 
     RowBox[{"k", " ", 
      RowBox[{"n", "[", "t", "]"}]}]}], ",", " ", "n", ",", "t"}], 
   "]"}]}]], "Input",
 CellChangeTimes->{
  3.546724133359375*^9, {3.54672421003125*^9, 3.54672421478125*^9}, {
   3.74133321733014*^9, 3.7413332178868847`*^9}, {3.7413332530167503`*^9, 
   3.741333315693125*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"f1", "[", "t_", "]"}], ":=", 
  RowBox[{
   RowBox[{"n", "[", "t", "]"}], "/.", " ", 
   RowBox[{"popsol", "[", 
    RowBox[{"[", "1", "]"}], "]"}], " "}]}]], "Input",
 CellChangeTimes->{{3.741333486305134*^9, 3.741333499232849*^9}, {
  3.741333554276622*^9, 3.7413335694197397`*^9}}],

Cell[BoxData[
 RowBox[{"f1", "[", "t", "]"}]], "Input",
 CellChangeTimes->{{3.741333503101139*^9, 3.7413335094138107`*^9}, {
  3.7413335593770742`*^9, 3.741333573125555*^9}}],

Cell["\<\
Solve for C[1] using \[OpenCurlyDoubleQuote]42 million in 1975\
\[CloseCurlyDoubleQuote] ==> n[0]=42:\
\>", "Commentary",
 CellChangeTimes->{{3.5467255183125*^9, 3.54672552721875*^9}, {
  3.546725574234375*^9, 3.54672557825*^9}, {3.741333384370398*^9, 
  3.7413334289381742`*^9}, {3.741333594106167*^9, 3.7413336383529377`*^9}, {
  3.741333731087117*^9, 3.7413337317810373`*^9}, {3.7413337951937847`*^9, 
  3.7413337957846713`*^9}, {3.7413341432454576`*^9, 3.741334196477247*^9}}],

Cell[BoxData[
 RowBox[{"solc1", "=", 
  RowBox[{"Solve", "[", 
   RowBox[{
    RowBox[{
     RowBox[{"f1", "[", "0", "]"}], "\[Equal]", "42"}], ",", 
    RowBox[{"C", "[", "1", "]"}], ",", " ", "Reals"}], "]"}]}]], "Input",
 CellChangeTimes->{{3.7413336464386406`*^9, 3.7413336883248973`*^9}, {
  3.741334339204803*^9, 3.7413343404659395`*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"f2", "[", "t_", "]"}], ":=", 
  RowBox[{
   RowBox[{"f1", "[", "t", "]"}], " ", "/.", " ", 
   RowBox[{"solc1", "[", 
    RowBox[{"[", "1", "]"}], "]"}]}]}]], "Input",
 CellChangeTimes->{{3.7413336943457623`*^9, 3.74133372310087*^9}, {
  3.7413338274866486`*^9, 3.741333828105316*^9}}],

Cell[BoxData[
 RowBox[{"f2", "[", "t", "]"}]], "Input",
 CellChangeTimes->{{3.7413337394787683`*^9, 3.741333741347065*^9}, {
  3.7413338307891207`*^9, 3.741333831915429*^9}}],

Cell["\<\
Solve for k using \[OpenCurlyDoubleQuote]56 million in 1990\
\[CloseCurlyDoubleQuote] ==> n[15]=56:\
\>", "Commentary",
 CellChangeTimes->{{3.5467255183125*^9, 3.54672552721875*^9}, {
  3.546725574234375*^9, 3.54672557825*^9}, {3.741333384370398*^9, 
  3.7413334289381742`*^9}, {3.741333594106167*^9, 3.7413336383529377`*^9}, {
  3.741333731087117*^9, 3.7413337317810373`*^9}, {3.7413337910760365`*^9, 
  3.7413338134167047`*^9}, {3.7413341780659704`*^9, 3.7413341867450294`*^9}}],

Cell[BoxData[
 RowBox[{"solk", "=", 
  RowBox[{"Solve", "[", 
   RowBox[{
    RowBox[{
     RowBox[{"f2", "[", "15", "]"}], "\[Equal]", "56"}], ",", " ", "k", ",", 
    " ", "Reals"}], "]"}]}]], "Input",
 CellChangeTimes->{{3.741333779433011*^9, 3.741333782570627*^9}, {
  3.7413338772737665`*^9, 3.741333906595329*^9}, {3.7413340434502506`*^9, 
  3.741334044456477*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"y", "[", "t_", "]"}], ":=", 
  RowBox[{
   RowBox[{"f2", "[", "t", "]"}], " ", "/.", " ", 
   RowBox[{"solk", "[", 
    RowBox[{"[", "1", "]"}], "]"}]}]}]], "Input",
 CellChangeTimes->{{3.741334074641669*^9, 3.7413340957437725`*^9}}],

Cell[BoxData[
 RowBox[{"y", "[", "t", "]"}]], "Input",
 CellChangeTimes->{{3.7413340983261843`*^9, 3.741334099724556*^9}}],

Cell["\<\
Solve for population in 2020 ==> n[45]:\
\>", "Commentary",
 CellChangeTimes->{{3.5467255183125*^9, 3.54672552721875*^9}, {
  3.546725574234375*^9, 3.54672557825*^9}, {3.741333384370398*^9, 
  3.7413334289381742`*^9}, {3.741333594106167*^9, 3.7413336383529377`*^9}, {
  3.741333731087117*^9, 3.7413337317810373`*^9}, {3.7413337910760365`*^9, 
  3.7413338134167047`*^9}, {3.7413341233500576`*^9, 3.7413341288382845`*^9}, {
  3.7413342116696296`*^9, 3.7413342460655723`*^9}, {3.741334280641903*^9, 
  3.741334293605322*^9}}],

Cell[BoxData[
 RowBox[{"N", "[", 
  RowBox[{"y", "[", "45", "]"}], "]"}]], "Input",
 CellChangeTimes->{{3.741334107639989*^9, 3.7413341119368362`*^9}, {
  3.7413342578640823`*^9, 3.7413342972362604`*^9}}]
}, Closed]]
}, Open  ]]
},
ScreenStyleEnvironment->"Working",
WindowSize->{1018, 610},
WindowMargins->{{40, Automatic}, {10, Automatic}},
ShowSelection->True,
Magnification->1.25,
FrontEndVersion->"9.0 for Microsoft Windows (64-bit) (January 25, 2013)",
StyleDefinitions->"Demo.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[545, 20, 735, 11, 122, "Title"],
Cell[CellGroupData[{
Cell[1305, 35, 176, 3, 92, "Section"],
Cell[CellGroupData[{
Cell[1506, 42, 233, 4, 46, "Subsection"],
Cell[1742, 48, 2736, 102, 195, "DisplayText"],
Cell[4481, 152, 453, 15, 57, "Input"],
Cell[4937, 169, 453, 15, 57, "Input"]
}, Closed]]
}, Open  ]],
Cell[CellGroupData[{
Cell[5439, 190, 327, 4, 92, "Section"],
Cell[CellGroupData[{
Cell[5791, 198, 424, 6, 46, "Subsection"],
Cell[6218, 206, 2833, 82, 109, "DisplayText"],
Cell[CellGroupData[{
Cell[9076, 292, 376, 6, 44, "Subsubsection"],
Cell[9455, 300, 146, 3, 46, "Input"],
Cell[9604, 305, 430, 13, 46, "Input"],
Cell[10037, 320, 428, 12, 46, "Input"],
Cell[10468, 334, 544, 14, 46, "Input"],
Cell[11015, 350, 144, 3, 46, "Input"],
Cell[11162, 355, 402, 11, 46, "Input"],
Cell[11567, 368, 165, 4, 46, "Input"],
Cell[11735, 374, 394, 11, 46, "Input"],
Cell[12132, 387, 786, 17, 46, "Input"],
Cell[12921, 406, 538, 12, 46, "Input"],
Cell[13462, 420, 663, 17, 46, "Input"],
Cell[14128, 439, 202, 4, 46, "Input"],
Cell[14333, 445, 945, 23, 75, "Input"],
Cell[15281, 470, 181, 4, 46, "Input"]
}, Closed]],
Cell[CellGroupData[{
Cell[15499, 479, 406, 7, 33, "Subsubsection"],
Cell[15908, 488, 561, 17, 46, "Input"],
Cell[16472, 507, 155, 2, 35, "Commentary"],
Cell[16630, 511, 375, 11, 46, "Input"],
Cell[17008, 524, 107, 1, 35, "Commentary"],
Cell[17118, 527, 348, 10, 46, "Input"],
Cell[17469, 539, 126, 2, 46, "Input"],
Cell[17598, 543, 265, 7, 46, "Input"],
Cell[17866, 552, 142, 3, 46, "Input"],
Cell[18011, 557, 517, 11, 46, "Input"],
Cell[18531, 570, 200, 4, 46, "Input"],
Cell[18734, 576, 156, 3, 46, "Input"],
Cell[18893, 581, 131, 1, 35, "Commentary"],
Cell[19027, 584, 531, 17, 46, "Input"],
Cell[19561, 603, 134, 1, 35, "Commentary"],
Cell[19698, 606, 1920, 58, 135, "DisplayText"],
Cell[21621, 666, 602, 18, 46, "Input"],
Cell[22226, 686, 263, 7, 46, "Input"],
Cell[22492, 695, 520, 11, 46, "Input"],
Cell[23015, 708, 556, 15, 46, "Input"],
Cell[23574, 725, 205, 4, 46, "Input"],
Cell[23782, 731, 680, 19, 75, "Input"],
Cell[24465, 752, 133, 3, 46, "Input"]
}, Closed]]
}, Open  ]],
Cell[CellGroupData[{
Cell[24647, 761, 370, 5, 46, "Subsection"],
Cell[CellGroupData[{
Cell[25042, 770, 421, 7, 44, "Subsubsection"],
Cell[25466, 779, 442, 13, 57, "Input"],
Cell[25911, 794, 388, 11, 57, "Input"],
Cell[26302, 807, 306, 9, 57, "Input"],
Cell[26611, 818, 125, 2, 57, "Input"],
Cell[26739, 822, 597, 17, 57, "Input"],
Cell[27339, 841, 226, 4, 57, "Input"],
Cell[27568, 847, 1195, 28, 93, "Input"]
}, Closed]],
Cell[CellGroupData[{
Cell[28800, 880, 470, 8, 33, "Subsubsection"],
Cell[29273, 890, 928, 23, 57, "Input"],
Cell[30204, 915, 355, 10, 57, "Input"],
Cell[30562, 927, 213, 5, 57, "Input"],
Cell[30778, 934, 125, 2, 57, "Input"],
Cell[30906, 938, 226, 7, 57, "Input"],
Cell[31135, 947, 368, 9, 57, "Input"],
Cell[31506, 958, 235, 4, 57, "Input"],
Cell[31744, 964, 633, 13, 57, "Input"],
Cell[32380, 979, 664, 19, 57, "Input"],
Cell[33047, 1000, 281, 9, 57, "Input"],
Cell[33331, 1011, 125, 2, 57, "Input"],
Cell[33459, 1015, 232, 6, 57, "Input"],
Cell[33694, 1023, 126, 2, 57, "Input"],
Cell[33823, 1027, 230, 6, 57, "Input"],
Cell[34056, 1035, 125, 2, 57, "Input"],
Cell[34184, 1039, 266, 7, 57, "Input"],
Cell[34453, 1048, 119, 2, 57, "Input"],
Cell[34575, 1052, 249, 6, 57, "Input"]
}, Closed]]
}, Open  ]],
Cell[CellGroupData[{
Cell[34873, 1064, 344, 5, 46, "Subsection"],
Cell[35220, 1071, 1452, 41, 172, "DisplayText"],
Cell[36675, 1114, 672, 19, 46, "Input"],
Cell[37350, 1135, 541, 16, 46, "Input"],
Cell[37894, 1153, 567, 16, 46, "Input"],
Cell[38464, 1171, 140, 3, 46, "Input"],
Cell[38607, 1176, 445, 12, 46, "Input"]
}, Closed]],
Cell[CellGroupData[{
Cell[39089, 1193, 431, 6, 38, "Subsection"],
Cell[39523, 1201, 3264, 99, 294, "DisplayText"],
Cell[42790, 1302, 665, 18, 28, "Commentary"],
Cell[43458, 1322, 1005, 27, 37, "Input"],
Cell[44466, 1351, 508, 11, 37, "Input"],
Cell[44977, 1364, 198, 3, 37, "Input"],
Cell[45178, 1369, 432, 10, 37, "Input"],
Cell[45613, 1381, 154, 3, 37, "Input"],
Cell[45770, 1386, 704, 17, 28, "Commentary"],
Cell[46477, 1405, 502, 13, 37, "Input"],
Cell[46982, 1420, 133, 2, 37, "Input"],
Cell[47118, 1424, 359, 9, 37, "Input"],
Cell[47480, 1435, 377, 9, 37, "Input"],
Cell[47860, 1446, 483, 9, 37, "Input"],
Cell[48346, 1457, 360, 9, 37, "Input"],
Cell[48709, 1468, 122, 2, 37, "Input"],
Cell[48834, 1472, 360, 9, 37, "Input"],
Cell[49197, 1483, 124, 2, 37, "Input"],
Cell[49324, 1487, 552, 7, 28, "Commentary"],
Cell[49879, 1496, 731, 18, 37, "Input"],
Cell[50613, 1516, 452, 10, 37, "Input"],
Cell[51068, 1528, 402, 9, 37, "Input"],
Cell[51473, 1539, 273, 4, 37, "Input"],
Cell[51749, 1545, 366, 9, 37, "Input"],
Cell[52118, 1556, 123, 2, 37, "Input"],
Cell[52244, 1560, 125, 2, 37, "Input"],
Cell[52372, 1564, 319, 7, 37, "Input"],
Cell[52694, 1573, 389, 11, 37, "Input"],
Cell[53086, 1586, 151, 3, 37, "Input"],
Cell[53240, 1591, 300, 8, 37, "Input"]
}, Closed]],
Cell[CellGroupData[{
Cell[53577, 1604, 422, 6, 38, "Subsection"],
Cell[54002, 1612, 1159, 21, 133, "DisplayText"],
Cell[55164, 1635, 239, 5, 28, "Commentary"],
Cell[55406, 1642, 465, 13, 37, "Input"],
Cell[55874, 1657, 319, 8, 37, "Input"],
Cell[56196, 1667, 174, 3, 37, "Input"],
Cell[56373, 1672, 490, 8, 28, "Commentary"],
Cell[56866, 1682, 344, 8, 37, "Input"],
Cell[57213, 1692, 320, 8, 37, "Input"],
Cell[57536, 1702, 174, 3, 37, "Input"],
Cell[57713, 1707, 490, 8, 28, "Commentary"],
Cell[58206, 1717, 371, 9, 37, "Input"],
Cell[58580, 1728, 268, 7, 37, "Input"],
Cell[58851, 1737, 122, 2, 37, "Input"],
Cell[58976, 1741, 532, 9, 28, "Commentary"],
Cell[59511, 1752, 204, 4, 37, "Input"]
}, Closed]]
}, Open  ]]
}
]
*)

(* End of internal cache information *)