runge kutta
TRANSCRIPT
1MOHAN LAL SUKHADIA UNIVERSITY
TOPIC :RUNGE-KUTTA METHOD
SUBMITTED BY :SHUBHAM TOMAR
SUBMITTED TO:Mrs. DIPTI MA’AM
2CONTENTS :
• Introduction
• Example of Second-order Runge-kutta method
• Fourth order Runge-kutta method
• Example of fourth order Runge-kutta method
• Illustration of Heun’s Method
• Illustration of Runge-Kutta second order
• Illustration of Runge Kutta fourth order
• Introduction• Runge-kutta method are popular because of efficiency.
• It is single step method as Euler’s method.
• Developed by two German mathematicians Runge and kutta .
• Also called R-K method.
• Runge-kutta method distinguished by their order
3
Illustrating Heun’s Method• Also Known as Runge Kutta
Method• Given dy/dx=f(x,y)and
y(x1 )= y1
• Draw straight line from (x1,y1) with a slope s1=f (x1,y1).
• Draw straight line from (x2,y2)
• Let it cut vertical line through x1+h at slope s2=(x2,y2’)
• Now connect (x1,y1) and (x2,y2) which is slope (s1+s2)/2
• We got y2=y1+(s1+s2)
4
Illustrating Runge-Kutta 2th order method• Also Known as Polygon Method• Draw straight line from (x1,y1)
find the value of y where this line cuts vertical line erected at x1+h/2 call it yh
• Calculate f(x1+h/2, yh) which is slope of solution curve at this point
• Go back to (x1,y1) and draw a straight line with slope s2
• We have yi+1=yi+hf(xi+h/2,yi+sih/2 )
5
Illustrating Runge-Kutta 4th order method• Give the point A=(xi,yi) on the
solution curve.• Draw straight line cut the
vertical line erected at xi+h/2 at B this slope s2= f(x1+h/2, yi+sih/2.
• Draw another straight line starting at A with slope s3
• Go back to (x1,y1) and draw a straight line with slope s2
• Let this straight line cut the vertical line erected at xi+h at D
• Find the slope s4 of the solution curve at D
• We haveyi+1=yi+h/6(s1+2s2,2s3+s4)
6
Eg: find the numerical solution of the initial value problem described as
y+x/y-x y(0)=1 At x=0.4 and taking h=0.2
Solution:f(x,y)=y+x/y-x h=0.2 x0=0 and y0=1
We have to calculate first : y1=y0+(k1+k2)
K1 =f(x0,y0) =(1+0)/(1-0) =1
K2 =f(x0+h,y0+hk1) =f(0+.2,1+0.2*1) =1.24
7
Y1 =1+0.2(1+1.4)=24
X1 =0+0.2=0.2 h=0.2
now calculate y2 =y1+(k1+k2)k1=f(x1,y1) k2=f(x1+h,y1+hk1) =(y+x)/(y-x) =f(0.2+0.2, 1.24+0.2*1.3846) =(1.24+0.2)/1.24-0.2 =1.7162 =1.3846
y2=1.24+(1.3846+1.7162) =1.5500
8
Runge-Kutta 4th order methodyn+1=yn+(k1+2k2+2k3+k4)
k1=f(xn, yn)
k2=f(xn+h/2, yn+h)
k3=f(xn+h/2, yn+h)
k4=f(xn+h, yn+hk3)
9
Eg: find the numerical solution of the initial value problem described as y+x/y-x y(0)=1 At x=0.4 and taking h=0.2
Solution:
k1= f(x0,y0) =(1+0)/(1-0) =1
k2=k2=f(xn+h/2, yn+h) =f(0+.2/2, 1+*1) = (0.1, 1+0.1) = 1.2
k3= f(x0+h/2, y0+h) =f(0+0.2/2,1+0.2*) =(0.1, 1.12) =1.1960
f(x,y)=y+x/y-x h=0.2 x0=0 and y0=1
10
k4= f(x0+h, y0+hk3) = f(0+0.2,1+0.2*1.196) = (0.2,1.2392) = 1.3848
y1=y0+(k1+2k2+2k3+k4)
=1+(1+2*1.2+2*1.960+1.3848)
= 1+(7.1768) =1.2392
11
x1=0.2, y1=1.2392, calculate y2=y1+h/6(k1+2k2+2k3+k4)
k1=f(x1,y1) =f(0.2,1.2392) =(1.4392/1.0392) =1.3849
k2=f(x1+h/2, y1+h) =(0.2+0.1,1.2392+.1384) =(.3,1.3776) =1.5567
k3= f(x1+h/2, y1+h) =f(.2+.2/2,1.2392+.2*) =(0.3, 1.1556) =1.7012
k4= f(x1+h, y1+hk3) = f(.2+.2,1.2392+.3402) = (0.4,1.5794) = 1.6783
Y2= (1.2392+.2/6(1.3849+2*1.5546+2*1.7012+1.6783))
= 1.55836
y2 =y1+(k1+2k2+2k3+k4)
12
x2=0.4, y2=1.55836, calculate y3=y2+h/6(k1+2k2+2k3+k4)
k1=f(x2,y2) =f(0.4,1.5583) =(1.9583/1.1583) =1.6906
k2=f(x2+h/2, y2+h) =(0.4+0.1,1.5583+.16906) =(.5,1.7273) =1.8147
k3= f(x2+h/2, y2+h) =f(.4+.2/2,1.5583+.2*) =(0.5, 1.7397) =1.8066
k4= f(x2+h, y2+hk3) = f(.4+.2,1.5583+.18066) = (0.6,1.7389) = 2.0536
Y3= (1.5583+.2/6(1.6906+2*1.8147+2*1.8066+2.0536))
= 1.9245
y3 =y2+(k1+2k2+2k3+k4)
13
x3=0.6, y3=1.92452, calculate y4=y3+h/6(k1+2k2+2k3+k4)
k1=f(x3,y3) =f(0.6,1.9245) =(2.5245/1.3245) =1.9060
k2=f(x3+h/2, y3+h) =(0.6+0.1,1.9245+.1906) =(.7,2.1151) =1.9893
k3= f(x3+h/2, y3+h) =f(.6+.2/2,1.9245+.2*) =(0.7, 2.1234) =1.9835
k4= f(x3+h, y3+hk3) = f(.6+.2,1.9245+.1983) = (0.8,2.1228) = 2.2095
Y4= (1.9245+.2/6(1.9060+2*1.9893+2*1.9835+2.2095))
= 2.3265
y4 =y3+(k1+2k2+2k3+k4)
14
15