Runge-Kutta methods with examples

3,348 views 22 slides Jul 20, 2020
Slide 1
Slide 1 of 22
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22

About This Presentation

Runge-Kutta methods are described with explanation, application, graphical representation, examples and algorithm in easy way.


Slide Content

Runge-Kutta methods k_1 = hf(x_n,y_n ) k_2 = hf(x_n+1/2h,y_n+1/2k_1 ) k_3 = hf(x_n+1/2h,y_n+1/2k_2 ) k_4 = hf(x_n+h,y_n+k_3 ) y_(n+1) = y_n+1/6k_1+1/3k_2+1/3k_3+1/6k_4+O(h^5 )

Academic Description Presenter Details: Md. Sajjad Hossain Id: 18010101 Md. Shoheal Hossan Id: 18010125 Tasmia Kamal Id: 18010126 5 th semester ,31 st batch, CSE Course title: Numerical Analysis Course Code: CSE 311 C ourse Teacher: Wahidul Alam Sr. Lecturer, CSE, FSET, USTC. University of Science and Technology Chittagong Department of Computer Science and Engineering 2

Definition of Runge-Kutta methods: In numerical analysis, the R unge-kutta methods are a family of implicit and explicit interactive methods which include the well-known routine called the Euler Method, used in temporal discretization for the approximate solutions of ordinary differential equation. These methods were developed around 1900 by the German mathematician Carl Runge and Wilhelm Kutta . 3

The most widely known member of the Runge-Kutta family is generally referred to as “RK4”, “Classic Runge-Kutta method or simply as “the Runge-Kutta method.

Application: The application of Runge-Kutta methods as a means of solving non-linear partial differential equations is demonstrated with the help of a specific fluid flow problem. The numerical results obtained are compared with the analytical solution and the solution obtained by implicit, explicit and Crank-Nicholson finite difference methods. The error analysis and computational efficiency analysis are performed to test each method. 5

Explanation of the Runge - Kutta Methods: Let an initial value problem be specified as follows: = f(t, y), y(t o ) = y o Here, y is an unknown function (scalar or vector) of time t, which we would like to approximate; we told that , the rate at which y changes, is a function from t and t to y itself. At the initial time is t and the corresponding y value is y o . The function f and the initial conditions t o , y o are given.   6

Now pick a step-size h>0 and define y n+1 = y n + (k 1 +2k 2 +2k 3 +k 4 ); t n+1 = t n + h for n=0, 1, 2, 3,…. Using k 1 = hf ( t n ,y n ) k 2 = hf ( t n + , y n + ) k 3 = hf( t n + , y n + ) k4= hf ( t n +h , y n + k 3 )  

Here , y n+1 is the RK4 approximation of y(t n +1), and the next value (y n +1) is determined by the present value ( y n ) plus the weighted average of four increments, where each increment is the product of the size of the interval h and an estimated slope specified by function f on the right-hand side of the differential equation

k 1 is the slope at the beginning of the interval using y (Euler’s method); k 2 is the slope at the midpoint of the interval using y and k 1 ; k 3 is again the slope at the midpoint, but now using y and k 2 ; k 4 is the slope at the end of the interval, using y and k 3.   In averaging the four slopes , greater weight is given to the slopes at the midpoint. If f is the independent of y, so that the differential equation is equivalent to a simple integral.

Graphical Representation: 10

Example: Example 1: Using Runge-Kutta method Solve y’ = xy for x= 1.4. Initially x = 1, y=2 (take h= 0.2)   Solution : The given differential equation is,   = f(x, y) = x y Given that x = 1, y = 2, and h= 0.2 First interval: K 1 = h f(x , y 0) = 0.2 f(1,2 ) = 0.2 (1 x 2) = 0.4   11

