(************** Content-type: application/mathematica ************** CreatedBy='Mathematica 5.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[ 7646, 272]*) (*NotebookOutlinePosition[ 9367, 321]*) (* CellTagsIndexPosition[ 9097, 312]*) (*WindowFrame->Normal*) Notebook[{ Cell["First-Order Ordinary Differential Equations", "Title"], Cell[CellGroupData[{ Cell["\<\ Using DSolve to find symbolic solutions to differential \ equations\ \>", "Subtitle"], Cell[TextData[{ StyleBox["Mathematica", FontSlant->"Italic"], " can solve the homogeneous linear ODE:" }], "Subsubtitle"], Cell[BoxData[ \(DSolve[\(y'\)[x]\ + \ p[x]\ y[x]\ \[Equal] 0, y[x], x]\)], "Input"], Cell[CellGroupData[{ Cell[TextData[{ "The dummy integration variables and any integration constants are picked \ by ", StyleBox["Mathematica", FontSlant->"Italic"], " . Note that we asked ", StyleBox["Mathematica", FontSlant->"Italic"], " to solve the most general form of homogeneous linear first-order ODE, and \ we got a solution in a very general form that is equivalent to that found in \ textbooks. Here is a more specific problem and the solution found by ", StyleBox["Mathematica", FontSlant->"Italic"], ":" }], "Section"], Cell[BoxData[ \(DSolve[\(y'\)[x] + \((2\ x + 1)\) y[x]\ \[Equal] 0, \ y[x], x]\)], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Boundary conditions are introduced in the following way to generate \ a particular solution:\ \>", "Section"], Cell[BoxData[ \(DSolve[{\(y'\)[x] + \((2\ x + 1)\) y[x]\ \[Equal] 0, y[0] == 4}, \ y[x], x]\)], "Input", CellTags->"mmtag:20:DSolve[]__using_boundary_conditions"], Cell[TextData[{ StyleBox["Mathematica", FontSlant->"Italic"], " can solve the heterogeneous linear ODE:" }], "Subsubtitle"], Cell[BoxData[ \(DSolve[\(y'\)[x]\ + \ p[x]\ y[x]\ \[Equal] r[x], y[x], x]\)], "Input"] }, Open ]], Cell[TextData[{ "Again, we asked ", StyleBox["Mathematica", FontSlant->"Italic"], " to solve the most general form of homogeneous linear first-order ODE, and \ we got a solution in a very general form. Here is a more specific problem \ and the solution found by ", StyleBox["Mathematica", FontSlant->"Italic"] }], "Section"], Cell[BoxData[ \(DSolve[\(y'\)[x]\ - \ y[x]\ \[Equal] \[ExponentialE]\^\(2 x\), y[x], x]\)], "Input"], Cell[TextData[{ "The Bernoulli equation is a first-order ", StyleBox["nonlinear", FontSlant->"Italic"], " ODE that has a form that can be reduced to a linear ODE as described in \ Kreyszig, pp. 36\[Dash]38." }], "Subsubtitle", CellTags->"mmtag:20:Bernoulli_equation"], Cell[BoxData[ \(BernoulliEquation\ = \ \(y'\)[x]\ + \ p[x]\ y[x]\ == \ r[x]\ \((y[x])\)^\((a)\)\)], "Input"], Cell[TextData[{ "The substitution ", "y(x) = ", Cell[BoxData[ \(TraditionalForm\`\((u \((x)\))\)\^\(1/\((1 - a)\)\)\)]], "is made, resulting in a linear ODE that can be solved for ", StyleBox["u", FontSlant->"Italic"], "(", StyleBox["x", FontSlant->"Italic"], "):" }], "Subsubtitle"], Cell[BoxData[{ \(yRep\ = \ u[x]\^\(1\/\(1 - a\)\)\), "\[IndentingNewLine]", \(DyRep\ = \ D[yRep, x]\)}], "Input"], Cell[BoxData[ \(step1\ = BernoulliEquation /. {y[x] \[Rule] yRep, \(y'\)[x]\ \[Rule] \ DyRep}\)], "Input"], Cell[BoxData[ \(step2\ = PowerExpand[step1]\)], "Input"], Cell[BoxData[ \(step3\ = Simplify[step2]\)], "Input"], Cell[BoxData[ \(Solve[step3, \(u'\)[x]]\)], "Input"], Cell[TextData[{ "This last result is the first-order ", StyleBox["linear", FontSlant->"Italic"], " ODE that results from the Bernoulli equation. Its solution gives the \ function ", StyleBox["u", FontSlant->"Italic"], "(", StyleBox["x", FontSlant->"Italic"], ") which can be converted back to ", StyleBox["y", FontSlant->"Italic"], "(", StyleBox["x", FontSlant->"Italic"], ") with the relation ", StyleBox["y", FontSlant->"Italic"], "(", StyleBox["x", FontSlant->"Italic"], ") = ", Cell[BoxData[ \(TraditionalForm\`\((u \((x)\))\)\^\(1/\((1 - a)\)\)\)]], "." }], "Subsection"] }, Open ]], Cell[CellGroupData[{ Cell["Numerical Solutions to ODEs", "Subtitle"], Cell["\<\ The following nonlinear ODE either does not have a solution, or \ takes too long to find.\ \>", "Section"], Cell[BoxData[ \(DSolve[Sin[2\ Pi\ \(y'\)[x]^2]\ == \ y[x] x, y[x], x]\)], "Input"], Cell["\<\ NDSolve is a numerical method for finding a solution. An initial \ condition and the desired range of solution are required.\ \>", "Section"], Cell[BoxData[ \(solution\ = NDSolve[{Sin[2\ Pi\ \(y'\)[x]^2]\ == \ y[x]\ x, y[0] == 1}, y, {x, 0, 3.5}]\)], "Input", CellTags->"mmtag:20:NDSolve[]"], Cell[TextData[{ "The results look kind of strange, perhaps, but they are a set of rules \ that provide a function that interpolates between values. \n Here is how \ to find the approximate solution at three different values of ", StyleBox["x", FontSlant->"Italic"], " on the specified interval:" }], "Subsection", CellTags->"mmtag:20:numerical_solutions_to_ODEs__interpolation_results"], Cell[BoxData[ \(y[0.5]\ /. \ solution\)], "Input"], Cell[BoxData[ \(y[1] /. solution\)], "Input"], Cell[BoxData[ \(y[Pi] /. solution\)], "Input"], Cell[TextData[{ "Note that ", StyleBox["Mathematica", FontSlant->"Italic"], " has found two solutions, the first is real and the second is complex. \ Below are plots of the real and imaginary parts for both solutions:" }], "Section"], Cell[BoxData[ \(Plot[Evaluate[Re[y[x] /. solution]], {x, 0, 3.5}, PlotStyle \[Rule] {{Hue[1], Thickness[0.01]}, {Hue[0.6], Thickness[0.01]}}]\)], "Input"], Cell[BoxData[ \(Plot[Evaluate[Im[y[x] /. solution]], {x, 0, 3.5}, PlotStyle \[Rule] {{Hue[1], Thickness[0.01]}, {Hue[0.6], Thickness[0.01]}}]\)], "Input"], Cell[TextData[{ "Note that for ", StyleBox["x", FontSlant->"Italic"], " < 0.85 (approximately), both solutions are real." }], "Section"] }, Open ]] }, FrontEndVersion->"5.2 for Macintosh", ScreenRectangle->{{4, 1280}, {0, 832}}, CellGrouping->Manual, WindowSize->{1269, 1027}, WindowMargins->{{Automatic, -1587}, {Automatic, 1}}, WindowTitle->"Lecture 20 MIT 3.016 (Fall 2006) \[Copyright] W. Craig Carter \ 2003-2006", PrintingCopies->1, PrintingPageRange->{1, Automatic}, ShowCellLabel->False, CellLabelAutoDelete->True, StyleDefinitions -> "3016_Carter.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->{ "mmtag:20:DSolve[]__using_boundary_conditions"->{ Cell[2986, 99, 176, 3, 42, "Input", CellTags->"mmtag:20:DSolve[]__using_boundary_conditions"]}, "mmtag:20:Bernoulli_equation"->{ Cell[3867, 129, 279, 7, 54, "Subsubtitle", CellTags->"mmtag:20:Bernoulli_equation"]}, "mmtag:20:NDSolve[]"->{ Cell[6132, 221, 172, 4, 42, "Input", CellTags->"mmtag:20:NDSolve[]"]}, "mmtag:20:numerical_solutions_to_ODEs__interpolation_results"->{ Cell[6307, 227, 403, 8, 82, "Subsection", CellTags-> "mmtag:20:numerical_solutions_to_ODEs__interpolation_results"]} } *) (*CellTagsIndex CellTagsIndex->{ {"mmtag:20:DSolve[]__using_boundary_conditions", 8527, 295}, {"mmtag:20:Bernoulli_equation", 8668, 298}, {"mmtag:20:NDSolve[]", 8790, 301}, {"mmtag:20:numerical_solutions_to_ODEs__interpolation_results", 8938, 304} } *) (*NotebookFileOutline Notebook[{ Cell[1754, 51, 60, 0, 76, "Title"], Cell[CellGroupData[{ Cell[1839, 55, 96, 3, 61, "Subtitle"], Cell[1938, 60, 129, 4, 31, "Subsubtitle"], Cell[2070, 66, 89, 1, 42, "Input"], Cell[CellGroupData[{ Cell[2184, 71, 537, 14, 136, "Section"], Cell[2724, 87, 103, 2, 42, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[2864, 94, 119, 3, 49, "Section"], Cell[2986, 99, 176, 3, 42, "Input", CellTags->"mmtag:20:DSolve[]__using_boundary_conditions"], Cell[3165, 104, 131, 4, 31, "Subsubtitle"], Cell[3299, 110, 92, 1, 42, "Input"] }, Open ]], Cell[3406, 114, 341, 9, 78, "Section"], Cell[3750, 125, 114, 2, 49, "Input"], Cell[3867, 129, 279, 7, 54, "Subsubtitle", CellTags->"mmtag:20:Bernoulli_equation"], Cell[4149, 138, 124, 2, 42, "Input"], Cell[4276, 142, 313, 12, 32, "Subsubtitle"], Cell[4592, 156, 124, 2, 68, "Input"], Cell[4719, 160, 132, 3, 42, "Input"], Cell[4854, 165, 61, 1, 42, "Input"], Cell[4918, 168, 58, 1, 42, "Input"], Cell[4979, 171, 56, 1, 42, "Input"], Cell[5038, 174, 644, 27, 82, "Subsection"] }, Open ]], Cell[CellGroupData[{ Cell[5719, 206, 47, 0, 61, "Subtitle"], Cell[5769, 208, 116, 3, 49, "Section"], Cell[5888, 213, 87, 1, 42, "Input"], Cell[5978, 216, 151, 3, 49, "Section"], Cell[6132, 221, 172, 4, 42, "Input", CellTags->"mmtag:20:NDSolve[]"], Cell[6307, 227, 403, 8, 82, "Subsection", CellTags->"mmtag:20:numerical_solutions_to_ODEs__interpolation_results"], Cell[6713, 237, 55, 1, 42, "Input"], Cell[6771, 240, 49, 1, 42, "Input"], Cell[6823, 243, 50, 1, 42, "Input"], Cell[6876, 246, 243, 6, 78, "Section"], Cell[7122, 254, 178, 3, 42, "Input"], Cell[7303, 259, 178, 3, 42, "Input"], Cell[7484, 264, 146, 5, 49, "Section"] }, Open ]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)