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

Question 1)

d) Introduce and present the approximation steps of the Explicit Euler and Explicit Runge–Kutta of order
4 algorithms to solve general first-order differential equations.

1.d.1. The explicit Euler method:

1.d.1.1. Introduction:

Differential equations are among the most important mathematical tools used in producing models of
physical and biological, sciences, and engineering. We consider numerical methods for solving ordinary
differential equations that have only one independent variable. The construction of numerical methods
for initial value problems as well as basic properties of such methods shall first be explained for the
simplest method: The explicit Euler method.

1.d.1.2. Approximation steps:

A general principle to derive numerical methods is to “discretize” constructions like derivatives, integrals,
etc.

Given an initial value problem:

ẏ (t)=f ( t , y ( t ) ) , y ( t 0 )= y 0

The operation which can not be evaluated numerically obviously is the limit h → 0, that defines the
y ( t +h ) − y ( t )
derivative: ẏ ( t ) =lim
h→0 h

y ( t +h ) − y ( t )
However, for any positive (small) h, the finite difference can easily be evaluated. By
h
definition, it is an approximation of the derivative ẏ (t) . Let us therefore approximate the differential
equation ẏ (t)=f ( t , y ( t ) ) by the difference equation

u(t+ h)−u(t )
=f ( t , u ( t ))
h

Given u at time t, one can compute u at the later time t + h, by solving the difference equation

u ( t+ h )=u ( t )+ hf ( t , u ( t ) )

This is exactly one step of the explicit Euler method. Introducing the notation t n+1=t n +h and un =u ( t n ) it
reads un +1=un +hf ( t n ,u n ) ,u0 = y 0 .

un is a first order approximation to the exact solution y ( t n )

Let us consider a sample equation:


ẋ=∝ x ,∝ ∈ R
{ x (t 0 )=x 0

1.d.2. The Runge-Kutta method:

1.d.2.1. Introduction:

We face many problems in science and engineering in terms of differential equations. A differential
equation is an equation involved in a relation between an unknown function and one or more its
derivatives. Equations involving its derivative of only one independent variable are called ordinary
differential equations. Fourth order boundary value problems occur in a number of areas of applied
mathematics among which are fluid mechanics, elasticity and quantum mechanics as well as science and
engineering. Only small class of differential equations can be solved by analytic methods. Hence, several
authors have investigated some numerical techniques for solving numerical value problems. A more
robust and intricate numerical technique is the Runge-Kutta method. This method is most widely used
one science it gives reliable starting and is particularly suitable when the computation of higher
derivatives is complicated.

The general forth order differential equation of the form:

y (4) = f (x, y, y’, y’’, y’’’).

1.d.2.2. Approximation steps:

We will use the following slope approximations to estimate the slope at some time t 0 (assuming we only
¿
have an approximation to y (t ¿¿ 0)¿ that is y (t¿¿ 0) .¿

k 1=f ¿

k 2=f ¿

k 3=f ¿

k 4=f ¿

Each of these slope estimates can be described verbally:

 k 1 is the slope at the beginning of the time step.


 If we use the slope k 1 to step halfway through the time step, then k 2 is an estimate of the slope at
the midpoint. This is the same as the slope, k 2, from the second order midpoint method.
 If we use the slope k 2 to step halfway through the time step, then k 3 is an estimate of the slope at
the midpoint.
 Finally, we use the slope, k 3, to step all the way across the time step (to t 0+ h), and k 4 is an
estimate of the slope at the endpoint.

We then use a weighted sum of these slopes to get our final estimate of y∗(t ¿¿ 0+h) ¿
k 1+ 2 k 2+ 2k 3+ k 4
y∗(t ¿¿ 0+h)= y∗(t ¿¿ 0)+ h¿¿
6

 We will estimate a solution of the different equation:


dy (t)
= y '(t )=−2 y (t) , with y ( 0)=3 ,t 0=0 . We choose h = 0.2
dt
 The first slope k 1 (and finding y 1):
k 1=−2 y (t 0 )=−2 y (0)=−6
h
The value of the function midway through the interval y
2
: ()
h 0.2
y 1= y (0)+ k 1 =3+(−6) =2.4
2 2

 The second slope k 2( ¿ finding y 2 ):


k 2=−2 y 1=−4.8
h h
This is an estimate of the slope at t = and we use it to find another estimate of y( ), which is
2 2
y 2:
h 0.2
y 2= y (0)+ k 2 =3+(−4.8) =2.52
2 2
 The third slope k 3( ¿ finding y 3 ):
k 3=−2 y 2=−5.04
h
This is an estimate of the slope at t = and we use it to find an estimate of the function at the end
2
of the interval y(h). We call this estimate y 3:
y 3= y (0)+ k 3 h=1.992

 The fourth slope k 4 :


k 4=−2 y 3=−3.984
 The final slope (a weighted average of previous slopes) and finding y*( t 0+ h)
1 1 1 1 1 1 1 1
m= k 1 + k 2 + k 3+ k 4 = (−6)+ (−4.8)+ (−5.04)+ (−3.984)=−4.944
6 3 3 6 6 3 3 6
Our final estimate:
1 1 1 1
y∗(h)= y ( 0)+( k 1+ k 2 + k 3 + k 4 ) h= y (0)+m . h=3+(−4.944 )0.2=2.0112
6 3 3 6

Question 1)
e) Using Explicit Euler and Explicit Runge–Kutta, give approximate values of the exact solutions
of the above examples at time t0, t0 + h, t0 + 2h, ..., t0 + 5h with optional h:

