×

Close

- Computer Based Numerical Methods - CBNM
- Note
**uttar pradesh technical university - uptu**- Master of Computer Applications
- MCA
**40 Views**- 2 Offline Downloads
- Uploaded 9 months ago

Runge-Kutta 2nd Order Method for Ordinary Differential Equations Autar Kaw After reading this chapter, you should be able to: 1. understand the Runge-Kutta 2nd order method for ordinary differential equations and how to use it to solve problems. What is the Runge-Kutta 2nd order method? The Runge-Kutta 2nd order method is a numerical technique used to solve an ordinary differential equation of the form dy = f (x, y ), y (0 ) = y 0 dx Only first order ordinary differential equations can be solved by using the Runge-Kutta 2nd order method. In other sections, we will discuss how the Euler and Runge-Kutta methods are used to solve higher order ordinary differential equations or coupled (simultaneous) differential equations. How does one write a first order differential equation in the above form? Example 1 Rewrite dy + 2 y = 1.3e − x , y (0 ) = 5 dx in dy = f ( x, y ), y (0) = y 0 form. dx Source URL: http://numericalmethods.eng.usf.edu/ Saylor URL: http://www.saylor.org/courses/me205/ Attributed to: University of South Florida: Holistic Numerical Methods Institute Saylor.org Page 1 of 17

Solution dy + 2 y = 1.3e − x , y (0 ) = 5 dx dy = 1.3e − x − 2 y, y (0 ) = 5 dx In this case f ( x, y ) = 1.3e − x − 2 y Example 2 Rewrite ey dy + x 2 y 2 = 2 sin(3 x), y (0 ) = 5 dx in dy = f ( x, y ), y (0) = y 0 form. dx Solution ey dy + x 2 y 2 = 2 sin(3 x), y (0 ) = 5 dx dy 2 sin(3 x) − x 2 y 2 = , y (0 ) = 5 dx ey In this case 2 sin(3 x) − x 2 y 2 f ( x, y ) = ey Runge-Kutta 2nd order method Euler’s method is given by Source URL: http://numericalmethods.eng.usf.edu/ Saylor URL: http://www.saylor.org/courses/me205/ Attributed to: University of South Florida: Holistic Numerical Methods Institute Saylor.org Page 2 of 17

yi +1 = yi + f ( xi , yi )h (1) where x0 = 0 y 0 = y ( x0 ) h = xi +1 − xi To understand the Runge-Kutta 2nd order method, we need to derive Euler’s method from the Taylor series. yi +1 = y i + dy dx (xi +1 − xi ) + 1 d 2 2! dx xi , y i = y i + f ( xi , y i )( xi +1 − xi ) + y 3 y 3! dx 3 (xi +1 − xi )2 + 1 d 2 xi , y i (xi +1 − xi )3 + ... xi , y i 1 1 2 3 f ' ( xi , y i )( xi +1 − xi ) + f ' ' ( xi , y i )( xi +1 − xi ) + ... (2) 2! 3! As you can see the first two terms of the Taylor series yi +1 = y i + f ( xi , yi )h are Euler’s method and hence can be considered to be the Runge-Kutta 1st order method. The true error in the approximation is given by Et = f ′( xi , yi ) 2 f ′′( xi , yi ) 3 h + h + ... 2! 3! (3) So what would a 2nd order method formula look like. It would include one more term of the Taylor series as follows. yi +1 = y i + f ( xi , y i )h + 1 f ′( xi , y i )h 2 2! (4) Let us take a generic example of a first order ordinary differential equation Source URL: http://numericalmethods.eng.usf.edu/ Saylor URL: http://www.saylor.org/courses/me205/ Attributed to: University of South Florida: Holistic Numerical Methods Institute Saylor.org Page 3 of 17

dy = e − 2 x − 3 y, y (0 ) = 5 dx f ( x , y ) = e −2 x − 3 y Now since y is a function of x, f ′( x, y ) = ∂f ( x, y ) ∂f ( x, y ) dy + ∂y dx ∂x (5) = [( )]( ∂ −2 x ∂ −2 x e − 3y + e − 3 y e −2 x − 3 y ∂x ∂y ( ) ( = −2e −2 x + (−3) e −2 x − 3 y ) ) = −5e −2 x + 9 y The 2nd order formula for the above example would be yi +1 = y i + f ( xi , y i )h + ( 1 f ′( xi , y i )h 2 2! ) = yi + e − 2 xi − 3 yi h + ( ) 1 − 5e −2 xi + 9 yi h 2 2! However, we already see the difficulty of having to find f ′( x, y ) in the above method. What Runge and Kutta did was write the 2nd order method as yi +1 = y i + (a1 k1 + a 2 k 2 )h (6) where k1 = f ( x i , y i ) k 2 = f ( xi + p1h, y i + q11 k1 h ) (7) This form allows one to take advantage of the 2nd order method without having to calculate f ′( x, y ) . Source URL: http://numericalmethods.eng.usf.edu/ Saylor URL: http://www.saylor.org/courses/me205/ Attributed to: University of South Florida: Holistic Numerical Methods Institute Saylor.org Page 4 of 17

## Leave your Comments