Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

Solving Ordinary

Differential Equation
by Heun’s Method
PREPARED BY: JAYSON CORTEL
Heun’s Method

 This is a technique in solving the approximate the solution of an


ordinary differential equation.

 This method is also a form of numerical integration, wherein an initial


point on the curve is known but the shape of the curve is still to be
found.

 A modification of Euler’s Method with improvements done for the


estimate of the slope.
Heun’s Method
Heun’s Method Procedure:
 Set the initial point on the curve.
 Compute for the slope in the initial point:
 Compute for the predictor:
 Compute the end slope:
, ,
 Solve for the Average Slope:
 Solve for the Approximate Point:
, ,
Heun’s Method
Sample Problem:
Solve the following initial value problem over the interval from t = 0 to 2, where y(0) = 1.

Solution:
To get a comparison of the approximate value using Euler’s Method and the actual
method, the above equation is solved analytically;
.
Heun’s Method
Solution:
Trials x yactual
Actual Solution:
0 0 1
. 1 0.2 0.741114607

Step size (x): 2 0.4 0.552335294

3 0.6 0.419958241

4 0.8 0.333670934
For the Heun’s Method, 5 1 0.286504797

6 1.2 0.277592796

1st compute the slope: 7 1.4 0.319946975

, Where, 8 1.6 0.466918759

9 1.8 0.927187007

10 2 2.718281828
Heun’s Method
Solution:

2nd compute the predictor: 5th compute the Approximate Point:


, ,

3rd compute the end slope: Error (%):


.

4th compute the average slope:


, , . ( . )
Heun’s Method
Heun’s Method
Trial 2:
1st compute the slope:
𝑓 𝑥 , 𝑦 = 𝑦𝑥 − 1.5𝑦 = 0.745 0.2 − 1.5 0.745 = −1.11
2nd compute the predictor:
𝑦 = 𝑦 + 𝑓 𝑥 , 𝑦 ℎ = 0.745 + −1.11 0.2 = 0.52
3rd compute the end slope:
𝑦 = 𝑓 𝑥 ,𝑦 = 0.52 0.2 − 1.5 0.52 = −0.78
4th compute the average slope:
, , . ( . )
𝑦 = = = −0.945

5th compute the Approximate Point:


, ,
𝑦 =𝑦 + ℎ

𝑦 = 0.745 + −0.945 0.2 = 0.556


Error (%):
. .
𝐸𝑟𝑟𝑜𝑟 = 𝑥100 = 25%
.
Heun’s Method
Trial 3:
1st compute the slope:
𝑓 𝑥 , 𝑦 = 𝑦𝑥 − 1.5𝑦 = 0.556 0.4 − 1.5 0.556 = −0.80
2nd compute the predictor:
𝑦 = 𝑦 + 𝑓 𝑥 , 𝑦 ℎ = 0.556 + −0.8 0.2 = 0.40
3rd compute the end slope:
𝑦 = 𝑓 𝑥 ,𝑦 = 0.40 0.4 − 1.5 0.40 = −0.57
4th compute the average slope:
, , . ( . )
𝑦 = = = −0.68

5th compute the Approximate Point:


, ,
𝑦 =𝑦 + ℎ

𝑦 = 0.556 + −0.68 0.2 = 0.42


Error (%):
. .
𝐸𝑟𝑟𝑜𝑟 = 𝑥100 = 24.11%
.
Heun’s Method
Heun’s Method
4

3.5

2.5

2
y

1.5

0.5

0
0 0.5 1 1.5 2 2.5
x

yactual Heun's Method

You might also like