0% found this document useful (0 votes)
26 views7 pages

Numerical Solution of ODE

The document discusses the numerical solution of ordinary differential equations (ODEs), emphasizing their significance in engineering and applied mathematics for modeling various physical systems. It outlines methods for solving ODEs, including analytical and numerical approaches, with a focus on the Runge-Kutta method and its application to first and second-order equations. Additionally, it provides examples and assignments for practical understanding of the concepts presented.

Uploaded by

Mariel Banuno
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views7 pages

Numerical Solution of ODE

The document discusses the numerical solution of ordinary differential equations (ODEs), emphasizing their significance in engineering and applied mathematics for modeling various physical systems. It outlines methods for solving ODEs, including analytical and numerical approaches, with a focus on the Runge-Kutta method and its application to first and second-order equations. Additionally, it provides examples and assignments for practical understanding of the concepts presented.

Uploaded by

Mariel Banuno
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

NUMERICAL SOLUTION OF O.D.

Introduction
In engineering, the subject of ordinary differential equations (ODE) not only is one of the
most beautiful parts of mathematics, but it is also an essential tool for modeling many physical
situations: spring-mass systems, resistor-capacitor-inductance circuits, bending of beams,
chemical reactions, pendulums, the motion of a rotating mass around another body, and so forth.

The importance of ordinary differential equations in applied mathematics is due to the


fact that most scientific laws are more readily expressed in terms of rates of change.

Numerical methods have no such limitations to only standard forms. We obtain the
solution as a tabulation of the values of the function at various values of the independe nt
variable, however, and not as a functional relationship.

I. General Problem: Find the solution of an nth ordered ordinary D.E. of the form
𝑑𝑦 𝑑2 𝑦 𝑑𝑛 𝑦
𝐹 (𝑥, , 2 , … , 𝑛 ) = 0
𝑑𝑥 𝑑𝑥 𝑑𝑥
using Numerical Method

Initial Value Problem: Boundary Conditions are all at one point


Boundary Value Problem: Boundary Conditions more than one point

The solution to a differential equation is the function that satisfies the differential equation
and that also satisfies certain initial conditions on the function. In solving a differential
equation analytically, we usually find a general solution containing arbitrary constants and
then evaluate the arbitrary constants so that the expression agrees with the initial
conditions. For an nth-order equation, n independent initial conditions must usually be
known.

II. Solutions
A. Analytical Solution (D.E.)
B. Numerical Solution

III. Numerical Solution of 1st order ODE


A. Problem
Find solution
𝑑𝑦
𝐹 (𝑥, 𝑦, ) = 0
𝑑𝑥
or
𝑑𝑦
= 𝑓 (𝑥, 𝑦) 𝑤ℎ𝑒𝑟𝑒: 𝑦 = 𝑓(𝑥)
𝑑𝑥
using Numerical Method or find a unique solution, y(x), which satisfies DE and
Boundary Conditions.

B. Graphical Representation of Solution

C. Solution
Several methods are explored in solving first-order equations, and then to show how
these same methods can be applied to systems of simultaneous first-order equations
and to higher-order differential equations.

1) Taylor-Series Method (TSE) – is a straightforward adaptation of classic calculus to


develop the solution as an infinite series. The catch is that a computer usually
cannot be programmed to construct the terms and one does not know how many
terms should be used.
2) Euler and Modified Euler Method – are simple to use but subject to error unless the
step size ∆x is made very small.
3) The Runge-Kutta Method (R-K-M) – are very popular because of their good
efficiency; they are used in most computer programs for differential equations.
They are single-step methods, as are the Euler methods.
Runge-Kutta-Fehlberg Method
Runge-Kutta-Merson Method
4) Milne’s Method – is a multistep method that appears very attractive until one finds
that it may be unstable.
5) The Adams-Moulton Method – is a multistep method that does not suffer from the
fault of instability.

IV. Runge-Kutta Method (R-K-M) – a further advance in efficiency developed by German


Mathematicians Runge and Kutta. They developed algorithms that solve a differential
equation efficiently and yet are the equivalent of approximating the exact solution by
matching the first n terms of the Taylor-series expansion. We will consider only the fourth-
order Runge-Kutta method even though there are higher-order methods. (The development
is algebraically complicated).
4th order RKM – “classic form”
1
𝑦𝑖+1 = 𝑦𝑖 + (𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 )
6

𝑘1 = ℎ 𝑓(𝑥𝑖 , 𝑦𝑖 )
ℎ 𝑘1
𝑘2 = ℎ 𝑓(𝑥𝑖 + , 𝑦𝑖 + )
2 2
ℎ 𝑘2
𝑘3 = ℎ 𝑓(𝑥𝑖 + , 𝑦𝑖 + )
2 2
𝑘4 = ℎ 𝑓(𝑥𝑖 + ℎ, 𝑦𝑖 + 𝑘3 )

Example 1:
𝑑𝑦
= 𝑓 (𝑥, 𝑦) = −2𝑥 − 𝑦
𝑑𝑥

