(*********************************************************************** 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[ 8120, 264]*) (*NotebookOutlinePosition[ 9059, 295]*) (* CellTagsIndexPosition[ 9015, 291]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell[TextData[StyleBox["Demo 2.3", FontSize->21, FontWeight->"Bold", FontSlant->"Plain", FontTracking->"Extended", FontVariations->{"Underline"->True}]], "Subsubtitle"], Cell[CellGroupData[{ Cell["Plotting solution curves of solutions defined implicitly.", "Section"], Cell["\<\ When the solutions of a first order differential equation are \ defined implicitly, as in the case with separable equations, the command \ ContourPlot can be used to graph the solutions. \ \>", "Text"], Cell[BoxData[ \(?? ContourPlot\)], "Input"], Cell["\<\ The meaning and usage of the options can as usual be found by \ selecting the command ContourPlot and pressing Command-shift-F to go to the \ Help Browser. There we find, for example, that the option Contours \ ->{a,b,c,...} will graph the contours with the specific values a, b, c, ... \ of the constant, whereas the option Contours -> 15 will graph 15 equally \ spaced contours. Suppose the solution is given in the form g(x,y)=c. We can then use the \ following model, with suitable editing for each example.\ \>", "Text"], Cell[BoxData[ \(g[x_, y_] = ?\)], "Input"], Cell[BoxData[ \(curves = ContourPlot[g[x, y], {x, \(-3\), 3}, {y, \(-3\), 3}, \n\t\t\t\t\t Axes -> True, Contours -> 15, \n\t\t\t\t\tContourShading -> False, \n \t\t\t\t\tContourSmoothing -> True, \n\t\t\ \ \ \ \ \ \ AxesOrigin\ -> \ \(Automatic\n\t\t\t\t\tPlotPoints -> 25\)]\)], "Input"], Cell[CellGroupData[{ Cell[TextData[{ "Example 1. ", StyleBox[" y' = ", FontFamily->"Courier New"], Cell[BoxData[ \(TraditionalForm\`x\^2\)], FontFamily->"Courier New"], StyleBox["/(1 -", FontFamily->"Courier New"], Cell[BoxData[ \(TraditionalForm\`\(\ y\^2\)\)], FontFamily->"Courier New"], StyleBox[")", FontFamily->"Courier New"], " on page 34 of the textbook" }], "Subsection"], Cell["In this case the solution is given by ", "Text"], Cell[BoxData[ \(g[x_, y_] = x\^3 - 3 y + y\^3\)], "Input"], Cell[BoxData[ \(curves = ContourPlot[g[x, y], {x, \(-3\), 3}, {y, \(-3\), 3}, \n\t\t\t\t\ \ Axes -> True, Contours -> 15, \n\t\t\t\t\tContourShading -> False, \n \t\t\t\t\tContourSmoothing -> True, \n\t\t\ \ \ \ \ \ \ AxesOrigin\ -> \ \(Automatic\n\t\t\t\t\tPlotPoints -> 25\)]\)], "Input"], Cell[TextData[{ "If we wanted the solution curve for which y=2 when x=1, we plot the curve \ \n", Cell[BoxData[ \(x\^3 - 3 y + y\^\(3\ \)\)]], "= g(1,2). " }], "Text"], Cell[BoxData[ \(curves = ContourPlot[g[x, y], {x, \(-3\), 3}, {y, \(-3\), 3}, \n\t\t\t\t\t Axes -> True, Contours -> {g[1, 2]}, \n\t\t\t\t\t ContourShading -> False, \n\t\t\t\t\tContourSmoothing -> True, \n \t\t\ \ \ \ \ \ \ AxesOrigin\ -> \(Automatic\n\t\t\t\t\tPlotPoints -> 25\)]\)], "Input"] }, Open ]], Cell[CellGroupData[{ Cell[TextData[{ "Example 2. ", StyleBox["y' = (y cos x)/(1+2 y^2) ", FontFamily->"Courier New"], " on page 37" }], "Subsection"], Cell[BoxData[ \(g[x_, y_] = Log[Abs[y]] + y\^2 - Sin[x]\)], "Input"], Cell[BoxData[ \(curves = ContourPlot[g[x, y], {x, \(-3\), 3}, {y, .1, 3}, \n\t\t\t\t\t Axes -> True, Contours -> 15, \n\t\t\t\t\tContourShading -> False, \n \t\t\t\t\tContourSmoothing -> True, \n\ \ \ \ \ \ \ \ \ \ \ AxesOrigin\ -> \ \(Automatic\t\t\ \ \ \ \ \ \ \n\t\t\t\t\tPlotPoints -> 25\)]\)], "Input"], Cell[TextData[{ "The solution which has y=1 when x=0 is given by g(x,y) = Log( |y | ) + ", Cell[BoxData[ \(TraditionalForm\`y\^2\)]], "- Sin(y) = g(0,1)." }], "Text"], Cell[BoxData[ \(curves = ContourPlot[g[x, y], {x, \(-3\), 3}, {y, .1, 3}, \n\t\t\t\t\t Axes -> True, Contours -> {g[0, 1]}, \n\t\t\t\t\t ContourShading -> False, \n\t\t\t\t\tContourSmoothing -> True, \n \t\t\ \ \ \ \ \ \ AxesOrigin\ -> \ \(Automatic\n\t\t\t\t\tPlotPoints -> 25\)]\)], "Input"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["How to find the interval in which a solution is valid? ", "Section"], Cell[TextData[{ "Remember ", StyleBox["problem 11", FontWeight->"Bold"], " done in class!\nThe solution to the equation ", StyleBox["\n ", FontFamily->"Courier New"], StyleBox["x dx + y ", FontFamily->"Courier New", FontWeight->"Bold"], Cell[BoxData[ \(TraditionalForm\`E\^\(-x\)\)], FontFamily->"Courier New", FontWeight->"Bold"], StyleBox[" dy = 0 with y(0) = 1", FontFamily->"Courier New", FontWeight->"Bold"], StyleBox[" ", FontFamily->"Courier New"], "\n is given by \n ", StyleBox[" ", FontWeight->"Bold"], StyleBox["y = ", FontFamily->"Courier New", FontWeight->"Bold"], Cell[BoxData[ FormBox[ SqrtBox[ RowBox[{ FormBox[\(2 \((1 - x)\) E\^x\), "TraditionalForm"], " ", "-", " ", "1"}]], TraditionalForm]], FontFamily->"Courier New", FontWeight->"Bold"], StyleBox[".", FontFamily->"Courier New", FontWeight->"Bold"], StyleBox[" ", FontFamily->"Courier", FontWeight->"Bold"], "\nWe wish to know where this is well defined, so we plot the part inside \ the square root and then solve for the suitable roots between which it is \ positive." }], "Text"], Cell[BoxData[ \(Plot[2 \((1 - x)\) E\^x - 1, {x, \(-3\), 3}]\)], "Input"], Cell["We see that the roots are near -2 and 1.", "Text"], Cell[BoxData[ \(Solve[2 \((1 - x)\) E\^x - 1 == 0, x]\)], "Input"], Cell["\<\ This doesn't work because Solve can't solve most transcendental \ equations, and it solves this one with a function we don't know about. \ NSolve works in this case, but not always.\ \>", "Text"], Cell[BoxData[ \(NSolve[2 \((1 - x)\) E\^x - 1 == 0, x]\)], "Input"], Cell["\<\ What we prefer is FindRoot which uses some form of Newton's method \ to find a root near a good guess.\ \>", "Text"], Cell[BoxData[ \(\(?FindRoot\)\)], "Input"], Cell[BoxData[ \(FindRoot[2 \((1 - x)\) E\^x - 1 == 0, {x, 1}]\)], "Input"], Cell[BoxData[ \(FindRoot[2 \((1 - x)\) E\^x - 1 == 0, {x, \(-2\)}]\)], "Input"], Cell["The solution is defined for -1.67835 < x < 0.768039", "Text"] }, Open ]] }, Open ]] }, FrontEndVersion->"Macintosh 3.0", ScreenRectangle->{{0, 832}, {0, 604}}, WindowToolbars->"EditBar", WindowSize->{520, 470}, WindowMargins->{{100, Automatic}, {Automatic, 7}}, PrintingCopies->1, PrintingPageRange->{1, Automatic}, Magnification->1, 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, 58, "Subsubtitle"], Cell[CellGroupData[{ Cell[1934, 60, 76, 0, 50, "Section"], Cell[2013, 62, 213, 4, 46, "Text"], Cell[2229, 68, 47, 1, 27, "Input"], Cell[2279, 71, 538, 9, 126, "Text"], Cell[2820, 82, 46, 1, 27, "Input"], Cell[2869, 85, 329, 6, 107, "Input"], Cell[CellGroupData[{ Cell[3223, 95, 426, 15, 46, "Subsection"], Cell[3652, 112, 54, 0, 30, "Text"], Cell[3709, 114, 63, 1, 29, "Input"], Cell[3775, 117, 331, 6, 107, "Input"], Cell[4109, 125, 181, 6, 46, "Text"], Cell[4293, 133, 340, 6, 107, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[4670, 144, 148, 5, 46, "Subsection"], Cell[4821, 151, 72, 1, 29, "Input"], Cell[4896, 154, 359, 7, 107, "Input"], Cell[5258, 163, 179, 5, 31, "Text"], Cell[5440, 170, 342, 7, 107, "Input"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[5831, 183, 74, 0, 50, "Section"], Cell[5908, 185, 1273, 42, 131, "Text"], Cell[7184, 229, 77, 1, 27, "Input"], Cell[7264, 232, 56, 0, 30, "Text"], Cell[7323, 234, 70, 1, 27, "Input"], Cell[7396, 237, 206, 4, 46, "Text"], Cell[7605, 243, 71, 1, 27, "Input"], Cell[7679, 246, 126, 3, 46, "Text"], Cell[7808, 251, 46, 1, 27, "Input"], Cell[7857, 254, 78, 1, 27, "Input"], Cell[7938, 257, 83, 1, 27, "Input"], Cell[8024, 260, 68, 0, 30, "Text"] }, Open ]] }, Open ]] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)