0% found this document useful (0 votes)
48 views2 pages

Range Kota

Uploaded by

amine123noob
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views2 pages

Range Kota

Uploaded by

amine123noob
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Numerical Analysis: Runge-Kutta Methods (2nd

and 4th Order)

1 Introduction to Runge-Kutta Methods


The Runge-Kutta (RK) methods are a family of iterative methods for solving
ordinary differential equations (ODEs) of the form:

dy
= f (t, y), y(t0 ) = y0
dt
where f (t, y) is a given function, and y0 is the initial condition at t = t0 . The
goal is to approximate y(t) at successive points.
The RK methods approximate the solution by taking weighted averages of
slopes calculated at different points within each step. Two commonly used RK
methods are the 2nd-order and 4th-order methods, which we will discuss in
detail.

2 2nd-Order Runge-Kutta Method (RK2)


The 2nd-order Runge-Kutta method (often called Heun’s Method or the mid-
point method ) is given by:
yn+1 = yn + h k2
where h is the step size, and k1 and k2 are intermediate slopes defined as:

k1 = f (tn , yn )
 
h h
k2 = f tn + , yn + k1
2 2
The RK2 method gives an approximation of y(t) with an error of O(h2 ) per
step.

Algorithm for RK2


1. Compute k1 = f (tn , yn ). 2. Compute k2 = f tn + h2 , yn + h

2 k1 . 3. Update
the solution: yn+1 = yn + h k2 .

1
3 4th-Order Runge-Kutta Method (RK4)
The 4th-order Runge-Kutta method (commonly referred to as RK4 ) is a widely
used method due to its accuracy and efficiency. The RK4 method is given by:
h
yn+1 = yn + (k1 + 2k2 + 2k3 + k4 )
6
where k1 , k2 , k3 , and k4 are computed as follows:

k1 = f (tn , yn )
 
h h
k2 = f tn + , yn + k1
2 2
 
h h
k3 = f tn + , yn + k2
2 2
k4 = f (tn + h, yn + h k3 )
The RK4 method has an error of O(h4 ) per step, which makes it more
accurate than RK2 for the same step size.

Algorithm for RK4


1. Compute k1 = f (tn , yn ). 2. Compute k2 = f tn + h2 , yn + h2 k1 . 3. Com-


pute k3 = f tn + h2 , yn + h2 k2 . 4. Compute k4 = f (tn + h, yn + h k3 ). 5.




Update the solution: yn+1 = yn + h6 (k1 + 2k2 + 2k3 + k4 ).

4 Comparison of RK2 and RK4


- The RK2 method is simpler to compute and requires fewer function evaluations
per step, making it faster but less accurate. - The RK4 method, while requiring
more function evaluations (4 per step), is much more accurate with an error
order of O(h4 ) compared to O(h2 ) for RK2. - Generally, RK4 is preferred for its
higher accuracy, especially when solving complex or stiff differential equations.

5 Example Application
Consider the ODE:
dy
= −2y + 3, y(0) = 1
dt
Using either RK2 or RK4, we can approximate the solution for y(t) over a range
of t values. Choose a step size h, apply the chosen RK method, and iterate to
obtain yn+1 at each step.

You might also like