𝑦(0) = −1 {means when x = 0, y = –1}

a) Analytical solution
𝑦(𝑥 ) = −3𝑒 −𝑥 − 2𝑥 + 2 {please verify}

b) Fourth-order Runge-Kutta Method


Using the above example at h=0.1.
𝑥𝑖 = 0 𝑦𝑖 = −1
1
𝑦𝑖+1 = 𝑦𝑖 + (𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 )
6

𝑘1 = ℎ 𝑓(𝑥𝑖 , 𝑦𝑖 ) = ℎ(−2𝑥𝑖 − 𝑦𝑖 ) = 0.1[−2(0) − (−1)] = 0.1


ℎ 𝑘1 ℎ 𝑘1
𝑘2 = ℎ 𝑓 (𝑥𝑖 + 2 , 𝑦𝑖 + 2
) = ℎ [−2 (𝑥𝑖 + 2 ) − (𝑦𝑖 + 2
)] = 0.085
ℎ 𝑘2 ℎ 𝑘2
𝑘3 = ℎ 𝑓 (𝑥𝑖 + 2 , 𝑦𝑖 + 2
)
= ℎ [−2 (𝑥𝑖 + 2 ) − (𝑦𝑖 + = 0.0858
2
)]
𝑘4 = ℎ 𝑓(𝑥𝑖 + ℎ, 𝑦𝑖 + 𝑘3 ) = ℎ[−2(𝑥𝑖 + ℎ) − (𝑦𝑖 + 𝑘3 )] = 0.0714

TABULATION
i xi yi k1 k2 k3 k4 yi+1 Analytical
0 0 -1 0.1 0.0850 0.0858 0.0714 -0.91450 -1
1 0.1 -0.91450 0.0715 0.0579 0.0586 0.0456 -0.85620 -0.91451
2 0.2 -0.85620 0.0456 0.0333 0.0340 0.0222 -0.82250 -0.85619
3 0.3 -0.82250 0.0222 0.0111 0.0117 0.0011 -0.81100 -0.82245
4 0.4 -0.81100 0.0011 -0.0090 0.0085 -0.0181 -0.81959 -0.81096
5 0.5 -0.81959 -0.81959
Assignment 1:
Solve the initial value problem from t = 0 to 2 when y(0) = 1.
𝑑𝑦
= 𝑦𝑡 3 − 1.5𝑦
𝑑𝑡
Using the methods:
a) Analytically
b) Fourth-order R-K-M using h=0.2
V. Simultaneous ODE by R-K-M
Basis: An nth order ODE can be converted to n simultaneous 1st order ODE. For 2nd order
ODE can be converted to two (2) simultaneous 1 st order ODE.

𝑑𝑦
= 𝑓(𝑡, 𝑦, 𝑢 ) 𝑤ℎ𝑒𝑟𝑒: 𝑦 = 𝑓(𝑡) 𝑎𝑛𝑑 𝑢 = 𝑓(𝑡)
𝑑𝑡

𝑑𝑢
= 𝑔(𝑡, 𝑦, 𝑢 ) 𝑤ℎ𝑒𝑟𝑒: 𝑦 = 𝑓(𝑡) 𝑎𝑛𝑑 𝑢 = 𝑓(𝑡)
𝑑𝑡

1
𝑦𝑖+1 = 𝑦𝑖 + (𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 )
6

𝑘1 = ℎ 𝑓(𝑡𝑖 , 𝑦𝑖 , 𝑢𝑖 )
ℎ 𝑘1 𝑞1
𝑘2 = ℎ 𝑓(𝑡𝑖 + , 𝑦𝑖 + , 𝑢𝑖 + )
2 2 2
ℎ 𝑘2 𝑞2
𝑘3 = ℎ 𝑓(𝑡𝑖 + , 𝑦𝑖 + , 𝑢𝑖 + )
2 2 2
𝑘4 = ℎ 𝑓(𝑡𝑖 + ℎ, 𝑦𝑖 + 𝑘3 , 𝑢𝑖 + 𝑞3 )

1
𝑢𝑖+1 = 𝑢𝑖 + (𝑞1 + 2𝑞2 + 2𝑞3 + 𝑞4 )
6

𝑞1 = ℎ 𝑔(𝑡𝑖 , 𝑦𝑖 , 𝑢𝑖 )
ℎ 𝑘1 𝑞1
𝑞2 = ℎ 𝑔(𝑡𝑖 + , 𝑦𝑖 + , 𝑢𝑖 + )
2 2 2
ℎ 𝑘2 𝑞2
𝑞3 = ℎ 𝑔(𝑡𝑖 + , 𝑦𝑖 + , 𝑢𝑖 + )
2 2 2
𝑞4 = ℎ 𝑔(𝑡𝑖 + ℎ, 𝑦𝑖 + 𝑘3 , 𝑢𝑖 + 𝑞3 )

ALTERNATIVE (DIRECT) METHOD

