(*^ ::[ Information = "This is a Mathematica Notebook file. It contains ASCII text, and can be transferred by email, ftp, or other text-file transfer utility. It should be read or edited using a copy of Mathematica or MathReader. If you received this as email, use your mail application or copy/paste to save everything from the line containing (*^ down to the line containing ^*) into a plain text file. On some systems you may have to give the file a name ending with ".ma" to allow Mathematica to recognize it as a Notebook. The line below identifies what version of Mathematica created this file, but it can be opened using any other version as well."; FrontEndVersion = "Macintosh Mathematica Notebook Front End Version 2.2"; MacintoshStandardFontEncoding; fontset = title, inactive, noPageBreakBelow, nohscroll, preserveAspect, cellOutline, groupLikeTitle, center, M18, O486, R65535, e8, 24, "Calculus"; fontset = subtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M18, O486, bold, R21845, G21845, B21845, e6, 12, "Calculus"; fontset = subsubtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M18, O486, R21845, G21845, B21845, e6, 12, "Calculus"; fontset = section, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, grayBox, M18, O486, bold, R21845, G21845, B21845, a10, 12, "Calculus"; fontset = subsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, blackBox, M18, O486, bold, R21845, G21845, B21845, a10, 12, "Calculus"; fontset = subsubsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, whiteBox, M18, O486, bold, R21845, G21845, B21845, a10, 12, "Calculus"; fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M18, O486, 12, "Calculus"; fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M18, O486, B65535, 12, "Calculus"; fontset = input, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeInput, M36, N23, O486, bold, L-5, 12, "Courier"; fontset = output, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M36, N23, O486, L-5, 12, "Courier"; fontset = message, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M18, N23, O486, R65535, L-5, 12, "Courier"; fontset = print, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M18, N23, O486, L-5, 12, "Courier"; fontset = info, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M18, N23, O486, B65535, L-5, 12, "Courier"; fontset = postscript, PostScript, formatAsPostScript, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeGraphics, M18, O486, l19, o2, w378, h214, 12, "Courier"; fontset = name, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M18, O486, italic, 10, "Geneva"; fontset = header, inactive, noKeepOnOnePage, preserveAspect, M18, O486, 12, "Times"; fontset = leftheader, inactive, M18, O486, L2, 12, "Times"; fontset = footer, inactive, noKeepOnOnePage, preserveAspect, center, M18, O486, 12, "Times"; fontset = leftfooter, inactive, M18, O486, L2, 12, "Times"; fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M18, O486, 10, "Times"; fontset = clipboard, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M18, O486, 12, "Times"; fontset = completions, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M18, O486, 12, "Times"; fontset = special1, inactive, nohscroll, noKeepOnOnePage, preserveAspect, whiteBox, M18, O486, bold, R21845, G21845, B21845, 12, "Calculus"; fontset = special2, inactive, nohscroll, noKeepOnOnePage, preserveAspect, center, M18, O486, R21845, G21845, B21845, 12, "Calculus"; fontset = special3, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M18, O486, 12, "Times"; fontset = special4, inactive, nohscroll, noKeepOnOnePage, preserveAspect, center, M18, O486, 10, "Courier"; fontset = special5, inactive, nohscroll, noKeepOnOnePage, preserveAspect, center, M18, O486, 10, "Courier"; currentKernel; ] :[font = section; inactive; preserveAspect; fontSize = 14] Debra Woods :[font = section; inactive; Cclosed; preserveAspect; fontSize = 14; startGroup] Direction Fields, and Isoclines :[font = smalltext; inactive; preserveAspect; endGroup] This project is a demonstration to show the visual behavior of solutions of differential equations of the form dy/dx = f(x, y). :[font = section; inactive; Cclosed; preserveAspect; fontSize = 14; startGroup] Direction Fields :[font = smalltext; inactive; preserveAspect] This project is a demonstration to show visually the behavior of solutions of differential equations of the form dy/dx = f(x, y). :[font = name; inactive; Cclosed; preserveAspect; groupLikeInput; startGroup] Initialization: :[font = input; initialization; preserveAspect; endGroup] *) Off[General::spell1]; (* :[font = smalltext; inactive; preserveAspect] For this demonstration we will consider the possible solutions to a differential equation of the form dy/dx = f(x,y). A useful technique in visualizing the solutions to differential equations of this form is to sketch the direction field for the equation. The direction field is a plot of tangent line segments to the solution at various points in a plane. The slope of the tangent lines is given directly by the differential equation, dy/dx. The function and limits of the graph can be changed in the first cell, in order to show other possible fields. Students are encouraged to try various functions. The example used here is dy/dx = x - y :[font = input; preserveAspect; endGroup] Clear[top,bot,right,left,f,x,y,h,m,c,delx,dely,p,q,dx] top = 5; (** Upper limit **) bot = -1; (** Lower limit **) right = 5; (** Right limit **) left = -1; (** Left limit **) inc = .5; (** increment (space between points) **) f[x_,y_] := x-y ; (** Define function **) h = .3; (** length of lines **) delx[m_] := h / Sqrt[m^2 + 1]; dely[dx_] := Sqrt[h^2 - dx^2]; p = Table[ Graphics[{RGBColor[0,0,1], Line[{{x,y}, {x + delx[f[x,y]], y + Sign[f[x,y]] dely[delx[f[x,y]]]}}] }],{x,left,right,inc},{y,bot,top,inc}]; Show[p, Axes->True,AspectRatio->1,PlotRange->{bot,top}, AxesLabel->{"x","y"}, DisplayFunction->$DisplayFunction]; ;[s] 15:0,0;74,1;95,0;107,1;135,0;154,1;175,0;194,1;215,0;234,1;277,0;296,1;321,0;340,1;365,0;705,-1; 2:8,12,10,Courier,1,12,0,0,0;7,12,10,Courier,1,12,0,65535,65535; :[font = section; inactive; Cclosed; preserveAspect; fontSize = 14; startGroup] ISOCLINES :[font = smalltext; inactive; preserveAspect] The locus of points for which f(x,y) = c is called an isocline. That is, isoclines go through the line segments of equal slope on the direction field. For the equation of this demonstration, they are the lines for which x - y = c. ;[s] 3:0,0;54,1;62,0;234,-1; 2:2,26,19,Calculus,0,12,0,0,65535;1,26,19,Calculus,2,12,0,0,65535; :[font = input; preserveAspect; endGroup] isos = ContourPlot[f[x,y],{x,left,right},{y,bot,top}, ContourShading->False,DefaultColor->RGBColor[1,0,0], DisplayFunction->Identity]; Show[p,isos, Axes->True,AspectRatio->1,PlotRange->{bot,top}, AxesLabel->{"x","y"}, DisplayFunction->$DisplayFunction]; :[font = section; inactive; Cclosed; preserveAspect; fontSize = 14; startGroup] Solutions :[font = smalltext; inactive; preserveAspect] The following shows that the family of solutions follow the direction of the line segments in the direction field. :[font = input; preserveAspect] Clear[Derivative] s = DSolve[D[y[x],x]==f[x,y[x]],y[x],x]; so:= s[[1,1,2]]/.C[1]->c; sol[x_,c_]:= so; csol1 = NSolve[y==so,c]/.{x->left,y->bot}; csol2 = NSolve[y==so,c]/.{x->left,y->top}; csol3 = NSolve[y==so,c]/.{x->right,y->bot}; csol4 = NSolve[y==so,c]/.{x->right,y->top}; possmaxlist={csol1[[1,1,2]],csol2[[1,1,2]], csol3[[1,1,2]],csol4[[1,1,2]]}; maxval = Max[possmaxlist]; minval = Min[possmaxlist]; num = 50; delnum = Round[(maxval-minval)/num]; sols = Table[Plot[sol[x,c],{x,left,right}, PlotStyle->RGBColor[1,0,0], DisplayFunction->Identity, AspectRatio->1,PlotRange->{bot,top}], {c,minval,maxval,delnum}]; Show[p,sols, PlotRange->{top,bot}, DisplayFunction->$DisplayFunction,Axes->True, AxesLabel->{"x","y"},AspectRatio->1 ]; :[font = smalltext; inactive; preserveAspect; endGroup] Go back to the first cell and experiment with different equations. Try dy/dx = y + sin x, dy/dx = xÛ + y, make up your own! ^*)