1 / 60

Numerical Solutions of Ordinary Differential Equations

CHAPTER 6. Numerical Solutions of Ordinary Differential Equations. Contents. 6.1 Euler Methods and Error Analysis 6.2 Runge-Kutta Methods 6.3 Multistep Methods 6.4 Higher-Order Equations and Systems 6.5 Second-Order Boundary-Value Problems. 6.1 Euler Method and Error Analysis.

ailis
Télécharger la présentation

Numerical Solutions of Ordinary Differential Equations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CHAPTER 6 Numerical Solutions of Ordinary Differential Equations

  2. Contents • 6.1 Euler Methods and Error Analysis • 6.2 Runge-Kutta Methods • 6.3 Multistep Methods • 6.4 Higher-Order Equations and Systems • 6.5 Second-Order Boundary-Value Problems

  3. 6.1 Euler Method and Error Analysis • IntroductionRecall the backbone of Euler’s Methodyn+1 = yn + hf(xn, yn) (1) • Errors in Numerical MethodsOne of the most important error sources is round-off error.

  4. Truncation Errors for Euler’s Methods • This algorithm gives only a straight-line approximation to the solution. This error is called the local truncation error, or discretization error. To derive a formula for the truncation error of Euler’s method, we use the Taylor’s formula with remainder. Where c is some point between a and x.

  5. Setting k = 1, a = xn, x = xn+1= xn + h, we haveorHence the truncation error in yn+1of Euler’s method is where xn < c < xn+1The value of c is usually unknown, but an upper bound is where

  6. Note: The e(h) is said to be of order hn, denoted by O(hn),if there exists a constant C such that |e(h)|  Chn for h sufficiently small.

  7. Example 1 Find a bound for the local truncation errors for Euler’s method applied to SolutionFrom the solution we have soIn particular, h = 0.1,then the upper bound by replacing c by 1.1 is

  8. Example 1 (2) When we take five steps, replacing c by 1.5, then(2)

  9. Improved Euler’s Method • (3)where (4)is commonly known as the Improved Euler’s method. See Fig 6.1 • In general, the improved Euler’s method is an example of predictor-corrector method.

  10. Fig 6.1

  11. Example 2 Use the improved Euler’s method to obtain the approximate value y(1.5) for the solution of . Compare the results for h = 0.1and h = 0.05. SolutionWith x0 = 1, y0 = 1, f(xn, yn) =2xnyn , h = 0.1 y1* = y0 + (0.1)(2xy) = 1.2Using(3) with x1= 1 + h = 1.1The results are given in Table 6.3 and 6.4.

  12. Table 6.3

  13. Table 6.4

  14. Truncation Errors for the Improved Euler’s MethodNote that he local truncation error is O(h3).

  15. 6.2 Runge-Kutta Methods • Runge-Kutta MethodAll the Runge-Kutta Methods are generalizations of the basic Euler’s Formula, that the slope function f is replaced by a weighted average of slopes over the interval xn x  xn+1(1) where the weights wi, i = 1, 2, …, m are constants satisfying w1+ w2+ … + wm= 0,and ki is the function evaluated at a selected point (x, y)for which xn x  xn+1.

  16. The number m is called the order. If we take m = 1, w1 = 1, k1= f(x, yn),we get the Euler’s method. Simply it is the first-order Runge-Kutta method.

  17. A Second-order Runge-Kutta Method • We try to find some values of constants so that the formula (2)where k1= f(xn, yn), k2= f(xn+h, yn+hk1)agrees with a Taylor formula with degree 2. These constants satisfy (3)then (4)where w2 0.

  18. Eg: we choose w2 = ½ ,yields w1 = ½ ,  = 1,  = 1,and (2) becomesyn+1= yn+(k1+ k2)h/2where k1= f(xn, yn), k2= f(xn+h, yn+hk1).Since xn + h = xn+1, yn+ hk1= yn + hf(xn, yn), it is identical to the improved Euler’s methods.

  19. A Forth-order Runge-Kutta Method • We try to find parameters so that the formula (5)where agrees with a Taylor formula with degree 4.

  20. The most commonly used set of values yields the following results. (6)

  21. Example 1 Use the RK4 method with h = 0.1to obtain y(1.5) for the solution of y’ =2xy, y(1) = 1. SolutionWe first compute the case n = 0.

  22. Example 1 (2) Therefore,See table 6.5.

  23. Table 6.5 h=0.1

  24. Table 6.6 shows some comparisons.

  25. Truncation Error for the RK4 method • Since it is of degree 4, then the local truncation error is O(h5)and the global truncation error isO(h4). However, this is beyond the scope of this text.

  26. Example 2 Find a bound for the local truncation error of RK4 for the solution of SolutionBy computing the fifth derivative of the known solution we get (7)Thus with c= 1.5,then (7) = 0.00028.Table 6.7 gives the approximations to the solution of the initial-value problem at x = 1.5 by the RK4 method.

  27. Table 6.7

  28. 6.3 Multistep Method • Adams-Bashforth-Moulton MethodThe predictor is the Adams-Bashforth formula (1)where n  3.

  29. The value of yn+1* is then substitutedinto the Adams-Moulton corrector (2)

  30. Example 1 Use the above method with h = 0.2to obtain y(0.8) for the solution of SolutionWith h = 0.2, y(0.8)will be approximated by y4. To get started, we use the RK4 method with x0 = 0, y0 = 1, h = 0.2to obtainy1 = 1.02140000, y2 = 1.09181796,y3 = 1.22210646

  31. Example 1 (2) Now with x0 = 0, x1 = 0.2, x3 = 0.4, x4 = 0.6,andf(x, y) = x + y – 1,we findThen predictor (1) gives

  32. Example 1 (3) To use the corrector (2), we need

  33. Stability of Numerical Methods • We say a numerical method is stable, if small changes in the initial condition result in only small changes in the computed solution.

  34. 6.4 Higher-Order Equations and Systems • Second-Order IVPsAn IVP(1)can be expressed by (2)Since y’(x0) = u0,then y(x0) = y0, u(x0) = u0.Apply the Euler’s method to (2) (3)

  35. whereas the RK4 method is applied (4)whereIn general,

  36. Example 1 Use the Euler’s method to obtain y(0.2),where(5) SolutionLet y’ = u, then (5) becomesFrom (3)

  37. Example 1 (2) Using h = 0.1, y0 =1, u0 = 2, we find

  38. Fig 6.2 • Fig 6.2 shows the comparison of results between by Euler’s method and by the RK4 method.

  39. Example 2 Write as a system of first-order DEs. SolutionWe write After simplification

  40. Example 2 (2) Let Then the original system can be

  41. Numerical Solution of a System • The solution of a system of the formcan be approximated by numerical methods.

  42. For example, by the RK4 method: (6)looks like this: (7)

  43. where (8)

  44. Example 3 ConsiderUse the RK4 method to approximate x(0.6) and y(0.6)with h = 0.2and h = 0.1. SolutionWith h = 0.2and the given data, from (8)

  45. Example 3 (2)

  46. Example 3 (3) Therefore, from (7) we get See Fig 6.3 and Table 6.8, 6.9.

  47. Fig 6.3

  48. Table 6.8

  49. Table 6.9

  50. 6.5 Second-Order BVPs • Finite Difference ApproximationThe Taylor series at a point a of y(x)isIf we set h = x – a, thenRewrite the last expression as (1)and (2)

More Related