(*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 3.0, MathReader 3.0, or any compatible application. The data for the notebook starts with the line of 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[ 9172, 295]*) (*NotebookOutlinePosition[ 10336, 332]*) (* CellTagsIndexPosition[ 10292, 328]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell[TextData[StyleBox["Demo 3.1", FontSize->22, FontWeight->"Bold", FontSlant->"Plain", FontTracking->"Extended", FontVariations->{"Underline"->True}]], "Subsubtitle"], Cell[CellGroupData[{ Cell["Solving Initial Value Problems for second order ODE's", "Section"], Cell["\<\ To solve a second order IVP we use DSolve with two initial \ conditions, and we transform the solution into a function of those two \ initial conditions. Because of the semicolon in the second button, the solution as a list of \ rules is calculated but not shown on the screen. Only the function is shown. \ \ \>", "Text"], Cell[BoxData[GridBox[{ { ButtonBox[ \(Second\ \(Order : \ \ General\ Initial\ Value\ Solution\)\)]}, { ButtonBox[\(Clear[y]; \n soln = \n\t DSolve[{\[SelectionPlaceholder]\ \[Equal] \[SelectionPlaceholder], y[\[SelectionPlaceholder]] \[Equal] c1, \(y'\)[\[SelectionPlaceholder]] == c2}, y[t], t]\n\t // Simplify; \n\ty[t_, c1_, c2_] = y[t] /. First[soln]\)]}, { ButtonBox["Plotting"]}, { ButtonBox[ \(Plot[Evaluate[ y[t, \[SelectionPlaceholder], \[SelectionPlaceholder]]], {t, \[SelectionPlaceholder]\ , \[SelectionPlaceholder]\ }\n\t, AspectRatio -> 1]\ \)]}, { ButtonBox[ \(Plot[Evaluate[ Table[y[t, c1, \[SelectionPlaceholder]], {c1, \[SelectionPlaceholder]\ , \[SelectionPlaceholder]\ , \[SelectionPlaceholder]\ }]], \n \t\t{t, \[SelectionPlaceholder]\ , \[SelectionPlaceholder]\ }, AspectRatio -> 1]\)]}, { ButtonBox[ \(Plot[Evaluate[ Table[y[t, \[SelectionPlaceholder], c2], {c2, \[SelectionPlaceholder]\ , \[SelectionPlaceholder]\ , \[SelectionPlaceholder]\ }]], \n \t\t{t, \[SelectionPlaceholder]\ , \[SelectionPlaceholder]\ }, AspectRatio -> 1]\)]} }, RowSpacings->0, ColumnSpacings->0, GridFrame->True, RowLines->True, GridDefaultElement:>ButtonBox[ "\\[Placeholder]"]]], "Input", CellMargins->{{Inherited, Inherited}, {5, Inherited}}, Evaluatable->True, CellGroupingRules->"InputGrouping", CellHorizontalScrolling->True, PageBreakAbove->True, PageBreakWithin->False, GroupPageBreakWithin->False, CellLabelMargins->{{11, Inherited}, {Inherited, Inherited}}, DefaultFormatType->DefaultInputFormatType, LineSpacing->{1.25, 0}, AutoItalicWords->{}, FormatType->InputForm, ScriptMinSize->9, ShowStringCharacters->True, NumberMarks->True, CounterIncrements->"Input", StyleMenuListing->None, FontFamily->"Courier", FontWeight->"Bold"], Cell[CellGroupData[{ Cell[TextData[{ "Example 1. ", StyleBox["y''+6y'+5y=0, y(0)=c1, y'(0)=c2", FontFamily->"Courier"] }], "Subsection"], Cell[BoxData[ \(\(Clear[y]; \n soln = \n\t DSolve[{\(\(y'\)'\)[t] + 6 \( y'\)[t] + 5 y[t]\ \[Equal] 0, y[0] \[Equal] c1, \(y'\)[0] == c2}, y[t], t]\n\t // Simplify; \n\t y[t_, c1_, c2_] = y[t] /. First[soln]\ \)\)], "Input"], Cell[BoxData[ \(Expand[y[t, c1, c2]]\)], "Input"], Cell["\<\ In the above expression the constants are precisely the initial \ conditions.\ \>", "Text"], Cell["\<\ The characteristic roots are -5 and -1. Note that all solutions \ tend to zero for t -> Infinity. We can plot the solution for a specific pair of initial conditions. \ \>", "Text"], Cell[BoxData[ \(\(Plot[y[t, 5, 10], {t, 0\ , 4\ }, AspectRatio -> 1]\ \)\)], "Input"], Cell[TextData[{ "The function y(t,5,10) is given as the sum of the two exponential \ functions ", Cell[BoxData[ \(TraditionalForm\`e\^\(-t\)\)]], " and ", Cell[BoxData[ \(TraditionalForm\`e\^\(\(-5\) t\)\)]], " in the following way" }], "Text"], Cell[BoxData[ \(Expand[y[t, 5, 10]]\)], "Input"], Cell[TextData[{ "Let us plot the three functions y(t,5,10) and -15/4", Cell[BoxData[ \(TraditionalForm\`\(\ e\^\(\(-5\) t\)\)\)]], " and 35/4 ", Cell[BoxData[ \(TraditionalForm\`e\^\(-t\)\)]], " in one graph so that we can see the superposition. " }], "Text"], Cell[BoxData[ \(\(Plot[{y[t, 5, 10], \(-15\)/4*Exp[\(-5\) t], 35/4*Exp[\(-t\)]}, \ \ \ \ \ \ \ \ \ \ {t, 0\ , 4\ }, AspectRatio -> 1]\ \)\)], "Input"], Cell["\<\ Back to the general solution y(t,c1,c2). We can also fix y'(0)=c2=10 (or any other number) and plot the solutions for \ several values of y(0)=c1. Thus, in the following graph all solutions start \ with a slope of 10. \ \>", "Text"], Cell[BoxData[ \(Plot[Evaluate[Table[y[t, c1, 10], {c1, \(-10\)\ , 10\ , 4\ }]], \n \t\t{t, 0\ , 5\ }, AspectRatio -> 1]\)], "Input"], Cell["\<\ Or we can fix y(0)=c1=1 (or any other number) and plot solutions \ for various values of y'(0).\ \>", "Text"], Cell[BoxData[ \(Plot[Evaluate[Table[y[t, 1, c2], {c2, \(-10\)\ , 10\ , 4\ }]], \n \t\t{t, 0\ , 4\ }, AspectRatio -> 1]\)], "Input"] }, Open ]], Cell[CellGroupData[{ Cell[TextData[{ "Example 2. ", StyleBox[" ", FontFamily->"Courier New"], StyleBox["y''-4y'-5y=0, y(1)=c1, y'(1)=c2", FontFamily->"Courier"], " " }], "Subsection"], Cell[BoxData[ \(Clear[y]; \n soln = \n\t DSolve[{\(\(y'\)'\)[t] - 4 \( y'\)[t] - 5 y[t]\ \[Equal] 0, y[1] \[Equal] c1, \(y'\)[1] == c2}, y[t], t]\n\t // Simplify; \n\t y[t_, c1_, c2_] = y[t] /. First[soln]\)], "Input"], Cell[BoxData[ \(Expand[y[t, c1, c2]]\)], "Input"], Cell["\<\ The characteristic roots are -1 and 5. In this case the solutions \ tend to + or - Infinity if the coefficient 1/6(c1+c2) is nonzero. The solution tends to zero for t -> Infinity if and only if c1 + c2 = 0 \ .\ \>", "Text"], Cell[BoxData[ \(Plot[Evaluate[Table[y[t, c1, 5], {c1, \(-15\)\ , 15\ , 5\ }]], \n \t\t{t, 0\ , 2\ }, AspectRatio -> 1]\)], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Example 3. y'' + 0.2 y' + 1.01 y = 0 and \ y'' + 1.01 y = 0\ \>", "Subsection"], Cell["\<\ This is an example, where the characteristic equations both have \ complex roots. In this case, the solutions show a type of oscillation, \ described by sine and cosine functions. This will be studied in section 3.4 \ of the textbook. \ \>", "Text"], Cell[BoxData[ \(\(Clear[y]; \n soln = \n\t DSolve[{\(\(y'\)'\)[t]\ + 1/5*\(y'\)[t] + 101/100*y[t]\ \[Equal] 0, y[0] \[Equal] 1, \(y'\)[0] == 0}, y[t], t]\ // \ Simplify; \n y[t_] = y[t]\ /. \ First[soln]\ \)\)], "Input"], Cell["\<\ Let us compare the graph of the solution with the solution of the \ differential equation y'' +1.01 y = 0, where the term involving y' is deleted. \ \>", "Text"], Cell[BoxData[ \(Clear[u]; \n solnu = DSolve[{\(\(u'\)'\)[t] + 101/100*u[t] == 0, u[0] == 1, \(u'\)[0] == 0}, u[t], t] // Simplify; \ u[t_] = u[t] /. First[solnu]\)], "Input"], Cell[BoxData[ \(Plot[{y[t], u[t]}, {t, \(-1\)\ , 40}]\)], "Input"], Cell["These are examples of oscillations and damped oscillations. ", "Text"] }, Open ]] }, Open ]] }, Open ]] }, FrontEndVersion->"Macintosh 3.0", ScreenRectangle->{{0, 1024}, {0, 748}}, WindowToolbars->"EditBar", WindowSize->{639, 630}, WindowMargins->{{89, Automatic}, {Automatic, 11}}, PrintingCopies->1, PrintingPageRange->{1, Automatic}, PrivateNotebookOptions->{"ColorPalette"->{RGBColor, 128}}, ShowCellLabel->True, ShowCellTags->False, RenderingOptions->{"ObjectDithering"->True, "RasterDithering"->False}, CharacterEncoding->"MacintoshAutomaticEncoding", Magnification->1.25, MacintoshSystemPageSetup->"\<\ 00<0004/0B`000002n88o?mooh<" ] (*********************************************************************** 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[1731, 51, 178, 5, 73, "Subsubtitle"], Cell[CellGroupData[{ Cell[1934, 60, 72, 0, 62, "Section"], Cell[2009, 62, 335, 7, 93, "Text"], Cell[2347, 71, 2356, 65, 295, "Input", Evaluatable->True, CellGroupingRules->"InputGrouping", PageBreakAbove->True, PageBreakWithin->False, CounterIncrements->"Input"], Cell[CellGroupData[{ Cell[4728, 140, 141, 4, 58, "Subsection"], Cell[4872, 146, 257, 5, 128, "Input"], Cell[5132, 153, 53, 1, 33, "Input"], Cell[5188, 156, 101, 3, 36, "Text"], Cell[5292, 161, 195, 5, 55, "Text"], Cell[5490, 168, 89, 1, 33, "Input"], Cell[5582, 171, 266, 9, 56, "Text"], Cell[5851, 182, 52, 1, 33, "Input"], Cell[5906, 185, 281, 8, 56, "Text"], Cell[6190, 195, 161, 2, 52, "Input"], Cell[6354, 199, 243, 5, 74, "Text"], Cell[6600, 206, 142, 2, 52, "Input"], Cell[6745, 210, 119, 3, 36, "Text"], Cell[6867, 215, 141, 2, 52, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[7045, 222, 196, 7, 58, "Subsection"], Cell[7244, 231, 251, 5, 128, "Input"], Cell[7498, 238, 53, 1, 33, "Input"], Cell[7554, 241, 234, 6, 74, "Text"], Cell[7791, 249, 141, 2, 52, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[7969, 256, 113, 3, 58, "Subsection"], Cell[8085, 261, 259, 5, 74, "Text"], Cell[8347, 268, 255, 5, 109, "Input"], Cell[8605, 275, 172, 4, 55, "Text"], Cell[8780, 281, 200, 4, 90, "Input"], Cell[8983, 287, 70, 1, 33, "Input"], Cell[9056, 290, 76, 0, 36, "Text"] }, Open ]] }, Open ]] }, Open ]] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)