SECOND ORDER
BY HEUN METHOD
1 1
yi+1=yo+( 2 k1+ 2 k2)h 2nd Iteration
xo=xo+h=0+1.5=1.5 ;yo=4.3021
Where: k1=f(xo,yo)
k1=f(xo,yo) k1=f(1.5,4.3021)
k2=f(xo+h,yo+k1h) k1=-1.0514
Example k2=f(xo+h,yo+k1h)
Find the value of y when x=3 k2=f[1.5+1.5,4.3021+(-1.0514)(1.5)]
f(x,y)=3e-x-0.4y k2=f(3,2.725)
The initial condition at x=0;y=5;h=1.5 k2=-0.9406
Solution 1 1
yi+1=yo+( 2 k1+ 2 k2)h
1st Iteration
k1=f(xo,yo)
1 1
=f(0,5) yi+1=4.3021[ 2 (-1.0514)+ 2 (-0.9406)]1.5
=3e-0-0.4(5)
k1 =1 yi+1=2.8081 ~ y(3)
k2=f(xo+h,yo+k1h)
k2=f[0+1.5,5+1(1.5)]
k2=f(1.5,6.5)
k2=3e-1.5-0.4(6.5)
k2=-1.9306
1 1
yi+1=yo+( 2 k1+ 2 k2)h
1 1
yi+1=5+[ 2 (1)+ 2 (-1.9306)]1.5
yi+1=4.3021 ~ y(1.5)
SECOND ORDER
BY MIDPOINT METHOD
yi+1=yo+k2h
WHERE
k1=f(xo,yo) 2nd Iteration
1 1
k2=f(xo+ 2 h,yo+ 2 k1h) X0=x0+h=1.5 ; yo=3.6757
Example
Find the value of y when x=3 k1=f(xo,yo)
f(x,y)=3e-x-0.4y k1=f(1.5,3.6757)
The initial condition at x=0;y=5;h=1.5 k1=-0.8009
1 1
SOLUTION k2=f(xo+ 2 h,yo+ 2 k1h)
1 1
1st Iteration k2=f[1.5+ 2 (1.5),3.6757+ 2 (- 0.8009)
k1=f(xo,yo) (1.5)]
=f(0,5) k2=f(2.25,3.0750)
=3e-0-0.4(5) k2=-0.9138
k1 =1
yi+1=yo+k2h
1 1 yi+1=3.6757+(-0.9138)(1.5)
k2=f(xo+ 2 h,yo+ 2 k1h)
yi+1=2.305 ~ y(3)
1 1
k2=f[0+ 2 (1.5),5+ 2 (1)(1.5)]
k2=f(0.75,5.75)
k2=-0.8829
yi+1=yo+k2h
yi+1=5+(-0.8829)(1.5)
yi+1=3.6757 ~ y(1.5)
k3=3e-1.5-0.4(0.8513)
k3=0.3289
Third order
1
Yi+1=yo+ 6 (k1+4k2+k3)h
1
Yi+1=yo+ 6 (k1+4k2+k3)h
WHERE: 1
Yi+1=5+ 6 (1+4(-0.8829)+ 0.3289)1.5
k1=f(xo,yo)
1 1 Yi+1=4.4493 ~ y(1.5)
k2=f(xo+ 2 h,yo+ 2 k1h)
k3=f(xo+h,yo-k1h+2k2h) 2nd Iteration
Xo=0+1.5=1.5 yo=4.4493
Example k1=f(xo,yo)
Find the value of y when x=3 k1=f(1.5, 4.4493)
f(x,y)=3e-x-0.4y k1=3e-1.5-0.4(4.4493)
The initial condition at x=0;y=5;h=1.5 k1=-1.1103
SOLUTION 1 1
k2=f(xo+ 2 h,yo+ 2 k1h)
1st Iteration
1 1
k2=f[1.5+ 2 (1.5), 4.4493+ 2 ¿-1.1103)1.5]
k1=f(xo,yo)
k1=f(0,5) k2=f(2.25,3.6166)
k1=3e-0-0.4(5) k2=3e-2.25-0.4(3.6166)
k1=1 k2=-1.1304
1 1 k3=f(xo+h,yo-k1h+2k2h)
k2=f(xo+ 2 h,yo+ 2 k1h) k3=f(1.5+1.5, 4.4493-k1h+2k2h)
1 1 k3=f(3,2.7236)
k2=f[0+ 2 (1.5),5+ 2 (1)(1.5)]
k3=3e-3-0.4(2.7236)
k2=f(0.75,5.75) k3=-0.9401
k2=3e-0.75-0.4(5.75)
k2=-0.8829 1
Yi+1=yo+ 6 (k1+4k2+k3)h
k3=f(xo+h,yo-k1h+2k2h) 1
Yi+1=4.4493+ 6 (k1+4k2+k3)1.5
k3=f[0+1.5,5-(1)(1.5)+2(-0.8829)(1.5)]
k3=f(1.5,0.8513) yi+1=2.8063 ~ y(3)
FOURTH ORDER k3= f(0.75,4.3378)
k3=3e-0.75-0.4(4.3378)
1 k3=-0.318
yi+1=yo+ 6 (k1+2k2+2k3+k4)h
WHERE:
k1=f(xo,yo)
1 1
k2=f(xo+ 2 h,yo+ 2 k1h)
k4=f(xo+h,yo+k3h)
1 1
k3= f(xo+ 2 h,yo+ 2 k2h) k4=f[0+1.5,5+(-0.318)(1.5)]
k4=f(xo+h,yo+k3h) k4=f(1.5,4.523)
EXAMPLE k4=3e-1.5-0.4(4.523)
1
Find the value of y when x=3 k4=-1.1398yi+1=yo+ 6 (k1+2k2+2k3+k4)h
f(x,y)=3e-x-0.4y 1
The initial condition at x=0;y=5;h=1.5 yi+1=5+ 6 (k1+2k2+2k3+k4)1.5
yi+1=4.3646 ~ y(1.5)
SOLUTION
1st Iteration 2nd Iteration
k1=f(xo,yo) Xo=0+1.5=1.5 yo=4.3646
k1=f(0,5)
k1=3e-0-0.4(5) k1=f(1.5, 4.3646)
k1=1 k1=3e-1.5-0.4(4.3646)
k1=-1.0764
1 1
k2=f(xo+ 2 h,yo+ 2 k1h)
1 1
1 1 k2=f[1.5+ 2 (1.5), 4.3646+ 2 (-1.0764)1.5]
k2=f[0+ 2 (1.5),5+ 2 (1)(1.5)]
k2=f(2.25,3.5573)
k2=f(0.75,5.75) k2=3e-2.25-0.4(3.5573)
k2=3e-0.75-0.4(5.75) k2=-1.1067
k2=-0.8829
1 1
1 1 k3=f[1.5+ 2 (1.5), 4.3646+ 2 ¿-1.1067)1.5]
k3= f(xo+ 2 h,yo+ 2 k2h)
k3= f(2.25,3.5346)
1 1
k3=f[0+ 2 (1.5),5+ 2 (-0.8829)(1.5)] k3=3e-2.250.4(3.5346)
k3=-1.0976
k4=f[1.5+1.5, 4.3646+(-1.0976)1.5] 1 2
yi+1=yo+( 3 k1+ 3 k2)h
k4= f(3,2.7182)
1 2
k4=3e-3-0.4(2.7182) yi+1=5+[ 3 (1)+ 3 ¿-1.476)]1.5
k4=-0.9379
yi+1=4.024 ~y(1.5)
1
yi+1=4.3646+ 6 (k1+2k2+2k3+k4)1.5
yi+1=2.7589 ~ y(3)
SECOND ORDER
By RALSTON’s METHOD
1 2 2nd Iteration
yi+1=yo+( 3 k1+ 3 k2)h
Xo=0+1.5=1.5 yo=4.024
WHERE:
k1=f(xo,yo) k1=f(xo,yo)
3 3 k1=f(1.5,4.024)
k2=f(xo+ 4 h,yo+ 4 k1h) k1=3e-1.5-0.4(4.024)
k1=-0.9402
EXAMPLE
Find the value of y when x=3 3 3
k2=f(xo+ 4 h,yo+ 4 k1h)
f(x,y)=3e-x-0.4y
3 3
The initial condition at x=0;y=5;h=1.5 k2=f[1.5+ 4 (1.5), 4.024+ 4 (-0.9402)1.5]
k2= f(2.625,2.9663)
SOLUTION k2=3e-2.625-0.4(2.9663)
1st Iteration k2=-0.9692
k1=f(xo,yo)
k1=f(0,5) 1 2
k1=3e-0-0.4(5) yi+1=yo+( 3 k1+ 3 k2)h
k1=1 1 2
yi+1=4.024+[ 3 (-0.9402)+ 3 ¿-0.9692)]1.5
3 3 yi+1=2.5847 ~y(3)
k2=f(xo+ 4 h,yo+ 4 k1h)
3 3
k2=f[0+ 4 (1.5),5+ 4 (1)1.5]
k2= f(1.125,6.125)
k2=3e-1.125-0.4(6.125)
k2=-1.476
RUNGE KUTTA METHODS
THEORY
In numerical analysis, the Runge–Kutta methods are a family of implicit and
explicit iterative methods, which include the well-known routine called the
Euler Method, used in temporal discretization for the approximate solutions
of ordinary differential equations.Runge-Kutta methods are actually a general
class of algorithms, the fourth order method being the most popular.)
xn+1=xn+h
1
yn+1=yn+ 6 (k1+2k2+2k3+k4)h
WHERE:
k1=f(xn,yn)
1 1
k2=f(xn+ 2 h,yn+ 2 k1h)
1 1
k3= f(xn+ 2 h,yn+ 2 k2h)
k4=f(xn+h,yn+k3h)
SUBMITTED BY :
KENNETH B. BELMONTE
SUBMITTED TO:
ENGR.JOSELITO M. BUGAYONG