ORDINARY DIFFERENTIAL EQUATIONS AND LINEAR ALGEBRA
ORDINARY DIFFERENTIAL EQUATIONS AND LINEAR ALGEBRA MATH 211
Popular in Course
Popular in Mathematics (M)
This 23 page Class Notes was uploaded by Jayde Lang on Monday October 19, 2015. The Class Notes belongs to MATH 211 at Rice University taught by Staff in Fall. Since its upload, it has received 5 views. For similar materials see /class/224937/math-211-rice-university in Mathematics (M) at Rice University.
Reviews for ORDINARY DIFFERENTIAL EQUATIONS AND LINEAR ALGEBRA
Report this Material
What is Karma?
Karma is the currency of StudySoup.
Date Created: 10/19/15
Handout Two of Math 211 Fall 2006 It seems that there is some confusion about existence and uniqueness of solu tions I hope the following can clarify that somehowi Like I said in class whenever we say existence or uniqueness we are talking about IVPI For existence say given an IVP 1 ftz and 1t0 10 When can we apply the existence theorem Look at the function ft z and the point t0zoi If the function is wellde ned and continuous in some rectangle CONTAINING the poing to 10 then we are in good shape We can apply the existence theorem to conclude that there is a solution of the IVP at least inside of the rectangle If the function is not wellbehaved at that point to Ioeig ft I not de ned there or ftz not continuous there then you can not apply the existence theoremi Uniqueness theorem is somehow more important and more widely used Say we have the same IVP 1 ftz and 1t0 10 Again look at the function ftz and the point t0zo in order to use the uniqueness theorem you need two thingsstronger than the existence theorem First you need ftz wellde ned and continuous in some rectangle CON TAINING the point to 10 Second BfBz must be continuous in that rectanglei if the equation is y fzy then consider BfByi ire always take the partial derivative of f with respect to the unknown function Then what you can say is There is only one solution of the IVPI Geometrically inside that rectanglewe can say it is a good rectangle any two solution curves can not cross with each other WHY because if they meet at some point inside the rectangle we can use the uniqueness theorem to conclude they must be the same If either ft z or BfBz is discontinuous at the point to 10 then you can not use the uniqueness theoremi In other word you may have two solutions to the IVPI Remember there was a problem section 27 number 9in the homework why are there two solutions Because BfBy is not continuous at the point 070 3 Introduction to DFIELD6 A rst order ordinary differential equation has the form x f t 5 To solve this equation we must nd afunction xt such that 0 ftxt for all t This means that at every point t xt on the graph ofx the graph must have slope equal to ft xt We can turn this interpretation around to give a geometric view of what a differential equation is and what it means to solve the equation At each point t x the number ft 5 represents the slope of a solution curve through this point Imagine ifyou can a small line segment attached to each point t x with slope ft x This collection of lines is called a direction line eld and it provides the geometric interpretation of a differential equation To nd a solution we must nd a curve in the plane which is tangent at each point to the direction line at that point Admittedly it is dif cult to visualize such a direction eld This is where the MATLAB routine dfieldG demonstrates its value1 Given a differential equation it will plot the direction lines at a large number of points i enough so that the entire direction line eld can be visualized by mentally interpolating between the eld elements This enables the user to get some geometric insight into the solutions of the equation Starting DFIELD6 To see df ieldG in action enter df ieldG at the MATLAB prompt After a short wait a new window will appear with the label DFIELD6 Setup Figure 31 shows how this window looks on a PC running Windows The appearance will differ slightly depending on your computer but the functionality will be the same on all machines Figure 31 The setup window for df ieldG 1 The MATLAB function dfieldG is not distributed with MATLAB To discover if it is installed properly on your computer enter help dfieldG at the MATLAB prompt If it is not installed see the Appendix to this chapter for instructions on how to obtain it 28 The DFIELD6 Setup window is an example of a MATLAB gure window We have already seen gure windows in Chapter 2 but this one looks Very different so we see that a gure window can assume ayariety of forms In a MATLAB session there will always be one command window open on your screen and perhaps a number of gure windows as well The equation x2 7 t is entered in the edit box entitled The differential equation of the DFIELD6 Setup window There is also an edit box for the independent Variable and several edit boxes are available for parameters The default Values in The display window limit the independent Variable t to 72 5 t 5 10 and the dependent Variable x to 74 5 x 5 4 At the bottom of the DFIELD6 Setup window there are three buttons labelled Quit Revert and Proceed The Direction Field We will describe the setup window in detail later but for now click the button with the label Proceed After afew seconds another window will appear this one labeled DFIELD6 Display An example of this window is shown in Figure 32 mm mm u 5 mg an own new 1m WWW Help Emsm mm 2 581 as t Eamvuhng the held elements Ready Figure 32 The display window for dfieldG The most prominent feature of the DFIELD6 Display window is a rectangular grid labeled with the differential equation x x 7 t on the top the independent Variable t on the bottom and the dependent Variable x on the left The dimensions of this rectangle are slightly larger than the rectangle speci ed in the DFIELD6 Setup window to accommodate the extra space needed by the direction eld lines Inside this rectangle is a grid of points 20 in each direction for a total of 400 points At each such point with 29 coordinates t x there is shown a small line segment centered at t x with slope equal to x2 t This collection of lines is a subset of the direction eld There is a pair of buttons on the DFIELD6 Display window Q1th and Print There are several menus File Edit Options Insert and Help Below the direction eld there is a small window giving the coordinates of the cursor and a larger message window through which dfield6 will communicate with us Note that the last line of this window contains the word Ready indicating that dfield6 is ready to follow orders Initial Value Problems The differential equation x x2 t is in narmal farm meaning that the derivative x is expressed as a function of the independent variable t and the dependent variable x You will notice from Figure 31 that dfield6 requires the differential equation to be in normal form Most differential equations have in nitely many solutions In order to get a particular solution it is necessary to specify an initial condition The differential equation with initial condition x fltt7 x me x0 31 is called an initial value prablem A salutian curve of a differential equation x f t x is the graph of a function x t which solves the differential equation In particular we get a solution curve by computing and plotting the solution to an initial value problem This is an easy process using df i eld6 With the differential equation in normal form we enter it and the other data in the setup window see Figure 31 We then proceed to the display window Figure 32 To solve with a given initial condition x to x0 we move the mouse to the point to x0 using the cursor position display at the bottom of the gure to improve our accuracy and then click the mouse button The computer will compute and plot the solution through the selected point rst in the direction in which the independent variable is increasing the Forward direction and then in the opposite direction the Backward direction The result should be something like Figure 33 After computing and plotting several solutions the display might look something like that shown in Figure 34 x39frl Allllllllllllllllllll l llllllllllllllllllll I elllllltlllllllllIz Illllllllllll IIIIIIIIII 2IIIIIII IIIll I 1111 ll I ll gt01 Illlllll x III ll I ll 711 IIII II 2IIIIIIIII l l IIIIIIIII llllllllllll 3 llllllllllllIlIl IIIIIIIIIIIIIIIIIII I rAIIIIIIIIIIIIIIIIlIII l e Figure 33 A solution of the ODE x Figure 34 Several solutions of the ODE x t x x t Finer Control of Data The next example illustrates several features of df ieldG including how to be accurate with initial conditions Example 1 The voltage y on the capacitorin a certain RC circuitis modeled by the differential equation 3 cos x Where We are using the variable x to represent time Use df ieldG toplot the voltage over the intervaIO 5 x 5 20 assuming that y0 1 You will notice that we are asked to solve the initial value problem yy3cosx y0l 32 The dependent variable in this example is y and the independent variable is x The differential equation y y x is not in normal form so we put it in normal form by solving the equation for y getting y 7y 3 cosx Return to the DFIELD6 Setup window and select EditgtClear all2 Notice that there are options on the Edit menu to clear particular regions of the DFIELD6 Setup window and each of these options possesses a keyboard accelerator Enter the left and right sides of the differential equation y 7y 3 cos x the independent variable x in this case and de ne the display window in the DFIELD6 Setup window as shown in Figure 35 Figure 35 The setup window for y 7y 3 cos 5 Should your data entry become hopelessly mangled click the Revert button to restore the original entries The initial value problem in 32 contains no parameters so leave the parameter elds in the DFIELD6 Setup window blank Click the Proceed button to transfer the information in the DFIELD6 Setup window to the DFIELD6 Display window and start the computation of the direction eld Choosing the initial point for the solution curve with the mouse is convenient but it is often dif cult to be accurate even with the help of the cursor position display Instead in the DFIELD6 Display window select Options Keyboard input Enter the initial condition y0 l as shown in Figure 36 Click the Compute button in the DFIELD6 Keyboard input window to compute the trajectory shown in Figure 37 2 We continue to use the notation EditgtClear all to signify that you should select Clear all from the Edit menu MATLAB is casesensitive Thus the variable Y is completely different from the variable y 31 188 Em the whal sandman The whal value Dr X he whal value a y t r sue2W a camputahan mtevval iE m Figure 36 The initial condition y0 1 starts the solution trajectory at O 1 Notice that it is not necessary to specify a computation interval However you can specify one if you wish by clicking the Specify a computation interval checkbox in the DFIELD6 Keyboard Input window See Figure 36 and then lling in the starting and ending times ofthe desired solution interval For example start a solution trajectory with initial condition y0 0 but set the computation interval so that in 5 x 5 71 Try it y397y3cosx lt72 lt74 lt76 lt78 lt8 lt82 lt84 lt86 lt88 x Figure 37 Solution ofy y 3 cosx Figure 38 Zooming in to nd y18 y0 1 Example 2 For the voltage yx computed in Example 1 ndy18 accurate to 2 decimalplaces From the graph of the solution in Figure 37 we can see that the voltage y18 is approximately 3 However this is not accurate enough To get more accuracy we will increase the resolution using the zoom tools in dfield6 Select EditgtZoom in in the DFIELD6 Display window then singleclick the left mouse button in the DFIELD6 Display window near the point 18 3 Additional zooms require that you revisit EditgtZoom in before clicking the mouse button to zoom There is a faster way to zoom in that is platform dependent If you have a mouse with more than one button click the right mouse button at the zoom point or controlclick the left mouse button at the zoom point On a Macintosh optionclick the mouse button at the zoom point4 After performing a couple of zooms results may vary 4 Mouse actions are platform dependent in dfield6 See the front and back covers of this manual for a summary of mouse actions on various p atforms 32 on your machine greater resolution is obtained When you reach a point similar to Figure 38 you can use the cursor position display to see that y18 296 Existence and Uniqueness It would be comf01ting to know in advance that a solution of an initial value problem exists especially if you are about to invest a lot of time and energy in an attempt to nd a solution A second but no less imponant question is uniqueness is there only one solution Or does the initial value problem have more than one solution Fortunately existence and uniqueness of solutions have been thoroughly examined and there is a beautiful theorem that we can use to answer these questions Theorem 1 Suppose that the function f t x is de ned in the rectangle R de ned by a 5 t 5 b and e 5 x 5 1 Suppose also thatf and BfBx are both continuousin R Then given anypointt0 x0 6 R there is one and only one function x t de ned fort in an interval containing to such thatx to x0 and x ft x Furthermore the function xt is de ned both fort gt to and fort lt to at least until the graph ofx leaves the rectangle R through one of its four edges Example 3 Use dfield6 to sketch the solution of the initial Value problem x x2 x0 1 Set the display Window so that 2 5 t 5 3 and 4 5 x 5 4 Enter the differential equation x x2 the independent variable t and the display window ranges 2 5 t 5 3 and 4 5 x 5 4 in the DFIELD6 Setup window Click Proceed to compute the direction eld Select Options gtKeyb0ard input in the DFIELD6 Display window and enter the initial condition x 0 l in the DFIELD6 Keyboard input window If all goes well you should produce an image similar to that in Figure 39 The differential equation x x2 is in the form x ft x with ft x x2 in addition ft x x2 and BfBx 2x arecontinuous onthe rectangle R de nedby 2 5 t 5 3 and 4 5 x 5 4 Therefore Theorem 1 states that the initial value problem has a solution as shown in Figure 39 and that this solution is unique Use the mouse to experiment You will see that any other solution is parallel to the rst one and does not pass through the point 0 1 Theorem 1 does not make a de nitive statement about the domain of a solution For example does the solution in Figure 39 exist for all t or does it reach positive in nity in a nite amount of time This question cannot be answered by dfield6 alone although it can provide a hint Go back to the Setup window and change the display window to 0 5 t 5 15 and 0 5 x 5 40 in order to focus on the solution in Figure 39 near t 1 When we proceed to the display window and recompute the solution we get the result shown in Figure 310 This seems to indicate that the solution becomes in nite near t 1 To check this out we solve the differential equation The general solution is xt l C t where C is an arbitrary constant Substituting the initial condition x0 1 into the equation xt l C t 5 The notation 8 f Bx represents the partial derivative 0f f with respect t0 x Suppose for example that f t x x2 t To nd 8 f Bx think oft as a constant and differentiate with respect to x to obtain 8 f Bx 2x Similarly to nd 8 f 8t think of x as a constant and differentiate with respect to t to obtain 8 f at l 33 I I l I 39l f Figure 39 The solution of dxdt x2 Figure 310 The solution blows up at x0 1 is unique I 1 we nd that 1 1C 0 or C 1 so the solution is xt 11 t From this equation we see that limtali xt 00 Mathematicians like to say that the solution blows up at t 16 In this particular case if the independent variable t represents time in seconds then the solution trajectory reaches positive in nity when one second of time elapses Example 4 Consider the differential equation dx 2 E X Sketch solutions With initial conditions x2 0 x3 0 and x4 0 Determine Whether or not these solution curves intersect in the display Window de ned by 2 5 t 5 10 and 4 5 x 5 4 t Go to the setup window and select Gallery gtdefault equation The correct data will be entered Click Proceed to transfer this information and begin computation of the direction eld in the DFIELD6 Display window Select Options gtKeyb0ard input in the DFIELD6 Display window and compute solutions for each of the initial conditions x 2 0 x 3 0 and x 4 0 If all goes well you should produce an image similar to that in Figure 311 The ODE x x2 t is in normal form x ft x with ft x x2 t Both f and BfBx 2x are continuous on the display window de ned by 2 5 t 5 10 and 4 5 x 5 4 In Figure 311 it appears that the solution trajectories merge into one trajectory near the point 6 24 or perhaps even sooner However Theorem 1 guarantees that solutions cannot cross or meet in the display window of Figure 311 This situation can be analyzed by zooming in near the point 6 24 After performing nlunerous zooms some separation in the trajectories begins to occur as shown in Figure 312 Without Theorem 1 we might have mistakenly asstuned that the trajectories merged into one trajectory It is also possible to zoom in by dragging a zoom box If you have a two button mouse this can be done by depressing the right mouse button then dragging the mouse Once the zoom box is drawn 6 The graph of the solution reaches in nity or negative in nity in a nite time period 34 r sum 5 Figure 311 Do the trajectories intersect Figure 312 The trajectories don39t merge or cross mouse by depressing the option key While clicking and dragging Dflelde allows you to Zoom bac quot to revisit any previously used window Select EditgtZoom Figure 313 Select the window you Wish to revisit and click the Zoom button DHELDs 2nnmhaltk 51 Select a lectang e a x azamuazaoa a 2mm 2m 1 t is 2459 t Figure 313 Select a Zoom Window and click the Zoom button Qualitative Analysis approach might be easier and more appropriate Example 5 Let P a nualitati p 2 represent a population of bacteria at mine 2 measured in millions of bacteria 35 Suppose that P is governed by the logistic model dP P rP 1 7 33 it K Assume thatr 075 andK 10 and suppose that the initial population at time t 0 is P0 1 What will happen to this population oVer a long period of time Let s rst examine the model experimentally using dfieldG Instead of lling out the DFIELD6 Setup window by hand we can use the ery by choosing Gallery7gtlogistic equation Notice that the parameters r and K have been given the correct Values To provide more room below P 0 set the minimum Value of P to be 74 as shown in Figure 314 Click the Proceed button to stan the computation of the direction eld Figure 314 Setup window fordPdt rP17 PK lot a few solutions by clicking the mouse at Various points with P gt 0 Notice that each of these solutions tends to 10 as t increases Remember that K 10 This is not a coincidence and we will return to this point later Some solution curves are shown in Figure 315 P vP17PK 1075 K10 39PUJMM Pm dPdt lt o dPdt gt o dPdt lt o r 1 1 11 1 1 I P deueases P mueases P deueases Figure 315 Solutions to P rP1 7 Figure 316 The plot of rP1 7 PK PK Versus P This behavior can be predicted quite easily using qualitative analysis If you plot the right hand side of equation 33 versus P ie plot rP1 P K versus P the result is the inverted parabola seen in Figure 316 Set rP1 PK equal to zero to nd that the graph crosses the Paxis in Figure 316 at P 0 and P K These are called equilibrium paints It is easily veri ed that Pt K is a solution of dPdt rP1 PK by substituting Pt K into each side of the differential equation and simplifying Similarly the solution Pt 0 is easily seen to satisfy the differential equation Although the solutions P t 0 and P t K might be considered trivial since they are constant functions they are by no means trivial in their importance The solutions Pt 0 and Pt K are called equilibrium salutians For example if P t K the growth rate d P dt of the population is zero and the population remains at Pt K forever Similarly if Pt 0 the growth rate d P d t equals zero and the population remains at P t 0 for all time When the graph ofrP 1 PK which is equal to dPdt if P is a solution falls below the Paxis in Figure 316 then 1 P d t lt 0 and the rst derivative test implies that Pt is a decreasing function oft On the other hand when the graph of rP1 PK rises above the Paxis in Figure 316 then 1 P d t gt 0 and Pt is an increasing function oft These facts are summarized by the arrows on the P axis in Figure 316 This is an example of a phase line The information on the phase line indicates that a population beginning between 0 and K million bacteria has to increase to the equilibrium value of K million bacteria If the starting population is greater than K million then the population decreases to K million For this reason the parameter K is called the carrying capacity Now let s go back to the DFIELD6 Display window Select Options gtKeyboard input and start solution trajectories with initial conditions P0 0 and P0 10 For the second trajectory you can enter P K instead of P 10 since the use of parameters is allowed in the keyboard input window In Figure 315 note that these equilibrium solutions are horizontal lines Select Options gt Solution direction gtForward and Options gt Show the phase line in the DFIELD6 Display window Dfield6 aligns the phase line from Figure 316 in a vertical direction at the left edge of the direction eld in the DFIELD6 Display window To see the motion along the phase line it is a good idea to slow the computations Choose Options gtSolver settings and move the slider to less than 10 solutions steps per second Next begin the solution with initial condition P 0 1 and note the action of the animated point on the phase line As the solution trajectory in the direction eld approaches the horizontal line P 10 K the point on the phase line approaches equilibrium point P 10 on the phase line as shown in Figure 315 It would appear that a population with initial conditions and parameters described in the original problem statement will have to approach 10 million bacteria with the passage of time If you chose to slow the computation perhaps you noticed something you had seen only eetingly before When a computation is started a new button labelled Stop appears on the DFIELD6 Display window If you click this button the solution of the trajectory in the current direction is halted Experiment with some other initial conditions Note that solutions beginning a little above or a little below the equilibrium solution P 10 tend to move back toward this equilibrium solution with the passage of time This is why the solution P 10 is called an assymptatically Stable equilibrium solution However solutions beginning a little above or a little below the equilibrium solution P 0 tend to move away from this equilibrium solution with the passage of time The solution P 0 is called an unstable equilibrium solution You can review the results of our experiments in Figure 315 Using MATLAB While DFIELD6 is Open All of the features of MATLAB are available while df i eld6 is open You can use MATLAB commands to plot to the DFIELD6 Display window or you can open another gure window by typing figureat the MATLAB prompt When more than one gure is open it is important to remember that plotting commands are directed to the current gure This is always the most recently visited window You can make aparticular gure active by clicking on it If the DFIELD6 Setup window is the current gure your plot command will be directed to it It will b 39 d quot but it will L L M f the window so it will look as though nothing happened This is an annoying outcome When you have more than one gure window open it is a good idea to click on the gure where you want a plot to be executed just before issuing the command Example 6 The behavior of a population is modeled by the logistic equation PrPlt17 gt K With r 1 However in this case the carrying capacity is changing with time according to the equation K Kt 3 t Use dfieldG to plot several solutions Plot the carrying capacity on the DFIELD6 ui play ml w quot39 39 39 39 39 Ur L 39 39 39 39 capacity First we enter the equation into the DFIELD6 Setup window as in Figure 317 The only new feature here is that we entered the carrying capacity K 3 t as an expression Any mathematical expression involving the dependent and independent variables can be entere Figure 317 The setup window for the equation in Example 6 Next we proceed to the DFIELD6 Display window and plot afew solutions see Figure 318 Notice that ultimately all solutions seem to merge together and increase linearly as does the carrying capacity To see the relationship between the limiting behavior of the solutions and the carrying capacity more clearly we use the commands t linspace222 p10tt3t 39r39 to plot the carrying capacity in red We clicked on the DFIELD6 Display window just before executing the plot command to make sure that it is the current gure The result is shown in Figure 318 where we thickened the graph of the carrying capacity since we are not able to show a red curve in this manual This can be done with the command plot 1 31 linewidth 2 You will notice that the limiting behavior of the solutions is linear growth parallel to the graph of the carrying capacity a Figure 318 Plotting in the DFIELD6 Display window Subscripts and Greek Letters The voltage Vc on the capacitor in an RCcircuit satis es the differential equation RCVC Vc Acos wt 34 where R is the resistance in ohms C is the capacitance in farads and A cos cut is a sinusoidal extemal voltage with amplitude A and frequency an Example 7 Use dfield6 to study the response of an RC circuit to external Voltages of different frequencies Use R 0059 and C 2F ForA 5 andw l 2 5 10 20 50 and 100 nd the amplitude of the steadystate response With Vc0 0 Why do you think an RC circuit is sometimes called a lowpass lter Entering this equation into the DFIELD6 Setup window is easy since it is in the gallery Choose Gallery gtRC circuit and make the needed change R 005 The result is Figure 319 Now it is only necessary to change the input for the parameter w and when necessary the maximum value of t to complete the exercise In doing so you will notice that low frequency voltages pass through the RC circuit with their amplitudes practically unchanged while high frequencies are attenuated Hence the name lawpass lter The results for two frequencies are shown in Figures 320 and 321 Notice that the subscripted voltage V6 is entered as Vc into the DFIELD6 Setup window and appears nicely subscripted in the DFIELD6 Display window This is an example of TEX or LATEX notation If you want a subscripted quantity to appear on a MATLAB gure window it is only necessary 39 The minimum value w The mamum value aw Figure 319 The setup window for Example 7 to precede the subscript by an underscore If the subscript contains more than one letter put the entire subscript between curly brackets Ifyou have a superscripted quantity precede the superscript with a caret quot Finally notice that the frequency a is entered in the setup window as omega and appears in the display window in its proper Greek form This too is TEX notation Most Greek letters including some upper case letters can be treated this way Simply spell out the name preoeded by a backslash For example you can use alpha beta gamma theta phi Delta Omega and Theta vamcoswrvgRC Vc39AcosmtrV RC A5 mum R005 02 5 4 a 2 1 o t Figure 320 Response for a 1 Figure 321 Response for a 100 Editing the Display Window The appearanoe of the Display Window can be changed in a variety of ways Changing window settings The menu item Options Windows settings provides several ways to alter the appearanoe of the DFIELD6 Display window Selecting this item will open the DFIELD6 Windows settings dialog box see Figure 322 The rst option involves the three radio buttons and allows you to choose between a line eld a vector eld or no eld at all Some people prefer to use a vector eld to a direction line eld In a vector 40 times as laws as the Figure 322 DFIELD6 Window settings eld a vector is attached to each point instead of the line segment used in a direction eld The vector has its base at the point in question its direction is the slope and the length of the vector re ects the magnitude of the derivative Click the Change settings button to make any change you select There is an edit box in the DFIELD6 Window settings dialog that allows the user to choose the number of eld points displayed The default is 20 points in each row and in each column Change this entry to 10 hit Enter then click the Change settings button to note the affect on the direction eld The design of dfieldG includes the de nition of two windows the DFIELD6 Display window and the calculation window When you start dfieldG the calculation window is 35 times as large as display window in each dimension The computation of a solution will stop only when the solution curve leaves the calculation window This allows some room for zooming to alarger display window without ha in 39 r 39 talso arrow to 39 c t whic leave the display window and later return to it The third item in the DFIELD6 Window settings dialog box controls the relative size of the calculation window It can be given any value greater than or equal to l The smaller this number the more likely that reentrant solutions will be lost The default value of 35 seems to meet most needs but if you are losing too many reentrant solutions you can increase this parameter Marking initial points It is possible to mark the points at which the computation of solutions is started To do this select OptionsgtMark initial points To stop doing so select the same option to uncheck it Initial points that are already plotted can be erased with the command Editgt Erase all marked initial points Level curves Sometimes it is useful to plot level sets of functions in the DFIELD6 Display window In Example 6 instead of plotting the curve P K 3 t from the command line we could have plotted the level curve 7 K 0 This can be done using the command OptionsgtPlot level curves Complete the window as shown in Figure 323 and click Proceed If you want to remove the level sets select EditgtErase all level curves Erasing objects Sometimes when you are preparing a display window for printing you plot a solution urve you wish were not there In the Edit menu there are several commands which allow you to erase items in the DFIELD6 Display window In addition to those we have already explained there are Editgt Erase all solutions and EditgtErase all graphics objects which are self explanatory The last item EditgtDelete a graphics object is much more exible It will allow you to delete individual solution rves as well as text items and graphs you have added to the window Simply choose the option and select the object you wish to delete with the mouse 41 J nrmns ml ms u x Entev the lunctmn m tevms at the vanahles t and x and the Davametevexvvessmns P K r LetDFlELDSdemde r Select a pawl m the Dtsplamedaw l s 6 ENE a vectm at level vaue a I Fwd Figure 323 The DFIELD6 Level sets window Text objects in DFIELDG The DFIELD6 Display window is a standard MATLAB gure window Therefore all of the standard editing commands which we described in Chapter 2 are av 39 able n particular the commands xlabel ylabel and title can be used to change these items To add text at arbitrary points in the DFIELD6 Display window select EditgtEnter text on the Display Window enter the desired text in the Text entry dialog box and then click the OK button Use the mouse to click at the lower left point of the position in the gure window where you want the text to appear Itcan easily happen that your placement of the text does not please you If so remove the text using EditgtDelete a graphics object then try again Using the Property Editors with DFIELDG We described the use of the Property Editors in Chapter 2 While these methods are very powerful and not dif cult to use they do not mix awlessl 39 interactive aspects of dfieldG You should be careful when you use them with the DFIELD6 Display window It is a good idea to complete all of your dfieldG work rst and only then begin to use the formatting commands Do not mix them It is not unusual that MATLAB freezes when the two are mixed It is usually a good idea to select OptionsgtMake the display window inactive before using the tools in the toolbar Other Features of DFIELD6 Printing Saving and Using Clipboards You can print or export the DFIELD6 Display window in any of the ways described in Chapter 2 However the easiest way to print the gure to the default printer is to click the Print button in the DFIELD6 Display window The Print and Quit buttons and the message window will not be printed Saving and Loading DFIELD6 Equation and Gallery Files Suppose that after entering all of the information into the DFIELD6 Setup window for Example 7 as it appears in gure 319 you decided to work on something else and come back to this example later There are two ways to avoid the necessity of reentering the data The rst method is temporary The menu option GallerygtAdd current equation to the gallery will do just that after prompting you for a name for the equation When ou are ready you can choose this equation from the Gallery menu and all of the data will be entered automatically However if you have to quit dfieldG the new entry will no longer be there when you come back For this situation you can use the command FilegtSave the current equation This option allows you to record the information on the DFIELD6 Setup window in a le Executing this option will bring up a standard le save menu where you are given the option of saving the le with a lename and in a 42 directory of your own choice The le will be saved with the suf x dfs It is not necessary to enter dfs It can later be loaded back into dfield6 using the command File gtLoad an equation It is also possible to save and load entire galleries using the appropriate commands on the File menu Gallery les have the suf x df g There is also a command that will delete the entire gallery allowing you to start to build a gallery entirely your own and another command that will reload the default gallery if that is what you want Quitting DFIELD6 Always wait until the word Ready appears in the dfield6 message window before you try to do anything else with df ield6 or MATLAB When you want to quit df ield6 the best way is to use the Q1th buttons found on the DFIELD6 Setup or on the DFIELD6 Display windows Either of these will close all of the dfield6 windows in an orderly manner and it will delete the temporary les that df ield6 creates in order to do its business Plotting Several Solutions at Once Dfield6 allows you to plot several solutions at once Select Options gt Plot several solutions and note that the mouse cursor changes to crosshairs when positioned over the direction eld Select several initial conditions for your solutions by clicking the mouse button at several different locations in the direction eld When you are nished selecting initial conditions position the mouse crosshairs over the direction eld and press the Enter or Return key on your keyboard Solution trajectories will emanate from the initial conditions you selected with the mouse Exercises For the differential equations in Exercises 141 perform each of the following tasks a Print out the direction eld for the differential equation with the display window de ned by t e 75 5 and y e 75 5 You might consider increasing the number of eld points to 25 in the DFIELD6 Window settings dialog box On this printout sketch with a pencil as best you can the solution curves through the initial points to yo 0 0 72 0 73 0 0 l and 4 0 Remember that the solution curves must be tangent to the direction lines at each point b Use df ield6 to plot the same solution curves to check your accuracy Turn in both versions y ty y yZ 7 239 y 2ty1 y2 y y2 y2 7 y Use dfields to plot a few solution curves to the equation x x sint cost Use the display window de ned by x e 71010andt 6 71010 6 Use dfields to plot the solution curves for the equation x l 7 t2 sintx with initial values x 73 72 fl 0 l 2 3 at t 0 Find a display window which shows the most important features of the solutions by experimentation EJ PP EQ For the differential equations in Exercises 7710 perform the following tasks a Use dfields to plot a few solutions with different initial points Start with the display window bounded by 0 g t g 10 and 75 g y g 5 and modify it to suit the problem Print out the display window and turn it in as part of this assignment b Make a conjecture about the limiting behavior of the solutions of as t gt 00 O V Find the general analytic solution to this equation a V Verify the conjecture you made in part b or if you no longer believe it make a new conjecture and verify that 43 y 4y 8 1t2y4zy z ty ty 2 7 y 10 1 my y4 7 yz 000 In Exercises 11714 we will consider a certain lake which has a volume of V 100 km3 It is fed by a river at a rate of r km3year and there is another river which is fed by the lake at a rate which keeps the volume of the lake constant In addition there is a factory on the lake which introduces a pollutant into the lake at the rate of p km3year This means that the rate of ow from the lake into the outlet river is p r km3year Let xt denote the volume of the pollutant in the lake at time t and let Ct x t V denote the concentration of the pollutant 11 Show that under the assumption of immediate and perfect mixing of the pollutant into the lake water the concentration satis es the differential equation 6 p r Vc p V 12 Suppose that r 50 and p 2 a Assume that the factory starts operating at time t 0 so that the initial concentration is 0 Use df ields to plot the solution Remember the de nition of the concentration is x V so you can be sure it is pretty small Choose the dimensions of the display window carefully b It has been determined that a concentration of over 2 is hazardous for the sh in the lake Approxi mately how long will it take until this concentration is reached You can zoom in on the dfields plot to enable a more accurate estimate c What is the limiting concentration About how long does it take for the concentration to reach a concentration of 35 13 Suppose the factory stops operating at time t 0 and that the concentration was 35 at that time Approx imately how long will it take before the concentration falls below 2 and the lake is no longer hazardous for sh Notice that p 0 for this exercise 14 Rivers do not ow at the same rate the year around They tend to be full in the Spring when the snow melts and to ow more slowly in the Fall To take this into account suppose the ow of our river is r 50 20cos27rt713 Our river ows at its maximum rate onethird into the year ie around the rst of April and at its minimum around the rst of October a Setting p 2 and using this ow rate use dfields to plot the concentration for several choices of initial concentration between 0 and 4 If your solution seems erratic reduce the relative error tolerance using Options7gtSolver settings How would you describe the behavior of the concentration for large values of time b It might be expected that after settling into a steady state the concentration would be greatest when the ow was smallest around the rst of October At what time of the year does the highest concentration actually occur Reduce the error tolerance until you get a solution curve smooth enough to make an estimate 15 Use dfields to plot several solutions to the equation z z 7 053 Hint Notice that when z lt t z lt 0 so the direction eld should point down and the solution curves should be decreasing You might have dif culty getting the direction eld and the solutions to look like that If so read the section in Chapter 1 on complex arithmetic especially the last couple of paragraphs A differential equation of the form dxdt f x whose righthand side does not explicitly depend on the iride pendent variable t is called an autonomous differential equation For example the logistic model in Example 5 was autonomous For the autonomous differential equations in Exercises 16 7 19 perform each of the following tasks Note that the rst three tasks are to be performed without the aid of technology a Set the righthand side of the differential equation equal to zero and solve for the equilibrium points b Plot the graph of the righthand side of each autonomous differential equation versus x as in Figure 316 Draw the phase line below the graph and indicate where x is increasing or decreasing as was done in Figure 316 44 c Use the information in parts a and b to draw sample solutions in the xt plane Be sure to include the equilibrium solutions d Check your results with dfields Again be sure to include the equilibrium solutions I V If x0 is an equilibrium point ie if f x0 0 then xt x0 is an equilibrium solution It can be shown that if f x0 lt 0 then every solution curve that has an initial value near x0 converges to x0 as t 7gt 00 In this case x0 is called a stable equilibrium point If f x0 gt 0 then every solution curve that has an initial value near x0 diverges away from x0 as t 7gt 00 and x0 is called an unstable equilibrium point If f x0 0 no conclusion can be drawn about the behavior of solution curves In this case the equilibrium point may fail to be either stable or unstable Apply this test to each of the equilibrium points 16 x cos7rx x e 73 3 l7 xxx727ooltxltoo 18 xxx7227ooltx lt00 19 xxx7237oo ltx lt00 In Exercises 20 7 22 you will not be able to solve explicitly for all of the equilibrium points Instead turn the problem around Use dfields to plot some solutions and from that information calculate approximately where the equilibrium points are and determine the type of each In Exercise 20 you can check your estimate with the code finline 39x1expx x 2 39 zfzerof 1 fz Similar methods will help for Exercises 21 and 22 20 xxle x7x27lx2 2l xx373xl 22 x cosx 7 2x The logistic equation F r Pl 7 PK is discussed in Examples 5 and 6 Usually the parameters r and K are constants and in Example 5 we found that for any solution P t which has a positive initial value we have P t 7gt K as t 7gt 00 For this reason K is called the carrying capacity of the system However in Example 6 we saw a case where the carrying capacity is not constant yet we were able to show how the limiting behavior of the population related to the carrying capacity In Exercises 23726 you are to examine the long term behavior of solutions especially in comparison to the carrying capacity In particular a Use dfields to plot several solutions to the equation It is up to you to nd a display window that is appropriate to the problem at hand b Based on the plot done in part a describe the long term behavior of the solutions to the equation In particular compare this long term behavior to that of K It might be helpful to plot K on the display window as we did in Example 6 In the rst case the solutions will all be asymptotic to a constant In the other two the solutions will all have the same long term behavior Describe that behavior in comparison to the graph of K The results of Examples 5 and 6 should be helpful 23 Kt l 7 e r 1 In this case Kt is monotone increasing and Kt is asymptotic to 1 This might model a situation of a human population where due to technological improvement the availability of resources is increasing with time although ultimately limited 24 Kt l t r 1 Again Kt is monotone increasing but this time it is unbounded This might model a situation of a human population where due to technological improvement the availability of resources is steadily increasing with time and therefore the effects of competition are becoming less severe 25 Kt l 7 cos2m r 1 This is perhaps the most interesting case Here the carrying capacity is periodic in time with period 1 which should be considered to be one year This models a population of insects or small animals that are affected by the seasons You will notice that the long term behavior as t 7gt oo re ects the behavior of K The solution does not tend to a constant but nevertheless all solutions have the same long term behavior for large values of t In particular you should take notice of the location of the 45 maxima and minima of K and of P and how they are related You can use the zoom in option to get a better picture of this 26 Kt 1z7 cos2m r 1 27 Despite the seeming generality of the uniqueness theorem there are initial value problems which have more than one solution Consider the differential equation y alyl Notice that yt E 0 is a solution with the initial condition y0 0 Of course by al yl we mean the nonnegative square root a This equation is separable Use this to nd a solution to the equation with the initial value y to 0 assuming that y 3 0 You should get the answer yt t 7 t024 Notice however that this is a solution only for t 3 to Why b Show that the function 7 0 if t lt to y l r 7 rev4 if 2 to is continuous has a continuous rst derivative and satis es the differential equation y N l c For any to 3 0 the function de ned in part b satis es the initial condition y0 0 Why doesn t this violate the uniqueness part of the theorem d Find another solution to the initial value problem in a by assuming that y g 0 I You might be curious as were the authors about what dfields will do with this equation Find out Use the rectangle de ned by fl 3 t g l and fl 3 y g l and plot the solution of y Wwith initial value y0 0 Also plot the solution for y0 10 50 the MATLAB notation for 10 50 is 1e50 Plot a few other solutions as well Do you see evidence of the nonuniqueness observed in part c An important aspect of differential equations is the dependence of solutions on initial conditions There are two points to be made First we have a theorem which says that the solutions are continuous with respect to the initial conditions More precisely Theorem Suppose that the function ft x is de ned in the rectangle R de ned by a g t g b andc x g d Suppose also that f and BfBx are both continuous in R and that E g L forall tx e R Ift0 x0 and to yo are both in R andif x ftx y ft y and XUO Xo gt100 yo then fort gt to Wt ytl S eu odxo yol as long as both solution curves remain in R Roughly the theorem says that if we have initial values that are suf ciently close to each other the solutions will remain close at least if we restrict our view to the rectangle R Since it is easy to make measurement mistakes and thereby get initial values off by a little this is reassuring For the second point we notice that although the dependence on the initial condition is continuous the term ew m allows the solutions to get exponentially far apart as the interval between t and to increases That is the solutions can still be extremely sensitive to the initial conditions especially over long I intervals 28 Consider the differential equation x x l 7 x2 a Verify that x t E 0 is the solution with initial value x0 0 46 b Use dfields to nd approximately how close the initial value yo must be to 0 so that the solution y t of our equation with that initial value satis es yt 01 for 0 g t g If with I You can use the display window 0 g t g 2 and 0 g x g 01 and experiment with initial values in the Optionsgt Keyboard input window until you get close enough Do not try to be too precise Two signi cant gures is suf cient l l E0 c As the length of the t interval is increased how close must yo be to 0 in order to insure the same accuracy To nd out repeat part b with If 4 6 8 and 10 The results of the last problem show that the solutions can be extremely sensitive to changes in the initial conditions This sensitivity allows chaos to occur in deterministic systems which is the subject of much current research One way to experience rst hand the sensitivity to changes in the initial conditions is to try a little target practice For the ODEs in Exercises 29733 use dfields to nd approximately the value of x0 such that the solution xt to the initial value problem with initial condition x0 x0 satis es xt1 x1 You should use the Keyboard input window to initiate the solution Widen the window to allow a large number of digits in the edit window by clicking and dragging on the right edge After an unsuccessful attempt try again with another initial condition The Uniqueness Theorem should help you limit your choices If you make sure that the Display Window is the current gure by clicking on it and execute plot t1 xl or at the command line you will have a nice target to shoot at You will nd that hitting the target gets more dif cult in each of these problems We allow you to cheat by starting a solution in the target and nding the value at t 0 However be sure to try to hit the target with that initial value You may be surprised at the outcome 29 x x 7 sinxt1 5 x1 2 30 xx27ttl4x10 31 xxlix2t15x105 32 x x sinxtt1 5 x1 0 33 x x sinx2 2 t1 5 x1 1 In this case the authors were not able to hit the target However the exercise of trying is still worthwhile We leave it to you to ponder why it is not possible Appendix Downloading and Installing the Software Used in This Manual The MATLAB programs dfield pplane and odesolve and the solvers eul rk2 and rk4 described in this manual are not distributed with MATLAB They are MATLAB function M les and are available for download over the internet There are versions of df ield and pplane written for use with all recent versions of MATLAB However odesolve is new and only works with MATLAB ver 60 and later The solvers are the same for all versions of MATLAB The following three step procedure will insure a correct installation but the only important point is that the les must be saved as MATLAB M les in a directory on the MATLAB path 0 Create a new directory with the name odetools or choose a name of your own It can be located anywhere on your directory tree but put it somewhere where you can nd it later In your browser go to http math rice eduquotdfield For each le you wish to download click on the link In Internet Explorer you are given the option to save the le In Netscape the le for the software will open in your browser and you can save the le using the File menu In either case save the le with the subscript m in the directory odetools Open the path tool by executing the command pathtool in the MATLAB command window or by selecting File gtSet Path Follow the instructions for adding the directory odetools to the path If you are asked if you want the change to be permanent say yes From this point on the programs will be available in MATLAB 47 o not forget the arbitrary constant If you are asked to solve lVPinitial value problem then basically you need to determine that constant Type 2 Put all the y s in the left side and all the t7s in the right side Say if My 0 then dy 7 t dt My 9 lntegrate it f dg fgtdt Then solve the above equation which gives you the general solution with arbi trary constant WARNING When you divide both side by My you need My 0 Type 3a For the homogeneous equation y aty it is separable And the solution is given by yt fie 10 A is an arbitray constant Type 303 For the inhomogeneous equation y aty ft nd the integration factor rst ut e lama notice there is a negative sign do not have to care about the arbitrary constant from the inde nite integral choose any one Then the solution is given by C yt utftdt m for arbitrary constant 0 Another method for solving inhomogeneous equations Given equations y aty ft7 solve the corresponding homogeneous equa tion ylt atyh to get yh 6 man Note this is NOT the integration factor we just discussed Then let vt dtfte d dt0 yh Finally7 the solution we want is y WWW yh f0 Wadi Gym where yh 6 MR