1
𝑦𝑖+1 = 𝑦𝑖 + ℎ𝑢𝑖 + ℎ(𝑞1 + 𝑞2 + 𝑞3 )
6

Example 2: Solve the differential equation

𝑑2𝑦 𝑑𝑦
2
+3 + 2𝑦 = 0
𝑑𝑡 𝑑𝑡

subject to the initial conditions that 𝑦(0) = 1 and 𝑦 ′ (0) = 0, from 0 to 1.


a) Analytical solution
𝑦(𝑡) = 2𝑒 −𝑡 − 𝑒 −2𝑡 {please verify}

b) Fourth-order Runge-Kutta Method

Let
𝑑𝑦
𝑢=
𝑑𝑡
Or
𝑑𝑦
=𝑢 − − − − − − − − − − (1)
𝑑𝑡
Then
𝑑 𝑑𝑦 𝑑𝑦
( )+3 + 2𝑦 = 0
𝑑𝑡 𝑑𝑡 𝑑𝑡

𝑑𝑢
+ 3𝑢 + 2𝑦 = 0
𝑑𝑡

𝑑𝑢
= −3𝑢 − 2𝑦 − − − − − − − (2)
𝑑𝑡

Using the above example at h=0.2,


𝑡𝑖 = 0 𝑦𝑖 = 1 𝑢𝑖 = 0

1
𝑦𝑖+1 = 𝑦𝑖 + (𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 )
6

1
𝑢𝑖+1 = 𝑢𝑖 + (𝑞1 + 2𝑞2 + 2𝑞3 + 𝑞4 )
6

𝑘1 = ℎ 𝑓(𝑡𝑖 , 𝑦𝑖 , 𝑢𝑖 ) = ℎ(𝑢𝑖 ) = 0.2[0] = 0


𝑞1 = ℎ 𝑔(𝑡𝑖 , 𝑦𝑖 , 𝑢𝑖 ) = ℎ(−3𝑢𝑖 − 2𝑦𝑖 ) = 0.2[−3(0) − 2(1)] = −0.4

ℎ 𝑘1 𝑞1 𝑞1
𝑘2 = ℎ 𝑓 (𝑡𝑖 + , 𝑦𝑖 + , 𝑢𝑖 + ) = ℎ [(𝑢𝑖 + )] = −0.04
2 2 2 2
ℎ 𝑘1 𝑞1 𝑞1 𝑘1
𝑞2 = ℎ 𝑔 (𝑡𝑖 + , 𝑦𝑖 + , 𝑢𝑖 + ) = ℎ [−3 (𝑢𝑖 + ) − 2(𝑦𝑖 + )] = −0.28
2 2 2 2 2

ℎ 𝑘2 𝑞2 𝑞2
𝑘3 = ℎ 𝑓 (𝑡𝑖 + , 𝑦𝑖 + , 𝑢𝑖 + ) = ℎ [(𝑢𝑖 + )] = −0.028
2 2 2 2
ℎ 𝑘2 𝑞2 𝑞2 𝑘2
𝑞3 = ℎ 𝑔 (𝑡𝑖 + , 𝑦𝑖 + , 𝑢𝑖 + ) = ℎ [−3 (𝑢𝑖 + ) − 2(𝑦𝑖 + )] = −0.308
2 2 2 2 2

𝑘4 = ℎ 𝑓(𝑡𝑖 + ℎ, 𝑦𝑖 + 𝑘3 , 𝑢𝑖 + 𝑞3 ) = ℎ[(𝑢𝑖 + 𝑞3 )] = −0.0616


𝑞4 = ℎ 𝑔(𝑡𝑖 + ℎ, 𝑦𝑖 + 𝑘3 , 𝑢𝑖 + 𝑞3 ) = ℎ[−3(𝑢𝑖 + 𝑞3 ) − 2(𝑦𝑖 + 𝑘3 )] = −0.204
TABULATION
i ti yi ui yi+1 ui+1 Analytical
0 0 1 0 0.9671 -0.2967 1
1 0.2 0.9671 -0.2967 0.8912 -0.4418 0.96714
2 0.4 0.8912 -0.4418 0.7963 -0.4950 0.89131
3 0.6 0.7963 -0.4950 0.6967 -0.4947 0.79643
4 0.8 0.6967 -0.4947 0.6004 -0.4649 0.69676
5 1.0 0.6004 -0.4649 0.60042

Assignment 2:
Solve the differential equation

𝑑2𝑦 𝑑𝑦
2
−3 + 2𝑦 − 𝑡 = 0
𝑑𝑡 𝑑𝑡

subject to the initial conditions that 𝑦(0) = 1 and 𝑦 ′ (0) = 0, from 0 to 1.


Use fourth order Runge-Kutta method and h=0.2. Compare results with the
analytical (exact) solution,
3 1 3
𝑦 = 𝑒 𝑥 − 𝑒 2𝑥 + 𝑥 +
4 2 4

You might also like