Assignment 9
Assignment 9
Assignment 9
Assignment 9
Numerical Solution of ODE’s
1. Solve using Euler, Heun and the fourth order Runge Kutta formula the initial value
problem: 𝒚′ = 𝒙𝒚 + 𝒙𝟐 , with 𝒚(𝟎) = 𝟏, for 𝒙 = 𝟎. 𝟏
2. Use Runge-Kutta formula to solve the differential equation:
𝒚′′ + 𝒚 = 𝒙 at 𝒙 = 𝟏. 𝟐 with the initial values: 𝒚(𝟏) = 𝟏. 𝟖𝟒 and
𝒚′ (𝟏) = 𝟏. 𝟓𝟒. If the exact solution is: 𝒚 = 𝒙 + 𝐬𝐢𝐧 𝒙, estimate the percentage of
true error in your result.
3. Use Runge Kutta of the fourth order to solve the following system of differential
equations at x = 0.1:
𝒅𝒚
= −𝟐𝒚 + 𝟓𝒛𝒆−𝒙
𝒅𝒙
𝒅𝒛 𝒚𝒛𝟐
=−
𝒅𝒙 𝟐
33 21 39 21 33
Predictor: y n +1 = y n −5 + h fn − f n −1 + f n−2 − f n −3 + f n−4
10 5 5 5 10
14 64 24 64 14
Corrector: y n +1 = y n −3 + h f n −3 + f n−2 + f n −1 + fn + f n +1
45 45 45 45 45
6. a) Use R-K method to get y(0.1) for ODE y = y sin( 2 xy) with y (0) = 1
b) Use (a) and the following formula of P-C method to get y (0.2)
1 5 3 251 4
Predictor: y1 = y0 + h f 0 + f 0 + 2 f 0 + 3 f 0 + f 0 + ...
2 12 8 720
1 1 1 19 4
Corrector: y1 = y0 + h f1 − f1 − 2 f1 − 3 f1 − f1 + .....
2 12 24 720
Perform only 2 iterations.
9. Using Runge-Kutta fourth order method to find y (0.2) & y (0.2) for the ODE
2 y + 4 y − 2 xy = 6 with y (0) = 1 & y (0) = −1.
10. Use Runge-Kutta fourth order method to find y (1.1) & z (1.1) for the following
system of ODE's y + 2 x − z = y & cos x − 3z = zy with y (1) = 1.2 & z (1) = −0.3
11. Use R-K fourth order method to solve the following ODE
y ( x) + xy( x) + (1 − x) y ( x) = cos xy with y (0.5) = y (0.5) = 2 at x = 0.7 & 0.9.
yi(+c1) = yi +
h
(9 f i+1 + 19 f i − 5 f i−1 + f i−2 )
24
13. Use Range-Kutta fourth order to find y (0.2) for ODE 3x − y + xy = 0
with y (0) = 1 , then use the following P-C method to find y (0.4) with one correction.
h 3h
yi(+P1) = yi + ( f i−1 + 3 f i ) yi(+C1) = yi + (5 f i+1 + 3 f i − f i−1 )
4 7
14. Write the steps to find y (0.5) & z (0.5) for the system
y = f ( x, y, z ) & z = g ( x, y, z ) with initial y (0) = 1 & z (0) = 3 (h = 0.1)
Using R-K method and P-C method, stop after two corrections.
* the formula of P-C method
4h 28h 5 (5)
y P
i +1 = y i −3 + [2 f i − 2 − f i −1 + 2 f i ] + y ( )
3 90
h h 5 ( 5)
y iC+1 = y i −1 + [ f i −1 + 4 f i + f i +1 ] − y ( ) ]
3 90
15. Consider the differential equation: y = x + y, whose initial values are:
y(0) = 0, y(0.1) = 0.214 and y(0.2) = 0.0918.
Find by using the given set of predictor – corrector formula, y(0.3). Put your answer in a
h
table: y n( +p1) = y n + (55 f n − 59 f n−1 + 37 f n−2 )
24
h
y n( c+)1 = yn + (9 f n+1 + 19 f n − 5 f n−1 + f n−2 )
24
16. Using Heun's method with two correction to find y (0.2) & y (0.2) for the ODE
y + 5 xy − cos xy = 0 with y (0.1) = 1 & y (0.1) = −1. Find your relative error.
19. Use Heun’s method to approximate the solution of the second order differential
equation: 𝒙𝟐 𝒚′′ − 𝟐𝒙𝒚′ + 𝟐𝒚 = 𝒙𝟑 𝐥𝐧 𝒙 , at 𝒙 = 𝟏. 𝟏, with initial conditions
𝒚(𝟏) = 𝟏 and 𝒚′ (𝟏) = 𝟎. (Perform only 2 iterations). Then find 𝒚(𝟏. 𝟐) using
Runge Kutta’s method.
Calculate the percentage of relative true error in both cases if the exact solution
𝟕 𝟏 𝟑
is 𝒚 = 𝟒 𝒙 + 𝟐 𝒙𝟑 𝐥𝐧 𝒙 − 𝟒 𝒙𝟑
20. Use Heun’s method to approximate the solution of the second order differential
equation: 𝒚′′ − 𝟐𝒚′ + 𝒚 = 𝒙𝒆𝒙 − 𝒙 , at 𝒙 = 𝟎. 𝟏, with initial conditions are
𝒚(𝟎) = 𝒚′ (𝟏) = 𝟎. (Perform only 2 iterations).
Then find 𝒚(𝟎. 𝟐) using Adams-Moulton predictor corrector set
𝒉
𝒚𝒏+𝟏 𝑷 = 𝒚𝒏 + (𝟑𝒇𝒏 − 𝒇𝒏−𝟏 )
𝟐
𝒉
𝒚𝒏+𝟏 𝑪 = 𝒚𝒏 + (𝟓𝒇𝒏+𝟏 + 𝟖𝒇𝒏 − 𝒇𝒏−𝟏 )
𝟏𝟐
Calculate the percentage of relative true error in both cases if the exact solution
𝟏
is 𝒚 = 𝟔 𝒙𝟑 𝒆𝒙 − 𝒙𝒆𝒙 + 𝟐𝒆𝒙 − 𝒙 − 𝟐
21. Given the predictor corrector pairs below, write the steps required for evaluating
𝒚(𝟎. 𝟓) for the differential equation: 𝒚′′ + 𝟓𝒙𝟐 𝒚′ + 𝒙𝒚 = 𝐜𝐨𝐬 𝒙𝟐 .
The initial conditions are : (𝟎, 𝒂), (𝟎, 𝒃), (𝟎, 𝒄) and (𝟎, 𝒅).
Use correction formula 3 times.
𝟒𝒉
𝒚𝒏+𝟏 𝑷 = 𝒚𝒏−𝟑 + (𝟐𝒇𝒏 − 𝒇𝒏−𝟏 + 𝟐𝒇𝒏−𝟐 )
𝟑
𝒉
𝒚𝒏+𝟏 𝑪 = 𝒚𝒏−𝟏 + (𝒇𝒏+𝟏 + 𝟒𝒇𝒏 + 𝒇𝒏−𝟏 )
𝟑
22. Use Heun’s method (Modified Euler) to approximate the solution of the
second order differential equation: 𝒙𝟐 𝒚′′ − 𝟐. 𝟓𝒙𝒚′ − 𝟐𝒚 = 𝟎 , at 𝒙 =
𝟏. 𝟐where, the initial conditions are: 𝒚(𝟏) = 𝟑 and 𝒚′(𝟏) = 𝟕. 𝟓 . Calculate
𝟏
the percentage of relative true error if the exact solution is: 𝒚 = + 𝟐𝒙𝟒
√𝒙
23. Use The given predictor-corrector pair to approximate the solution of the
𝒅𝒚 −𝟐𝒚
first order differential equation: 𝒅𝒙 = 𝟏+𝒙 , at 𝒙 = 𝟐 .
𝒉
Predictor: 𝒚𝒊+𝟏 = 𝒚𝒊 + (𝟓𝟓𝒇𝒊 − 𝟓𝟗𝒇𝒊−𝟏 + 𝟑𝟕𝒇𝒊−𝟐 − 𝟗𝒇𝒊−𝟑 )
𝟐𝟒
𝒉
Corrector: 𝒚𝒊+𝟏 = 𝒚𝒊 + 𝟐𝟒 (𝟗𝒇𝒊+𝟏 + 𝟏𝟗𝒇𝒊 − 𝟓𝒇𝒊−𝟏 + 𝒇𝒊−𝟐 )