Example 1: Solve the First Order Differential Equations:


dy
=10 x
dx

y ( 0 )=3

Solve by Explicit Euler method:

Choose h = 0.1, applying Euler method:

y ( x+ h ) ≈ y ( x )+ h y ' ( x , y ( x ) )

We have approximate values of the exact solutions at time:

 x 0=t 0=0 : y (t 0) = y (0) = 3


 t 1=t 0+ h=0.1: y (t 0+ h) ≈ y (t 0)+ h y '( t 0 )=3+0.1( 10× 0)=3
 t 2=t 1+ h=0.2: y (t 0+ 2h ) ≈ y (t 1)+h y '(t 1)=3+0.1(10 ×0.1)=3.1
 t 3=t 2+ h=0.3 : y (t 0+ 3 h) ≈ y (t 2)+h y '(t 2)=3.1+0.1(10 ×0.2)=3.3
 t 4=t 3 +h=0.4 : y (t 0+ 4 h) ≈ y (t 3)+h y '(t 3 )=3.3+0.1(10 × 0.3)=3.6
 t 5=t 4 +h=0.5: y (t 0+ 5 h) ≈ y (t 4 )+h y ' (t 4 )=3.6+0.1(10 × 0.4)=4

Solve by Explicit order-4 Runge-Kutta method:

Choose h = 0.1, we calculate approximate values of the exact solution at time:

 x 0=t 0=0 : y (t 0) = y (0) = 3


 t 1=t 0+ h=0.1:
The first slope: k 1= y ' ( t 0 , y ( t 0 ) ) = y ' ( 0 , 3 ) =10× 0=0
h h
The second slope: ( 2 )
k 2= y ' t 0 + , y ( t 0 ) + k 1 = y ' ( 0.05 ,3 )=10 ×0.05=0.5
2
h h
k = y ( t + , y ( t ) + k )= y ( 0.05 , 3.025 )=10 ×0.05=0.5
' '
The third slope: 3 0 0 2
2 2
The fourth slope: k 4= y ' ( t 0+ h , y ( t 0 ) +h k 3) = y ' ( 0.1, 3.05 )=10× 0.1=1
Approximate value:

h 0.1
y (t 1)= y (t 0 + h)= y (t 0)+ ( k 1+ 2 k 2+ 2 k 3+ k 4 )=3+ ( 0+ 2× 0.5+2× 0.5+1 )=3.05
6 6

 t 2=t 1+ h=0.2:
The first slope: k 1= y ' ( t 1 , y ( t 1 ) )= y ' ( 0.1 ,3.05 )=10 ×0.1=1
h h
The second slope: ( 2 )
k 2= y ' t 1 + , y ( t 1) + k 1 = y ' ( 0.15 , 3.1 )=10 × 0.15=1.5
2
h h
k = y ( t + , y ( t )+ k )= y ( 0.15 ,3.025 ) =10× 0.15=1.5
' '
The third slope: 3 1 1 2
2 2
The fourth slope: k 4= y ' ( t 1+ h , y ( t 1 )+ h k 3 ) = y ' ( 0.2 , 3.2 )=10 ×0.2=2
Approximate value:
h 0.1
y (t 2)= y (t 0+2 h)= y (t 1 )+ ( k 1 +2 k 2 +2 k 3 +k 4 ) =3.05+ ( 1+ 2×1.5+ 2× 1.5+2 )=3.2
6 6
 t 3=t 2+ h=0.3 :
The first slope: k 1= y ' ( t 2 , y ( t 2 ) )= y ' ( 0.2 ,3.2 )=10 ×0.2=2
h h
The second slope: ( 2 )
k 2= y ' t 2 + , y ( t 2 )+ k 1 = y ' ( 0.25 ,3.3 ) =10× 0.25=2.5
2
h h
k = y ( t + , y ( t ) + k )= y ( 0.25 ,3.325 ) =10× 0.25=2.5
' '
The third slope: 3 2 2 2
2 2
The fourth slope: k 4= y ' ( t 2+ h , y ( t 2 ) +h k 3 ) = y ' ( 0.3 , 3.45 )=10 × 0.3=3
Approximate value:
h 0.1
y (t 3)= y (t 0+3 h)= y (t 2 )+ ( k 1+2 k 2+2 k 3 + k 4 ) =3.2+ ( 2+2× 2.5+2× 2.5+3 ) =3.45
6 6
 t 4=t 3 +h=0.4 :
The first slope: k 1= y ' ( t 3 , y ( t 3 ) ) = y ' ( 0.3 , 3.45 )=10 × 0.3=3
h h
The second slope: ( 2 )
k 2= y ' t 3 + , y ( t 3 ) + k 1 = y ' ( 0.35 ,3.6 )=10 ×0.35=3.5
2
h h
k = y ( t + , y ( t ) + k )= y ( 0.35 ,3.625 )=10 ×0.35=3.5
' '
The third slope: 3 3 3 2
2 2
The fourth slope: k 4= y ' ( t 3+ h , y ( t 3 ) +h k 3 ) = y ' ( 0.4 ,3.8 )=10 ×0.4=4
Approximate value:
h 0.1
y (t 4 )= y (t 0 +4 h)= y (t 3)+ ( k 1 +2 k 2 +2 k 3 +k 4 )=3.45+ ( 3+ 2×3.5+ 2× 3.5+4 )=3.8
6 6
 t 5=t 4 +h=0.5:
The first slope: k 1= y ' ( t 4 , y ( t 4 ) ) = y ' ( 0.4 ,3.8 ) =10× 0.4=4
h h
The second slope: ( 2 )
k 2= y ' t 4 + , y ( t 4 ) + k 1 = y ' ( 0.45 , 4 ) =10× 0.45=4.5
2
h h
k = y ( t + , y ( t ) + k )= y ( 0.45 , 4.025 )=10 × 0.45=4.5
' '
The third slope: 3 4 4 2
2 2
The fourth slope: k 4= y ' ( t 4 +h , y ( t 4 ) +h k 3 ) = y ' ( 0.5 , 4.25 )=10 ×0.5=5
Approximate value:
h 0.1
y (t 5)= y (t 0+5 h)= y (t 4)+ ( k 1 +2 k 2 +2 k 3 +k 4 )=3.8+ ( 4+ 2× 4.5+2 × 4.5+ 5 )=4.25
6 6