k 2 = h f(x + , y + ) = 0.2 f(1.1 , 2.2) = 0.2 (1.1 x 2.2) = 0.484 k 3 = h f(x + , y + ) = 0.2 f(1.1 , 2.242) = 0.2 ( 1.1 x 2.242) = 0.49324 k 4 = h f(x + , y + k 3 ) = 0.2 f(1.1 , 2.49324) = 0.2 ( 1.1 x 2.49324 ) = 0.5983776   x + = 1+ = 1.1 y + 2+ = 2.2 y + = 2 + = 2.242 x + h =1+ 0.2 = 1.2 y + k 3 = 2 + 0.49324 = 2.49324  

Here, x 1 = x + h = 1+ 0.2 = 1.2 y 1 = y + (k 1 +2k 2 +2k 3 +k 4 ) = 2+ (0.4 + 2 x 0.484 +2 x 0.49324 + 0.5983776) = 2 + (0.4 + 0.968+0.98648 + 0.5983776 ) = 2.4921429 Second Interval, k 1 = h f(x 1 , y 1 ) = 0.2 f(1.2, 2.4921429) = 0.2 ( 1.2 x 2.4921429) = 0.5981143  

k 2 = h f(x 1 + , y 1 + ) = 0.2 f(1.3 , 2.7911999) = 0.2 (1.3 x 2.7911999) = 0.725712 k 3 = h f(x 1 + , y 1 + ) = 0.2 f(1.3 , 2.8549989) = 0.2 ( 1.3 x 2.8549989 ) = 0.7422997 k 4 = h f(x 1 + , y 1 + k 3 ) = 0.2 f(1.1 , 3.2344426 ) = 0.2 (1.1 x 3.2344426 ) = 0.9056439   x 1 + = 1.2+ = 1.3 y 1 + 2.4921429+ = 2.7911999 y 1 + = 2.4921429 + = 2.8549989 x 1 + h =1.2+ 0.2 = 1.4 y 1 + k 3 = 2.4921429 + 0.7422997 = 3.2344426  

Since, x 2 = x 1 + h = 1.2 +.2 = 1.4 and, y 2 = y 1 + (k 1 +2k 2 +2k 3 +k 4 ) = 2.4921429 + ( 0.5981143 +1.451424 + 1.4845994 + 0.9056439) = 3.2321065 The value of x and y can be tabularized by:   x 1 1.2 1.4 y 2 2.4921429 3.2321065

Example: Example 2: Use Runge-Kutta quadratic method to calculate three additional points on thesolution curve of the problem   = 1-2xy, y(0) = 0, h= 0.1   Solution: The given differential equation is,   = 1- 2xy; given initial condition y(0) = 0, x = 0 and h= 0.1 K 1 = h f(x , y 0) = 0.1f(0, 0) = 0.1(1-2 x 0x0) = 0.1   16

k 2 = h f(x + , y + ) = 0.1f(0+ , 0+ ) = 0.1 f(0.05 , 0.05) = 0.1 (1- 2 x0.05 x0.05) = 0.0995 k 3 = h f(x + , y + ) = 0.1f(0.05, 0 + ) = 0.1 f(0.5 , 0.04975) = 0.1 (1- 2 x0.05 x 0.04975 ) = 0.0995025  

k 4 = h f(x + , y + k 3 ) = 0.1 f(0.1 , 0.0995025 ) = 0.2 ( 1-2x 0.1 x 0.0995025 ) = 0.09801 X 1 = x + h = 0 + 0.1 = 0.1 Since, y 1 = y + (k 1 +2k 2 +2k 3 +k 4 ) = 0 + ( 0.1 +2x 0.0995 + 2 x 0.0995025 + 0.09801) = ( 0.1 + 0.199 + 0.199005 + 0.09801) = 0.0993358 = 0.099336  

The value of x and y can be tabularized by: x 0.1 y 0.99336

 Algorithm ( Runge-Kutta ) Method of order 4 20

References: Text book: Numerical Analysis by A.R. Vasishtha and Vipin Vasishtha https://en.wikipedia.org/wiki/Runge%E2%80%93Kutta_methods https :// www.quora.com/What-are-the-applications-of-the-Runge-Kutta-method-in-real-life-based 21

Ask frequently, if you have any QUESTION???