Professional Documents
Culture Documents
T, y (T), y T y 0 y (T+H) y (T) H y (T+H) y (T) H T, y (T) U (T+H) U (T) H F T, U (T)
T, y (T), y T y 0 y (T+H) y (T) H y (T+H) y (T) H T, y (T) U (T+H) U (T) H F T, U (T)
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.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.
A general principle to derive numerical methods is to “discretize” constructions like derivatives, integrals,
etc.
ẏ (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 .
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.
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 ¿
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
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:
y ( 0 )=3
y ( x+ h ) ≈ y ( x )+ h y ' ( x , y ( x ) )
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
dy 3 x 2
=
dx 2 y
y ( 2 )=3
y ( x+ h ) ≈ y ( x )+ h y ' ( x , y ( x ) )
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
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
y ( e )=30
y ( x+ h ) ≈ y ( x )+ h y ' ( x , y ( x ) )
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
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