# Assignment: Runge-Kutta Methods

**Topics:**Runge–Kutta methods, Initial value problem, Boundary value problem

**Pages:**2 (426 words)

**Published:**February 17, 2013

We will solve the initial value problem,

du

= − 2 u x 4 , u(0) = 1 ,

dx

to obtain u(0.2) using x = 0.2 (i.e., we will march forward by just one x). (i) 3rd order Runge-Kutta method

For a general ODE,

du

= f x , u x

dx

, the formula reads

u(x+x) = u(x) + (1/6) (K1 + 4 K2 + K3) x ,

K1 = f(x, u(x)) ,

K2 = f(x+x/2, u(x)+K1x/2) ,

K3 = f(x+x, u(x)K1x+2 K2x) .

In our case, f(x, u) = 2u + x + 4. At x = 0 (the initial state), and using x = 0.2, we have K1 = f(0, u(0)) = f(0, 1) = 2*1+0+4 = 2

K2 = f(0.1, u(0)+2*0.2/2) = f(0.1, 1.2) = 2*1.2+0.1+4 = 1.7 K3 = f(0.2, u(0)2*0.2+2*1.7*0.2) = f(0.2, 1.28) = 2*1.28+0.2+4 = 1.64 Thus,

u(0.2) = u(0) + (1/6)* (2 + 4*1.7+ 1.64)* 0.2 = 1.348 .

(ii) 4th order Rugne-Kutta method

For a general ODE,

du

= f x , u x

dx

, the formula reads

u(x+x) = u(x) + (1/6) (K1 + 2 K2 + 2 K3 + K4) x ,

K1 = f(x, u(x)) ,

K2 = f(x+x/2, u(x)+K1x/2) ,

K3 = f(x+x/2, u(x)+K2x/2) ,

K4 = f(x+x, u(x)+K3x)

For our I.V.P., using x = 0.2, we have

K1 = f(0, u(0)) = f(0, 1) = 2*1+0+4 = 2

K2 = f(0.1, u(0)+2*0.2/2) = f(0.1, 1.2) = 2*1.2+0.1+4 = 1.7 K3 = f(0.1, u(0)+1.7*0.2/2) = f(0.1, 1.17) = 2*1.17+0.1+4 = 1.76 K4 = f(0.2, u(0)+1.76*0.2) = f(0.2, 1.352) = 2*1.352+0.2+4 = 1.496 , which leads to

u(0.2) = u(0)+(1/6)*(2+2*1.7+2*1.76+1.496)*0.2 = 1.3472 .

Note that the exact solution is u(x) = 0.75 exp(2x)+0.5x+1.75, or u(0.2) = 1.3472599... The 4th order R-K method is more accurate than the 3rd order R-K method with the same x.

Please join StudyMode to read the full document