KEMBAR78
Module 5 | PDF | Numerical Analysis | Ordinary Differential Equation
0% found this document useful (0 votes)
32 views8 pages

Module 5

The document discusses numerical methods for solving ordinary differential equations (ODEs), focusing on Taylor series, Modified Euler's method, and the Runge-Kutta method. Each method includes a detailed explanation, step-by-step procedures, and example problems with solutions. Applications of these methods in engineering and computer simulations are also highlighted.

Uploaded by

Vasu V E Gowda
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)
32 views8 pages

Module 5

The document discusses numerical methods for solving ordinary differential equations (ODEs), focusing on Taylor series, Modified Euler's method, and the Runge-Kutta method. Each method includes a detailed explanation, step-by-step procedures, and example problems with solutions. Applications of these methods in engineering and computer simulations are also highlighted.

Uploaded by

Vasu V E Gowda
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/ 8

Module-5 Numerical Methods-2

Numerical Solution of Ordinary Differential Equations

Introduction
Taylors series method is a numerical technique used to approximate the solution of an
ordinary differential equation (ODE) of the form:
dy
= f (x, y), y(x0 ) = y0
dx
It uses the Taylor series expansion to estimate the value of y at a nearby point.

Taylor Series Expansion


The Taylor series for y(x) about x = x0 is:

(x − x0 )2 ′′ (x − x0 )3 ′′′
y(x) = y0 + (x − x0 )y0′ + y0 + y0 + · · ·
2! 3!
Where:

• y0 = y(x0 )

• y0′ = f (x0 , y0 )

• Higher-order derivatives y0′′ , y0′′′ , . . . are obtained by differentiating f (x, y)

Problems
dy
1. Solve dx
= x + y, given y(0) = 1, using Taylor’s method to find y(0.1).

Solution:

Given:
x0 = 0, y0 = 1

Compute derivatives:
y0′ = f (0, 1) = 0 + 1 = 1
d
y ′′ = (x + y) = 1 + y ′ ⇒ y0′′ = 1 + y0′ = 2
dx
d
y ′′′ = (1 + y ′ ) = y ′′ ⇒ y0′′′ = 2
dx

1
Numerical Methods Mr.Vasu V Eregowda

Now apply the Taylor expansion:

(0.1)2 (0.1)3
y(0.1) ≈ 1 + (0.1)(1) + (2) + (2)
2! 3!
0.001
y(0.1) ≈ 1 + 0.1 + 0.01 + (2) = 1.1 + 0.01 + 0.000667 ≈ 1.1107
3
2. Employ Taylor’s series method to solve the initial value problem
dy
= x − y2, y(0) = 1,
dx
at the point x = 0.1, by considering up to 4th degree terms. (BMATS201 Dec.
2024/Jan. 2025)

3. Use Taylor’s series method to find y at x = 0.1 considering up to the third degree,
give that
dy
= x2 + y 2 , y(0) = 1,
dx
(BMATE201 Dec. 2024/Jan. 2025)

4. By Taylor’s Series method, find the value of y at x = 0.1 and x = 0.2 up-to FIVE
decimal places from
dy
= x2 y − 1, y(0) = 1,
dx
(BMATS201 Model Question Paper) (BMATS201 Dec.2023/Jan. 2024)

5. Employ Taylor’s series method to obtain approximate value of y at x = 0.2 for the
differential equation
dy
= 2y + 3ex , y(0) = 0,
dx
(BMATS201 Model Question Paper) (BMATS201 June/July 2023)

6. Employ Taylor’s series method to find y at x = 0.1 and x = 0.2 given that
dy
= 2y + 3ex , y(0) = 0,
dx
(BMATS201 Nov./Dec. 2023)

Applications
• Engineering problems involving motion or circuits.

• Numerical simulations in control systems.

• Computer-based differential equation solving.

2
Numerical Methods Mr.Vasu V Eregowda

Introduction
The Modified Eulers Method (also called the Heun’s method or Improved Eulers
method) is an iterative numerical technique used to solve initial value problems of the
form:
dy
= f (x, y), y(x0 ) = y0
dx
This method improves upon the simple Eulers method by taking the average of slopes
at the beginning and end of the interval.

Eulers method is given by:

(0)
Step 1: y1 = yn + hf (x0 , y0 )

Modified Euler’s formula formula is given by:

(1) hh (0)
i
Step 2: y1 = y0 + f (x0 , y0 ) + f (x1 , y1 )
2
(2) hh (1)
i
Step 3: y1 = y0 + f (x0 , y0 ) + f (x1 , y1 )
2
(3) hh (2)
i
Step 4: y1 = y0 + f (x0 , y0 ) + f (x1 , y1 )
2
Note: Each of the succeeding approximations is better than the preceding ones. They are
called corrector values. Euler’s formulae used jointly are also called as Euler’s predictor
and corrector formulae.

