(************** Content-type: application/mathematica ************** 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[ 14329, 464]*) (*NotebookOutlinePosition[ 15189, 495]*) (* CellTagsIndexPosition[ 15145, 491]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{Cell["\<\ Example 08 Series, Limits, Numerical Determination of Roots of Equations, and Numerical \ Integration\ \>", "Title", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "Copyright ", StyleBox["\[Copyright]", FontSlant->"Plain"], " 1993 by Bill Titus, Carleton College, \nDepartment of Physics and \ Astronomy, Northfield, MN 55057-4025\nSeptember 6, 1993" }], "Subsubtitle", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell["Topics and Skills", "Section", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "1. Finding limits using ", StyleBox["Limit[]", FontFamily->"Courier"], ".\n2. Determining Taylor Series expansions with ", StyleBox["Series[]", FontFamily->"Courier"], " and ", StyleBox["Normal[]", FontFamily->"Courier"], ".\n3. Using ", StyleBox["FindRoot[]", FontFamily->"Courier"], " to determine the roots of an equation numerically.\n4. Other MMA \"root\ \" commands.\n5. Numerical integration with ", StyleBox["NIntegrate[]", FontFamily->"Courier"], "." }], "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["Problem", "Section", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "Sarah, the rocketeer, is in free fall but is controlling her downward \ acceleration so that a[t] = - g e", StyleBox["-ct", FontVariations->{"CompatibilityType"->"Superscript"}], " , where c is a positive constant. Assume that Sarah starts at a height \ x[0] above the ground with zero initial velocity." }], "Special1", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "a. Set up equations for v[t] and x[t] as functions of c and t \ using MMA's ", StyleBox["Integrate[]", FontFamily->"Courier"], " function." }], "Special1", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ b. Show that these equations reduce to the appropriate free fall results \ when c is zero.\ \>", "Special1", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ c. Find the value of the time to at which Sarah strikes the ground.\ \>", "Special1", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "d. Now suppose a[t] = -g cos[sin[ct]]. Set up equations for v[t] and \ x[t] as functions of c and t using MMA's ", StyleBox["NIntegrate[]", FontFamily->"Courier"], " function. Then plot v[t] and x[t] from t = 0.0 to t = 8.0 using \ x[0] = 100, g = 9.8, and c = 0.5." }], "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["Solution - Part a", "Section", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell[TextData[{ "Step 1 - Using ", StyleBox["Integrate[]", FontFamily->"Courier"], ", complete the following code that defines a, v, and x as functions \ of c and t." }], "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ Clear[c, g, xo, a, v, x, t, s] a[c_, t_] = -g Exp[-c t] v[c_, t_] = x[c_, t_] = xo + \ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["Comment 1", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["1. Do your results look reasonable?", "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]]}, Open]], Cell[CellGroupData[{Cell["Solution - Part b", "Section", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ Step 1 - Try to evaluate your functions at c = 0. Describe what happens.\ \>", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell["Comment 1", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "1. Infinities and indeterminate results occur for v and x.\n a. \ ", StyleBox["Infinity", FontFamily->"Courier"], " is a positive real infinite quantity.\n b. ", StyleBox["-Infinity", FontFamily->"Courier"], " is a negative real infinite quantity.\n c. ", StyleBox["ComplexInfinity", FontFamily->"Courier"], " is a quantity with infinite magnitude, but \n undetermined \ complex phase.\n d. ", StyleBox["Indeterminate", FontFamily->"Courier"], " is a numerical quantity whose magnitude can't be \n determined." }], "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell["\<\ Step 2 - You can find the limiting results using a MMA function. Any guess \ what it's called? Use Appendix 8 in Wolfram to find out about this command \ and then apply the command to determine the three desired limits.\ \>", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "Step 3 - Some physicists would find these limits by doing Taylor Series \ expansions on the functions about c = 0. Find out information about the \ MMA command ", StyleBox["Series[]", FontFamily->"Courier"], " and apply it to determine the Taylor Series expansion of ", StyleBox["x[c, t] ", FontFamily->"Courier"], "to third order. Name the latter expression ", StyleBox["xSeries", FontFamily->"Courier"], " so you can refer to it later." }], "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell["Comment 3", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "1. What's the error message telling you?\n2. What's the meaning of the \ term ", StyleBox["O[c]", FontFamily->"Courier"], StyleBox["4", FontFamily->"Courier", FontVariations->{"CompatibilityType"->"Superscript"}], "? " }], "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[TextData[{ "Step 4 - For c = 0.5, xo = 100, and g = 9.8, plot the third order \ approximation to ", StyleBox["x[c, t]", FontFamily->"Courier"], " and the corresponding exact result on the same graph. To convert ", StyleBox["xSeries", FontFamily->"Courier"], " into a function, you must first remove the order term. To do so, use \ the MMA command ", StyleBox["Normal[]", FontFamily->"Courier"], ". Find out about this command and use it to produce a function ", StyleBox["xApprox[c, t] ", FontFamily->"Courier"], "which gives the desired third order approximation. Then create the plot \ over the time interval between t = 0.0 and t = 8.0." }], "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell["Comment 4", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "1. What ", StyleBox["Plot[]", FontFamily->"Courier"], " options did you used? \n2. How might you effectively use color in your \ plot? " }], "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]]}, Open]], Cell[CellGroupData[{Cell["Solution - Part c", "Section", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "Step 1 - Try to use ", StyleBox["Solve[]", FontFamily->"Courier"], " to find the time to at which Sarah strikes the ground. Be sure to use \ ", StyleBox["Clear[g, xo, c, to] ", FontFamily->"Courier"], " before you invoke ", StyleBox["Solve[]", FontFamily->"Courier"], ". Why? What do you find? " }], "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell["Comment 1", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ 1. Did you use double equal signs for the equation? 2. Remember, if MMA can't valuate something, it will echo what you typed \ back to the screen. 3. Why can't this equation to solved symbolically. 4. What are two possible ways you might solve it?\ \>", "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[TextData[{ "Step 2 - Assume c = 0.5, xo = 100, and g = 9.8. First make a plot of \ ", StyleBox["x[c, t]", FontFamily->"Courier"], " to estimate the time to where x[to] is zero. What do you find?" }], "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell["Comment 2", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "1. You should find that to is about 7.1. Remember, you can press the \ ", StyleBox["", FontFamily->"Helvetica"], " key and move the mouse to read off coordinates from a graph." }], "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[TextData[{ "Step 3 - You can improve your estimation by numerically determining the \ root of the equation ", StyleBox["x[0.5, t] == 0", FontFamily->"Courier"], ". The MMA command to do this numerical calculation is ", StyleBox["FindRoot[]", FontFamily->"Courier"], ". Find out information about this command and use it to determine to. \ Call the result ", StyleBox["myRoot", FontFamily->"Courier"], ". Then find the values for x[to] and v[to] using replacement rules." }], "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell["Comment 3", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "1. The ", StyleBox["FindRoot[]", FontFamily->"Courier"], " algorithm uses Newton's method, so the derivatives can't be too small. \ If there are multiple zeros, you may not get the root you want -- that's why \ a graph is very helpful.\n2. There are other MMA functions that find roots \ of equations: ", StyleBox["Roots[]", FontFamily->"Courier"], ", ", StyleBox["NRoot[]", FontFamily->"Courier"], ", and ", StyleBox["NSolve[]", FontFamily->"Courier"], ". You may want to explore these commands later." }], "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]]}, Open]], Cell[CellGroupData[{Cell["Solution - Part d", "Section", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ Step 1 - Suppose Sarah's acceleration is given by -g cos[sin[c t]] with c \ = 0.5, xo = 100, and g = 9.8. Cut and paste the equations from Step 1 of \ Part a. Change the expression for the acceleration to the desired form and \ activate the cell. What the output implying?\ \>", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell["Comment 1", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ 1. If you can't integrate something symbolically, what might you try?\ \>", "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell[TextData[{ "Step 2 - Get information of the MMA command ", StyleBox["NIntegrate[]", FontFamily->"Courier"], ". What do you find? Apply this function to determine the following \ integrals" }], "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "1/(1 + Exp[x]) ", StyleBox["from", FontFamily->"Times"], " 0 ", StyleBox["to", FontFamily->"Times"], " Infinite\nExp[Cos[x]] ", StyleBox["from", FontFamily->"Times"], " 0 ", StyleBox["to", FontFamily->"Times"], " 2 Pi\nSin[x] BesselJ[0, x] ", StyleBox["from", FontFamily->"Times"], " 0 ", StyleBox["to", FontFamily->"Times"], " 1" }], "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell[TextData[{ "Step 3 - The following code defines v and x in terms of ", StyleBox["NIntegrate[]", FontFamily->"Courier"], ". Look over the code and then activate the cell. " }], "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ Clear[c, g, xo, a, v, x, t, s] a[c_, t_] = -g Cos[Sin[c t]]; v[c_, t_] := NIntegrate[a[c, s], {s, 0, t}] x[c_, t_] := xo + NIntegrate[v[c, s], {s, 0, t}]\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["Comment 3", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "1. Why is ", StyleBox["SetDelayed[]", FontFamily->"Courier"], " used to define ", StyleBox["v[] ", FontFamily->"Courier"], " and ", StyleBox["x[]", FontFamily->"Courier"], "?\n1. Note that ", StyleBox["SetDelayed[]", FontFamily->"Courier"], " does not echo its results to the screen." }], "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell["\<\ Step 4 - Use these function to plot Sarah's velocity and position from t = \ 0.0 and t = 8.0 for the parameters g = 9.8, xo = 100, and c = 0.5. Be \ sure to label the axes on your plot.\ \>", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell["Comment 4", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["1. Why did it take so long to do the plots?", "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]]}, Open]], Cell[CellGroupData[{Cell["Save Your Notebook", "Section", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "Remove any output cells from this notebook and then use ", StyleBox["Save As", FontFamily->"Helvetica"], " to store your notebook under the name ", StyleBox["myEx08", FontFamily->"Helvetica"], "." }], "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]]}, Open]] }, FrontEndVersion->"4.1 for Microsoft Windows", ScreenRectangle->{{0, 1024}, {0, 695}}, WindowToolbars->{}, CellGrouping->Manual, WindowSize->{499, 599}, WindowMargins->{{Automatic, 187}, {Automatic, 0}}, PrivateNotebookOptions->{"ColorPalette"->{RGBColor, -1}}, ShowCellLabel->True, ShowCellTags->False, RenderingOptions->{"ObjectDithering"->True, "RasterDithering"->False} ] (******************************************************************* 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[1727, 52, 159, 5, 70, "Title"], Cell[1889, 59, 265, 7, 70, "Subsubtitle"], Cell[CellGroupData[{ Cell[2177, 68, 69, 1, 70, "Section"], Cell[2249, 71, 579, 19, 70, "Special1"] }, Open ]], Cell[CellGroupData[{ Cell[2860, 92, 59, 1, 70, "Section"], Cell[2922, 95, 387, 8, 70, "Special1"], Cell[3312, 105, 226, 7, 70, "Special1"], Cell[3541, 114, 154, 4, 70, "Special1"], Cell[3698, 120, 131, 3, 70, "Special1"], Cell[3832, 125, 370, 8, 70, "Special1"] }, Open ]], Cell[CellGroupData[{ Cell[4234, 135, 69, 1, 70, "Section"], Cell[CellGroupData[{ Cell[4326, 138, 236, 7, 70, "Subsection"], Cell[4565, 147, 143, 6, 70, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[4740, 155, 64, 1, 70, "Subsection"], Cell[4807, 158, 89, 1, 70, "Special1"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[4937, 161, 69, 1, 70, "Section"], Cell[5009, 164, 137, 3, 70, "Subsection"], Cell[CellGroupData[{ Cell[5169, 169, 64, 1, 70, "Subsection"], Cell[5236, 172, 654, 17, 70, "Special1"] }, Open ]], Cell[5902, 191, 284, 5, 70, "Subsection"], Cell[6189, 198, 541, 14, 70, "Subsection"], Cell[CellGroupData[{ Cell[6753, 214, 64, 1, 70, "Subsection"], Cell[6820, 217, 308, 10, 70, "Special1"] }, Open ]], Cell[7140, 229, 749, 18, 70, "Subsection"], Cell[CellGroupData[{ Cell[7912, 249, 64, 1, 70, "Subsection"], Cell[7979, 252, 216, 7, 70, "Special1"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[8236, 261, 69, 1, 70, "Section"], Cell[8308, 264, 399, 13, 70, "Subsection"], Cell[CellGroupData[{ Cell[8730, 279, 64, 1, 70, "Subsection"], Cell[8797, 282, 312, 7, 70, "Special1"] }, Open ]], Cell[9121, 291, 272, 7, 70, "Subsection"], Cell[CellGroupData[{ Cell[9416, 300, 64, 1, 70, "Subsection"], Cell[9483, 303, 268, 7, 70, "Special1"] }, Open ]], Cell[9763, 312, 565, 14, 70, "Subsection"], Cell[CellGroupData[{ Cell[10351, 328, 64, 1, 70, "Subsection"], Cell[10418, 331, 613, 18, 70, "Special1"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[11072, 351, 69, 1, 70, "Section"], Cell[11144, 354, 343, 6, 70, "Subsection"], Cell[CellGroupData[{ Cell[11510, 362, 64, 1, 70, "Subsection"], Cell[11577, 365, 131, 3, 70, "Special1"] }, Open ]], Cell[CellGroupData[{ Cell[11740, 370, 257, 7, 70, "Subsection"], Cell[12000, 379, 473, 21, 70, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[12505, 402, 245, 6, 70, "Subsection"], Cell[12753, 410, 211, 6, 70, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[12996, 418, 64, 1, 70, "Subsection"], Cell[13063, 421, 392, 15, 70, "Special1"] }, Open ]], Cell[13467, 438, 257, 5, 70, "Subsection"], Cell[CellGroupData[{ Cell[13747, 445, 64, 1, 70, "Subsection"], Cell[13814, 448, 97, 1, 70, "Special1"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[13952, 451, 70, 1, 70, "Section"], Cell[14025, 454, 283, 9, 70, "Special1"] }, Open ]] }, Open ]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)