Example 2: Solve the First Order Differential Equations:

dy 3 x 2
=
dx 2 y

y ( 2 )=3

Solve by Explicit Euler method:

Choose h = 0.01, applying Euler method:

y ( x+ h ) ≈ y ( x )+ h y ' ( x , y ( x ) )

We have approximate values of the exact solutions at time:

 x 0=t 0=2: y (t 0) = y (2) = 3


3 ×(2)2
 t 1=t 0+ h=2.01: y (t 0+ h) ≈ y (t 0)+ h y '( t 0 , y (t 0 ))=3+0.01 ( )
2 ×3
=3.02

3 ×(2.01)2
 t 2=t 1+ h=2.02:
(
y (t 0+ 2h ) ≈ y (t 1)+h y '(t 1 , y (t 1))=3.02+0.01
2 ×3.02 ) ≈ 3.04
2
3 ×( 2.02)
y (t + 3 h) ≈ y (t )+h y '(t , y (t ))=3.04 +0.01 (
2× 3.04 )
 t 3=t 2+ h=2.03 : 0 2 2 2 ≈ 3.053
2
3 ×(2.03)
y (t + 4 h) ≈ y (t )+h y '(t , y (t ))=3.053+0.01 (
2× 3.053 )
 t 4=t 3 +h=2.04 : 0 3 3 3 ≈ 3.073
2
3 ×(2.04)
y (t + 5 h) ≈ y (t )+h y ' (t , y( t ))=3.073+0.01 (
2×3.073 )
 t 5=t 4 +h=2.05: 0 4 4 4 ≈ 3.093

Solve by Explicit order-4 Runge-Kutta method:

Choose h = 0.01, we calculate approximate values of the exact solution at time:

 x 0=t 0=2: y (t 0) = y (2) = 3


 t 1=t 0+ h=2.01:
2
' ' 3 ×2
The first slope: k 1= y ( t 0 , y ( t 0 ) ) = y ( 2 , 3 ) = =2
2 ×3
h h 3 ×2.005 2
The second slope: ( 2 )
k 2= y ' t 0 + , y ( t 0 ) + k 1 = y ' ( 2.005 ,3.01 ) =
2 2× 3.01
≈ 2.003
2
h h 3 × 2.005
k = y ( t + , y ( t ) + k )= y ( 2.005 ,3.01 ) =
' '
The third slope: 3 0 0 2 ≈ 2.003
2 2 2 ×3.01
2
' ' 3 ×2.01
The fourth slope: k 4= y ( t 0+ h , y ( t 0 ) +h k 3) = y ( 2.01, 3.02 )= ≈ 2.007
2 ×3.02
Approximate value:

h 0.01
y (t 1)= y (t 0 + h)= y (t 0)+ ( k 1+ 2 k 2+ 2 k 3+ k 4 )=3+ ( 2+2 ×2.003+2 ×2.003+2.007 ) ≈ 3.02
6 6

 t 2=t 1+ h=2.02:
2
' ' 3 ×2.01
The first slope: k 1= y ( t 1 , y ( t 1 ) )= y ( 2.01 ,3.02 )= ≈ 2.007
2× 3.02
h h 3 ×2.0152
The second slope: ( 2 )
k 2= y ' t 1 + , y ( t 1) + k 1 = y ' ( 2.015 , 3.03 )=
2 2× 3.03
≈ 2.01
2
h h 3 ×2.015
k = y ( t + , y ( t )+ k )= y (2.015 , 3.03 )=
' '
The third slope: 3 1 1 2 ≈2.01
2 2 2× 3.03
2
' ' 3 ×2.02
The fourth slope: k 4= y ( t 1+ h , y ( t 1 )+ h k 3 ) = y ( 2.02 , 3.04 )= ≈ 2.013
2 ×3.04
Approximate value:
h 0.01
y (t 2)= y (t 0+2 h)= y (t 1 )+ ( k 1 +2 k 2 +2 k 3 +k 4 ) =3.02+ ( 2.007+ 2× 2.01+ 2× 2.01+ 2.013 ) ≈ 3.04
6 6
 t 3=t 2+ h=2.03 :