Working Procedure
dy
1. Given: dx
= f (x, y), y(x0 ) = y0

2. Choose step size h, compute x1 = x0 + h

3. Compute the predictor:


y (1) = y0 + hf (x0 , y0 )

4. Compute the corrector:


h
f (x0 , y0 ) + f (x1 , y (1) )

y1 = y0 +
2

5. Repeat the process for further steps.

Problems
dy
1. Solve dx
= x + y, with y(0) = 1, find y(0.1) using Modified Eulers method.

3
Numerical Methods Mr.Vasu V Eregowda

Solution:

Given:
x0 = 0, y0 = 1, h = 0.1
Step 1: Predictor:
y (1) = y0 + hf (x0 , y0 ) = 1 + 0.1(0 + 1) = 1.1

Step 2: Corrector:
f (x0 , y0 ) = 0 + 1 = 1, f (x1 , y (1) ) = 0.1 + 1.1 = 1.2
0.1
y1 = 1 + (1 + 1.2) = 1 + 0.1 × 1.1 = 1.11
2
So, y(0.1) ≈ 1.11
2. Solve by using the modified Euler’s method, taking h = 0.1, find y(0.2). Given that
dy
= x − y2, y(0) = 1
dx
(BMATC201 Dec. 2024/Jan. 2025)
3. Using Modified Euler’s formula, compute y at x = 0.2 by taking h = 0.2 give that,
dy
= x + y, y(0) = 1
dx
(BMATE201 Dec. 2024/Jan. 2025)
4. Using Modified Euler’s formula, compute y at x = 0.1 by taking h = 0.1 give that,
dy
= x + y, y(0) = 1
dx
. Carryout 3-modifications. (BMATE201 Nov./Dec. 2023)
5. Use Modified Euler’s method to compute y(0.1), by taking h = 0.05, given that
dy
= x2 + y, y(0) = 1
dx
(BMATS201 Dec. 2024/Jan. 2025)(Model Question Paper BMATS201)
6. Solve the initial value problem using the Modified Euler’s method
y
y ′ (x) = 3x + , y(0) = 1
2
then find y(0.2) using a step size of h = 0.2. (Model Question Paper BMATS201)
7. Solve the initial value problem using the Modified Euler’s method
y
y ′ (x) = 3x + , y(0) = 1
2
then find y(0.1) using a step size of h = 0.1. (BMATs201 Dec. 2023/Jan. 2024)
8. Given p
y ′ (x) = x + |y|, y(0) = 1
compute y(0.4) with a step size of h = 0.2 using Euler’s modified method. Perform
two modifications in each stage ( BMATS201 June/July 2023)

4
Numerical Methods Mr.Vasu V Eregowda

Applications
• Engineering problems involving transient behavior.

• Suitable for simulation of dynamic systems.

• Computer-based numerical solvers.

Runge-Kutta Method 4th Order (RK4)

1. Introduction
The Runge-Kutta 4th Order Method (RK4) is a powerful and widely used technique for
numerically solving first-order ordinary differential equations (ODEs) of the form:
Consider the intival value problem,
dy
= f (x, y), y(x0 ) = y0
dx
we need to find y(x0 + h), where h is the step size.

3. RK4 Formula
To compute y1 from y0 , we use the following formulas:

k1 = hf (x0 , y0 )
 
h k1
k2 = hf x0 + , y0 +
2 2
 
h k2
k3 = hf x0 + , y0 +
2 2
k4 = hf (x0 + h, y0 + k3 )
1
y1 = y0 + (k1 + 2k2 + 2k3 + k4 )
6

4. Step-by-Step Procedure
1. Identify the differential equation and initial condition.

2. Choose the step size h.

3. Compute k1 , k2 , k3 , k4 using the formula above.

4. Compute y1 and proceed to the next step.

5. Repeat until the desired value of x is reached.

5
Numerical Methods Mr.Vasu V Eregowda

5. Interpretation of Slopes
1. k1 : Slope at the beginning of the interval.

2. k2 and k3 : Slopes at midpoints.

3. k4 : Slope at the end of the interval.

4. Weighted average gives the final value.

6. Problems
1. Solve:
dy
= x + y, y(0) = 1
dx
Using RK4 with step size h = 0.1.

Step-by-step solution:

Given:
x0 = 0, y0 = 1, h = 0.1, f (x, y) = x + y

k1 = hf (x0 , y0 ) = 0.1 · (0 + 1) = 0.1


 
h k1
k2 = hf x0 + , y0 + = 0.1 · (0.05 + 1.05) = 0.1 · 1.1 = 0.11
2 2
 
