You are on page 1of 5

Libyan Academy Janzour

Petroleum and Chemical Engineering Department

Oil and Gas Division

Homework

Eular and runge kutta solution for ODE

By

Mohamed Abdel Qadder Shhayt

Registration number: - 21980709


Example (1):-
Solve ̀ ̀ on (0,2) with y(0) =1.with using Eular method .
Compare of result with exact solution (Ɛ-absolte, Ɛ-approximate ).use step
size h=(0.2 ,0.1 , 0.5) .

The solution

Exact solution : -

h=0.1 ( ) ( ) ( )

( )( )

( )

( )( )

tk h=0.5 h=0.2 h=0.1 exact


0 1 1 1 1
0.1 0.90000 0.90516
0.2 0.80000 0.81100 0.82127
0.3 0.73390 0.74918
0.4 0.64800 0.66951 0.68968
0.5 0.50000 0.61856 0.64347
0.6 0.55040 0.58170 0.61119
0.7 0.55950 0.59341
0.8 0.51232 0.55258 0.59067
0.9 0.56132 0.60343
1 0.37500 0.53786 0.58619 0.63212
1.1 0.62757 0.67713
1.2 0.63028 0.68581 0.73881
1.3 0.76123 0.81747
1.4 0.79223 0.85411 0.91340
1.5 0.86750 0.96470 1.02687
1.6 1.02578 1.09323 1.15810
1.7 1.23991 1.30732
1.8 1.33263 1.40491 1.47470
1.9 1.58842 1.66043
2 1.46875 1.71410 1.79058 1.86466
Ɛ- approximate Ɛ- absalote :-

tk Ɛ -approximate Ɛ-absalote

h=0.5 h=0.2 h=0.1 h=0.5 h=0.2 h=0.1


0 0 0 0 0 0 0
0.1 11.1111 0.57035
0.2 25 10.97411 2.58980 1.25041
0.3 10.50552 2.03980
0.4 23.45679 9.61748 6.04338 2.92454
0.5 100 8.23705 22.29622 3.87126
0.6 17.73256 8.33586 9.94593 4.82425
0.7 3.96229 5.70965
0.8 7.43285 1.25833 13.26475 6.44886
0.9 1.55740 6.97823
1 33.3333 4.74774 4.24229 40.67587 14.91243 7.26620
1.1 6.59385 7.31891
1.2 14.66461 8.49254 14.68870 7.17271
1.3 9.90745 6.87931
1.4 20.44147 10.87412 13.26639 6.49157
1.5 45.45455 11.46360 33.04896 6.05450
1.6 22.76842 11.75694 11.42568 5.60186
1.7 11.82971 5.15645
1.8 23.02548 11.74516 9.63418 4.73223
1.9 11.55287 4.33671
2 53.19149 22.25510 11.29006 21.23249 8.07459 3.97303
Example 2:-

Use Eular method to solve I.V.P ̀ . on [0,1] with y(0)=1.000 ,


compare the solution for h=0.1 and 0.01.

The solution

Analytical solution = ( )

Numerical solution :-

tk H =0.1 H =0.01 Exact solution

0 1 1 1

0.1 1 1.0090701 1.010101

0.2 1.02 1.0393923 1.041666

0.3 1.061616 1.0948602 1.098901

0.4 1.1292377 1.1835737 1.190476

0.5 1.2312519 1.3212162 1.333333

0.6 1.3828501 1.539549 1.5625

0.7 1.612323 1.9109101 1.960784

0.8 1.9762649 2.6381003 2.777778

0.9 2.6011646 4.563717 5.263157

1 3.819055 18.2987638
Example 3:-

Use RK4 method to solve I.V.P ̀ ( ) . on [ 0, 0.2]


with y(0)=0.1 , compare the solution for h = 0.1 and 0.2

The solution

1.analytical solution = y(t)= ( )

2. numercal solution by use RK4 :-

tk H= 0.1 H=0.2 Exact solution

0 0.1 0.1 0.1

0.1 0.1765902 0.176590

0.2 0.2302834 0.2302775 0.230283

You might also like