2
' ' 3 ×2.02
The first slope: k 1= y ( t 2 , y ( t 2 ) )= y ( 2.02 ,3.04 )= ≈ 2.013
2 ×3.04
h h 3 ×2.0252
The second slope:
'
( 2 2 ) '
k 2= y t 2 + , y ( t 2 )+ k 1 = y 2.025 , 3.05 =
( )
2× 3.05
≈2.017

h h 3 ×2.025 2
The third slope: ( 2 2 )
k 3= y ' t 2 + , y ( t 2 ) + k 2 = y ' ( 2.025, 3.05 ) =
2× 3.05
≈ 2.017

' ' 3 ×2.032


The fourth slope: k 4= y ( t 2+ h , y ( t 2 ) +h k 3 ) = y ( 2.03 , 3.06 )= ≈2.02
2× 3.06
Approximate value:
h 0.01
y (t 3)= y (t 0+3 h)= y (t 2 )+ ( k 1+2 k 2+2 k 3 + k 4 ) =3.04+ ( 2.013+2 ×2.017+ 2× 2.017+2.02 ) ≈ 3.06
6 6
 t 4=t 3 +h=2.04 :
2
' ' 3 ×2.03
The first slope: k 1= y ( t 3 , y ( t 3 ) ) = y ( 2.03 , 3.06 )= ≈ 2.02
2 ×3.06
h h 3 × 2.0352
The second slope: ( 2 2)
k 2= y ' t 3 + , y ( t 3 ) + k 1 = y ' ( 2.035 ,3.07 )=
2× 3.07
≈ 2.023
h h 3× 2.0352
The third slope:
2 ( 2 )
k 3= y ' t 3 + , y ( t 3 ) + k 2 = y ' ( 2.035 ,3.07 )=
2 ×3.07
≈ 2.023
2
' ' 3 × 2.04
The fourth slope: k 4= y ( t 3+ h , y ( t 3 ) +h k 3 ) = y ( 2.04 ,3.08 )= ≈ 2.027
2 ×3.08
Approximate value:
h 0.01
y (t 4 )= y (t 0 +4 h)= y (t 3)+ ( k 1 +2 k 2 +2 k 3 +k 4 )=3.06+ (2.02+2 ×2.023+ 2× 2.023+ 2.027 ) ≈3.08
6 6
 t 5=t 4 +h=2.05:
2
' ' 3 ×2.04
The first slope: k 1= y ( t 4 , y ( t 4 ) ) = y ( 2.04 , 3.08 )= ≈ 2.027
2× 3.08
h h 3 ×2.045 2
The second slope: (
'
2 ) 2
'
k 2= y t 4 + , y ( t 4 ) + k 1 = y 2.045, 3.09 =
( )
2× 3.09
≈ 2.03
2
h h 3 × 2.045
k = y ( t + , y ( t ) + k )= y ( 2.045 ,3.09 ) =
' '
The third slope: 3 4 4 2 ≈ 2.03
2 2 2× 3.09
2
' ' 3 ×2.05
The fourth slope: k 4= y ( t 4 +h , y ( t 4 ) +h k 3 ) = y ( 2.05 , 3.1 )= ≈ 2.033
2×3.1
Approximate value:
h 0.01
y (t 5)= y (t 0+5 h)= y (t 4)+ ( k 1 +2 k 2 +2 k 3 +k 4 )=3.08+ (2.027 +2× 2.03+2× 2.03+2.033 ) ≈ 3.1
6 6

Example 3: Solve the First Order Differential Equations:


dy
=2 x (25− y )
dx

y ( e )=30

Solve by Explicit Euler method:

Choose h = 0.1, applying Euler method:

y ( x+ h ) ≈ y ( x )+ h y ' ( x , y ( x ) )