h k2
k3 = hf x0 + , y0 + = 0.1 · (0.05 + 1.055) = 0.1 · 1.105 = 0.1105
2 2
k4 = hf (x0 + h, y0 + k3 ) = 0.1 · (0.1 + 1.1105) = 0.1 · 1.2105 = 0.12105

Now, compute y1 :

1
y1 = y0 + (k1 + 2k2 + 2k3 + k4 )
6
1
= 1 + (0.1 + 2 · 0.11 + 2 · 0.1105 + 0.12105)
6
1
= 1 + (0.1 + 0.22 + 0.221 + 0.12105)
6
1
= 1 + (0.66205)
6
≈ 1 + 0.11034
≈ 1.11034

Therefore, y(0.1) ≈ 1.11034

6
Numerical Methods Mr.Vasu V Eregowda

2. Given
y
y ′ (x) = 3x + , y(0) = 1
2
compute y(0.2 by taking h = 0.2 using Runge-Kutta method of fourth order.
By data: x0 = 0, y0 = 1, h = 0.2, f (x, y) = 3x + y2

Step 1: Compute the intermediate slopes

 
1
k1 = h · f (x0 , y0 ) = 0.2 · 3 · 0 + = 0.2 · 0.5 = 0.1
2
   
h k1 1.05
k2 = h · f x0 + , y0 + = 0.2 · 3 · 0.1 +
2 2 2
= 0.2 · (0.3 + 0.525) = 0.2 · 0.825 = 0.165
   
h k2 1.0825
k3 = h · f x0 + , y0 + = 0.2 · 3 · 0.1 +
2 2 2
= 0.2 · (0.3 + 0.54125) = 0.2 · 0.84125 = 0.16825
 
1.16825
k4 = h · f (x0 + h, y0 + k3 ) = 0.2 · 3 · 0.2 +
2
= 0.2 · (0.6 + 0.584125) = 0.2 · 1.184125 = 0.236825

Step 2: Compute the next value of y

1
y1 = y0 + (k1 + 2k2 + 2k3 + k4 )
6
1
= 1 + (0.1 + 2 · 0.165 + 2 · 0.16825 + 0.236825)
6
1
= 1 + (0.1 + 0.33 + 0.3365 + 0.236825)
6
1
= 1 + (1.003325)
6
≈ 1 + 0.16722
≈ 1.16722

Final Answer: y(0.2) ≈ 1.16722

3. Given
dy
= y(x + y), y(0) = 1, h = 0.1
dx
compute y(0.1 and y(0.2 by taking h = 0.1 using Runge-Kutta method of fourth
order.
Given:
dy
= y(x + y), y(0) = 1, h = 0.1
dx

7
Numerical Methods Mr.Vasu V Eregowda

The RK4 formulas are:


k1 = hf (x0 , y0 )
 
h k1
k2 = hf x0 + , y0 +
2 2
 
h k2
k3 = hf x0 + , y0 +
2 2
k4 = hf (x0 + h, y0 + k3 )
1
y1 = y0 + (k1 + 2k2 + 2k3 + k4 )
6
We define: f (x, y) = y(x + y)

Step 1: From x = 0 to x = 0.1

Initial values: x0 = 0, y0 = 1

k1 = 0.1 · f (0, 1) = 0.1 · 1(0 + 1) = 0.1


0.1
k2 = 0.1 · f (0.05, 1 + ) = 0.1 · f (0.05, 1.05) = 0.1 · 1.05(0.05 + 1.05) = 0.1155
2
0.1155
k3 = 0.1 · f (0.05, 1 + ) = 0.1 · f (0.05, 1.05775) ≈ 0.1171
2
k4 = 0.1 · f (0.1, 1 + 0.1171) = 0.1 · f (0.1, 1.1171) ≈ 0.1359

1
y1 = 1 + (0.1 + 2 · 0.1155 + 2 · 0.1171 + 0.1359) ≈ 1.1002
6

Step 2: From x = 0.1 to x = 0.2

Now x1 = 0.1, y1 ≈ 1.1002

k1 = 0.1 · f (0.1, 1.1002) = 0.1 · 1.1002(0.1 + 1.1002) ≈ 0.1321


0.1321
k2 = 0.1 · f (0.15, 1.1002 + ) = 0.1 · f (0.15, 1.16625) ≈ 0.1535
2
0.1535
k3 = 0.1 · f (0.15, 1.1002 + ) = 0.1 · f (0.15, 1.17695) ≈ 0.1562
2
k4 = 0.1 · f (0.2, 1.1002 + 0.1562) = 0.1 · f (0.2, 1.2564) ≈ 0.1831
1
y2 = y1 + (0.1321 + 2 · 0.1535 + 2 · 0.1562 + 0.1831) ≈ 1.2560
6

Final Answers:

y(0.1) ≈ 1.1002
y(0.2) ≈ 1.2560

You might also like