(************** Content-type: application/mathematica ************** CreatedBy='Mathematica 4.2' Mathematica-Compatible Notebook This notebook can be used with any Mathematica-compatible application, such as Mathematica, MathReader or Publicon. The data for the notebook starts with the line containing stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. *******************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 7088, 225]*) (*NotebookOutlinePosition[ 7751, 248]*) (* CellTagsIndexPosition[ 7707, 244]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell["Iterative approximation for solutions of first order ODE's", "Section", FontWeight->"Bold"], Cell[BoxData[{ FormBox[ RowBox[{ StyleBox[\(The\ general\ first\ order\ ODE\ has\ the\ form\), "Text"], "\n"}], TextForm], "\n", FormBox[ RowBox[{" ", \(y'\ = \ f \((y, t)\)\), "\n", "\t"}], TextForm], "\n", FormBox[ RowBox[{\(where\ t\ is\ an\ independent\ variable\ and\ y\ is\ a\ \ function\ of\ t\ to\ be\ determined . \ \ In\ order\ to\ obtain\ a\ unique\ \ solution\ to\ this\ equation, \n one\ needs\ to\ further\ specify\ an\ initial\ condition\), " ", "\n"}], TextForm], "\n", FormBox[ RowBox[{" ", \(y \((t\_0)\)\ = \ y\_\(\(0\)\(\t\)\)\), "\n"}], TextForm], "\n", FormBox[\(for\ specific\ numbers\ \(t\_0\) and\ \ y\_0 . \ \ If\ an\ exact\ formula\ for\ the\ solution\ of\ \ this\ initial\ value\ cannot\ be\ found, \ then\ one\ can\ try\ to\ find\), TextForm], "\n", FormBox[ RowBox[{\(it\ approximately\ by\ picking\ an\ initial\ \(guess--\) - say\ y \((t)\)\ = \ 0\ and\ then\ defining\ a\ new\ \((and\ better)\)\ guess\ by\ \ setting\), "\n"}], TextForm], "\n", FormBox[ RowBox[{ " ", \(y \((t)\)\ = \ \[Integral]\_\(t\_0\)\%t f \((y \((s)\), s)\)\ ds\ + \ y\_\(\(0\)\(\t\)\)\), "\n"}], TextForm], "\n", FormBox[ RowBox[{\(In\ this\ worksheet, \ we\ demonstrate\ this\ approximation\ procedure\ in\ a\ couple\ of\ \ specific\ cases . \ \ \[IndentingNewLine]\[IndentingNewLine]First\ we\ \ consider\ the\ initial\ value\ problem\), "\n"}], TextForm], "\n", FormBox[ RowBox[{ " ", \(y' = \ \ \(y\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ y \((0)\)\ = \ 1\)\), "\n"}], TextForm], "\n", FormBox[\(whose\ solution\ we\ know\ to\ be\ e^ t . \ \ We\ start\ with\ \ y \((t)\)\ = \ 0\ as\ our\ first\ guess\ at\ a\ \(\(solution\)\(.\)\)\), TextForm]}], "Text", FontSize->16, FontWeight->"Bold"], Cell[BoxData[ \(f[y_, t_]\ := \ y\)], "Input", FontSize->16, FontWeight->"Bold"], Cell[BoxData[ \(guesses\ = \ {0}\)], "Input", FontSize->16, FontWeight->"Bold"], Cell[BoxData[ \(MatrixForm[ guesses\ = \ Append[guesses, Integrate[f[Last[guesses], t], {t, 0, t}] + 1]]\)], "Input", FontSize->16, FontWeight->"Bold"], Cell[BoxData[ \(Plot[Evaluate[guesses], {t, \(-1\), 1}]\)], "Input", FontSize->16, FontWeight->"Bold"], Cell[BoxData[""], "Input"], Cell["\<\ We can see the contracting behavior of this iteration by starting \ with two different functions and then improving them simultaneously using the method described above\ \>", "Text", FontSize->16, FontWeight->"Bold"], Cell[BoxData[{ \(\(pair\ = \ {Cos[t], t + 1};\)\), "\n", \(Plot[Evaluate[pair], {t, \(-1\), 1}, PlotRange \[Rule] {0, 3}]\)}], "Input", FontSize->16], Cell[BoxData[{ \(\(pair\ = \ {Integrate[f[First[pair], t], {t, 0, t}] + 1, \ \ \ Integrate[f[Last[pair], t], {t, 0, t}] + 1};\)\), "\n", \(Plot[Evaluate[pair], {t, \(-1\), 1}, PlotRange -> {0, 3}]\)}], "Input", FontSize->16, FontWeight->"Bold"], Cell[BoxData[ \(\(\(\[IndentingNewLine]\)\(\[IndentingNewLine]\)\(\[IndentingNewLine]\)\ \(\[IndentingNewLine]\)\(\[IndentingNewLine]\)\(\[IndentingNewLine]\)\)\)], \ "Input"], Cell["\<\ Now lets try an ODE we can't solve by hand: \ty' = y^2 + t^2 y(0) = 1\ \>", "Text", FontSize->16, FontWeight->"Bold"], Cell[BoxData[{ \(f[y_, t_]\ := \ y^2\ - \ t^3\), "\n", \(guesses\ = \ {1}\)}], "Input", FontSize->16], Cell[BoxData[{ \(MatrixForm[ guesses\ = \ Append[guesses, Integrate[f[Last[guesses], t], {t, 0, t}] + 1]]\), "\n", \(Plot[Evaluate[guesses], {t, \(-1\), 2}, PlotRange\ -> {0, 10}]\)}], "Input", FontSize->16, FontWeight->"Bold"], Cell["\<\ On what range of t values does this iteration appear to be \ converging?\ \>", "Text", FontSize->16, FontWeight->"Bold"], Cell["\<\ \ \>", "Text", FontSize->16], Cell["\<\ If you're not concerned about getting an exact formular for a \ solution to your ODE, you can use numerical integration. This time we choose \ a right hand side that cannot be integrated in closed form. We use the initial \ values t=0 and y=1 as before.\ \>", "Text", FontSize->16, FontWeight->"Bold"], Cell[BoxData[ \(\(\(f[y_, t_]\)\(\ \)\(:=\)\(\ \)\(Sqrt[ y^4\ + \ t^2]\)\(\ \)\)\)], "Input"], Cell[BoxData[ \(\(\(\[IndentingNewLine]\)\(\(guesses = \ {Interpolation[ Table[{t, 1}, {t, 0, 1, .01}]]};\)\[IndentingNewLine] \(plots\ = \ {Plot[\(Last[guesses]\)[t], {t, 0, 1}]};\)\)\)\)], "Input"], Cell[BoxData[{ \(\(guesses\ = \ Append[guesses, Interpolation[ Table[{t, NIntegrate[f[\(Last[guesses]\)[s], t], {s, 0, t}]\ + \ 1}, {t, 0, 1, .01}]]];\)\), "\[IndentingNewLine]", \(\(Plot[\(Last[guesses]\)[t], {t, 0, 1}, PlotRange \[Rule] {0, 10}];\)\)}], "Input"] }, Open ]] }, FrontEndVersion->"4.2 for X", ScreenRectangle->{{0, 1280}, {0, 1024}}, WindowSize->{1272, 938}, WindowMargins->{{0, Automatic}, {Automatic, 0}}, StyleDefinitions -> "Default.nb" ] (******************************************************************* Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. *******************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[1776, 53, 99, 1, 61, "Section"], Cell[1878, 56, 2070, 46, 557, "Text"], Cell[3951, 104, 89, 3, 33, "Input"], Cell[4043, 109, 88, 3, 33, "Input"], Cell[4134, 114, 186, 6, 33, "Input"], Cell[4323, 122, 110, 3, 33, "Input"], Cell[4436, 127, 26, 0, 27, "Input"], Cell[4465, 129, 231, 6, 66, "Text"], Cell[4699, 137, 168, 4, 57, "Input"], Cell[4870, 143, 271, 5, 57, "Input"], Cell[5144, 150, 179, 3, 123, "Input"], Cell[5326, 155, 154, 5, 66, "Text"], Cell[5483, 162, 115, 3, 57, "Input"], Cell[5601, 167, 275, 8, 57, "Input"], Cell[5879, 177, 134, 5, 40, "Text"], Cell[6016, 184, 46, 9, 182, "Text"], Cell[6065, 195, 318, 8, 66, "Text"], Cell[6386, 205, 106, 2, 27, "Input"], Cell[6495, 209, 221, 3, 59, "Input"], Cell[6719, 214, 353, 8, 43, "Input"] }, Open ]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)