We have approximate values of the exact solutions at time:

 x 0=t 0=e : y (t 0) = y (e) = 30


 t 1=t 0+ h=e+0.1: y (t 0+ h) ≈ y (t 0)+ h y '( t 0 , y (t 0 ))=30+0.1 ( 2 ×e × ( 25−30 ) ) ≈ 27.2817
 t 2=t 1+ h=e +0.2: y (t 0+ 2h )
≈ y (t 1)+h y '(t 1 , y (t 1))=27.2817+ 0.1 ( 2× ( e+0.1 ) × ( 25−27.2817 ) ) ≈ 25.9956
 t 3=t 2+ h=e+0.3: y (t 0+ 3 h)
≈ y (t 2)+h y '(t 2 , y (t 2 ))=25.9956+0.1 ( 2× ( e+ 0.2 ) × (25−25.9956 ) ) ≈ 25.4145
 t 4=t 3 +h=e+ 0.4: y (t 0+ 4 h)
≈ y (t 3)+h y ' (t 3 , y (t 3 ))=25.4145+0.1 ( 2× ( e+ 0.3 ) × ( 25−25.4145 )) ≈ 25.1643
 t 5=t 4 +h=e+ 0.5: y (t 0+ 5 h)
≈ y (t 4 )+h y ' (t 4 , y( t 4))=25.1643+0.1 ( 2 × ( e +0.4 ) × ( 25−25.1643 ) ) ≈ 25.0618

Solve by Explicit order-4 Runge-Kutta method:

Choose h = 0.1, we calculate approximate values of the exact solution at time:

 x 0=t 0=e : y (t 0) = y (e) = 30


 t 1=t 0+ h=e+0.1:
The first slope: k 1= y ' ( t 0 , y ( t 0 ) ) = y ' ( e ,30 )=2 ×e ×(25−30)≈−27.183
The second slope:
h h
( )
k 2= y ' t 0 + , y ( t 0 ) + k 1 = y ' ( e+ 0.05 ,28.64 )=2 × ( e +0.05 ) ×(25−28.64)≈−20.153
2 2
The third slope:
h h
( )
k 3= y ' t 0 + , y ( t 0 ) + k 2 = y ' ( e+ 0.05 ,28.992 ) =2× ( e+ 0.05 ) ×(25−28.992)≈−22.102
2 2
The fourth slope:
k 4= y ' ( t 0+ h , y ( t 0 ) +h k 3) = y ' ( e+0.1 , 27.79 )=2 × ( e+0.1 ) ×(25−27.79)≈−15.726
Approximate value:

h 0.1
y (t 1)= y (t 0 + h)= y (t 0)+ ( k 1+ 2 k 2+ 2 k 3+ k 4 )=30+ (−27.183+ 2×−( 20.153 )+2 × (−22.102 )−15.726 ) ≈ 27.876
6 6

 t 2=t 1+ h=e +0.2:


The first slope:
k 1= y ' ( t 1 , y ( t 1 ) )= y ' ( e+ 0.1 ,27.876 )=2× ( e+ 0.1 ) ×(25−27.876)≈−16.211
The second slope:
h h
( )
k 2= y ' t 1 + , y ( t 1) + k 1 = y ' ( e+0.15 , 27.065 )=2 × ( e+0.15 ) ×(25−27.065)≈−11.846
2 2
The third slope:
h h
( )
k 3= y ' t 1 + , y ( t 1 )+ k 2 = y ' ( e+0.15 , 27.284 )=2× ( e+ 0.15 ) ×(25−27.284)≈−13.102
2 2
The fourth slope:
k 4= y ' ( t 1+ h , y ( t 1 )+ h k 3 ) = y ' ( e +0.2 , 26.566 )=2 × ( e +0.2 ) ×( 25−26.566) ≈−9.14
Approximate value:
h
y ( t 2) = y ( t 0 +2 h ) = y ( t 1 ) + ( k 1 +2 k 2 +2 k 3 +k 4 )
6
0.1
¿ 27.876+ (−16.211+ 2× (−11.846 ) +2 × (−13.102 ) −9.14 ) ≈ 26.622
6
 t 3=t 2+ h=e+0.3:
