“main”2007/2/16page 90iiiiiiii90 CHAPTER 1 First-Order Differential Equations31. Consider the general first-order linear differentialequationdydx+ p(x)y = q(x), (1.9.25)where p(x) and q(x)are continuous functions on someinterval (a, b).(a) Rewrite Equation (1.9.25) in differential form,and show that an integrating factor for the result-ing equation isI(x) = ep(x)dx. (1.9.26)(b) Show that the general solution to Equation(1.9.25) can be written in the formy(x) = I−1xI(t)q(t) dt + c,where I is given in Equation (1.9.26), and c is anarbitrary constant.1.10Numerical Solution to First-Order Differential EquationsSo far in this chapter we have investigated first-order differential equations geometricallyvia slope fields, and analytically by trying to construct exact solutions to certain types ofdifferential equations. Certainly, for most first-order differential equations, it simply isnot possible to find analytic solutions, since they will not fall into the few classes for whichsolution techniques are available. Our final approach to analyzing first-order differentialequations is to look at the possibility of constructing a numerical approximation to theunique solution to the initial-value problemdydx= f(x, y), y(x0) = y0. (1.10.1)We consider three techniques that give varying levels of accuracy. In each case, wegenerate a sequence of approximations y1,y2,... to the value of the exact solution atthe points x1,x2,..., where xn+1= xn+ h, n = 0, 1,..., and h is a real number.We emphasize that numerical methods do not generate a formula for the solution to thedifferential equation. Rather they generate a sequence of approximations to the value ofthe solution at specified points. Furthermore, if we use a sufficient number of points, thenby plotting the points (xi,yi) and joining them with straight-line segments, we are able toobtain an overall approximation to the solution curve corresponding to the solution of thegiven initial-value problem. This is how the approximate solution curves were generatedin the preceding sections via the computer algebra system Maple. There are many subtleideas associated with constructing numerical solutions to initial-value problems that arebeyond the scope of this text. Indeed, a full discussion of the application of numericalmethods to differential equations is best left for a future course in numerical analysis.Euler’s MethodSuppose we wish to approximate the solution to the initial-value problem (1.10.1) atx = x1= x0+ h, where h is small. The idea behind Euler’s method is to use thetangent line to the solution curve through (x0,y0) to obtain such an approximation. (SeeFigure 1.10.1.)The equation of the tangent line through (x0,y0) isy(x) = y0+ m(x − x0),where m is the slope of the curve at (x0,y0). From Equation (1.10.1), m = f(x0,y0),soy(x) = y0+ f(x0,y0)(x − x0).“main”2007/2/16page 91iiiiiiii1.10 Numerical Solution to First-Order Differential Equations 91hhhx0x1x2x3y0y1y2y3yxExact solution to IVPSolution curve through (x1, y1)Tangent line to thesolution curve passingthrough (x1, y1)Tangent line at the point(x0, y0) to the exact solution to the IVP(x0, y0)(x1, y1)(x1, y(x1))(x2, y(x2))Figure 1.10.1: Euler’s method for approximating the solution to the initial-value problemdy/dx = f (x, y), y(x0) = y0.Setting x = x1in this equation yields the Euler approximation to the exact solution atx1, namely,y1= y0+ f(x0,y0)(x1− x0),which we write asy1= y0+ hf ( x0,y0).Now suppose we wish to obtain an approximation to the exact solution to the initial-value problem (1.10.1) at x2= x1+ h. We can use the same idea, except we now usethe tangent line to the solution curve through (x1,y1). From (1.10.1), the slope of thistangent line is f(x1,y1), so that the equation of the required tangent line isy(x) = y1+ f(x1,y1)(x − x1).Setting x = x2yields the approximationy2= y1+ hf ( x1,y1),where we have substituted for x2− x1= h, to the solution to the initial-value problemat x = x2. Continuing in this manner, we determine the sequence of approximationsyn+1= yn+ hf ( xn,yn), n = 0, 1,...to the solution to the initial-value problem (1.10.1) at the points xn+1= xn+ h.In summary, Euler’s method for approximating the solution to the initial-value problemy= f(x, y), y(x0) = y0at the points xn+1= x0+ nh (n = 0, 1,...)isyn+1= yn+ hf ( xn,yn), n = 0, 1,... . (1.10.2)“main”2007/2/16page 92iiiiiiii92 CHAPTER 1 First-Order Differential EquationsExample 1.10.1 Consider the initial-value problemy= y − x, y(0) =12.Use Euler’s method with (a) h = 0.1 and (b) h = 0.05 to obtain an approximation toy(1). Given that the exact solution to the initial-value problem isy(x) = x + 1 −12ex,compare the errors in the two approximations to y(1).Solution: In this problem we havef(x, y) = y − x, x0= 0,y0=12.(a) Setting h = 0.1 in (1.10.2) yieldsyn+1= yn+ 0.1(yn− xn).Hence,y1= y0+ 0.1(y0− x0) = 0.5 + 0.1(0.5 − 0) = 0.55,y2= y1+ 0.1(y1− x1) = 0.55 + 0.1(0.55 − 0.1) = 0.595.Continuing in this manner, we generate the approximations listed in Table 1.10.1,where we have rounded the calculations to six decimal places.nxnynExact Solution Absolute Error1 0.1 0.55 0.547414 0.0025852 0.2 0.595 0.589299 0.0057013 0.3 0.6345 0.625070 0.0094304 0.4 0.66795 0.654088 0.0138625 0.5 0.694745 0.675639 0.0191066 0.6 0.714219 0.688941 0.0252787 0.7 0.725641 0.693124 0.0325188 0.8 0.728205 0.687229 0.0409769 0.9 0.721026 0.670198 0.05082810 1.0 0.703129 0.640859 0.062270Table 1.10.1: The results of applying Euler’s method with h = 0.1 to the initial-value problemin Example 1.10.1.We have also listed the values of the exact solution and the absolute value of theerror. In this case, the approximation to y(1) is y10= 0.703129, with an absoluteerror of|y(1) − y10|=0.062270. (1.10.3)(b) When h = 0.05, Euler’s method givesyn+1= yn+ 0.05(yn− xn), n = 0, 1,...,19,which generates the approximations given in Table 1.10.2, where we have listedonly every other intermediate approximation. We see that the approximation toy(1) isy20= 0.673351“main”2007/2/16page 93iiiiiiii1.10 Numerical Solution to First-Order Differential Equations 93and that the absolute error in this approximation is|y(1) − y20|=0.032492.nxnynExact Solution Absolute Error2 0.1 0.54875 0.547414 0.0013354 0.2 0.592247 0.589299 0.0029486 0.3 0.629952 0.625070 0.0048818 0.4 0.661272 0.654088 0.00718510 0.5 0.685553 0.675639 0.00991312 0.6 0.702072 0.688941 0.01313114 0.7 0.710034 0.693124
View Full Document