The first slope:
k 1= y ' ( t 2 , y ( t 2 ) )= y ' ( e+ 0.2 ,26.622 ) =2× ( e+ 0.2 ) ×(25−26.622) ≈−9.467
The second slope:
h h
( )
k 2= y ' t 2 + , y ( t 2 )+ k 1 = y ' ( e+0.25 , 26.149 )=2 × ( e+0.25 ) ×(25−26.149) ≈−6.821
2 2
The third slope:
h h
( )
k 3= y ' t 2 + , y ( t 2 ) + k 2 = y ' ( e+0.25 , 26.28 ) =2× ( e+ 0.25 ) ×(25−26.28)≈−7.599
2 2
The fourth slope:
k 4= y ' ( t 2+ h , y ( t 2 ) +h k 3 ) = y ' ( e +0.3 , 25.862 )=2 × ( e +0.3 ) ×(25−25.862)≈−5.204

Approximate value:
h
y ( t 3 ) = y ( t 0 +3 h )= y ( t 2 )+ ( k 1 +2 k 2 +2 k 3 + k 4 )
6
0.1
¿ 26.622+ (−9.467+ 2× (−6.821 )+ 2× (−7.599 )−5.204 ) ≈ 25.897
6

 t 4=t 3 +h=e+ 0.4 :


The first slope:
k 1= y ' ( t 3 , y ( t 3 ) ) = y ' ( e +0.3 , 25.897 )=2 × ( e+0.3 ) ×(25−25.897) ≈−5.415

The second slope:


h h
( )
k 2= y ' t 3 + , y ( t 3 ) + k 1 = y ' ( e+ 0.35, 25.626 ) =2× ( e+ 0.35 ) ×(25−25.626)≈−3.841
2 2
The third slope:
h h
( )
k 3= y ' t 3 + , y ( t 3 ) + k 2 = y ' ( e+ 0.35 ,25.705 ) =2× ( e+ 0.35 ) × ( 25−25.705 ) ≈−4.326
2 2
The fourth slope:
k 4= y ' ( t 3+ h , y ( t 3 ) +h k 3 ) = y ' ( e+0.4 ,25.464 )=2 × ( e +0.4 ) × ( 25−25.464 ) ≈−2.894
Approximate value:
h 0.1
y (t 4 )= y (t 0 +4 h)= y (t 3)+ ( k 1 +2 k 2 +2 k 3 +k 4 )=25.897+ (−5.415+2× (−3.841 ) +2× (−4.326 )−2.894
6 6

 t 5=t 4 +h=e+ 0.5:


The first slope:
k 1= y ' ( t 4 , y ( t 4 ) ) = y ' ( e +0.4 , 25.486 ) =2× ( e+ 0.4 ) ×( 25−25.486)≈−3.031
The second slope:
h h
( )
k 2= y ' t 4 + , y ( t 4 ) + k 1 = y ' ( e+0.45 , 25.334 )=2 × ( e +0.45 ) × ( 25−25.334 ) ≈−2.116
2 2
The third slope:
h h
( )
k 3= y ' t 4 + , y ( t 4 ) + k 2 = y ' ( e+ 0.45 ,25.38 ) =2× ( e+ 0.45 ) × ( 25−25.38 ) ≈−2.408
2 2
The fourth slope:
k 4= y ' ( t 4 +h , y ( t 4 ) +h k 3 ) = y ' ( e+0.5 , 25.245 )=2 × ( e+0.5 ) × (25−25.245 ) ≈−1.577
Approximate value:
h 0.1
y (t 5)= y (t 0+5 h)= y (t 4)+ ( k 1 +2 k 2 +2 k 3 +k 4 )=25.486+ (−3.031+2× (−2.116 )+ 2× (−2.408 )−1.577 )
6 6

You might also like