UNIT-1
Finite Difference Methods to Solve Boundary Value ODE
Assistant Professor of Department of Applied Mathematics and Humanities,
Yeshwantrao Chavan college of Engineering, Nagpur-441110, India
Abstract
Finite difference method is very popular and important tool to solve the boundary value
problems. Those problems consist ordinary differential equation (ODE) and complicated
boundary conditions that appears in many areas of science and engineering. In this chapter three
types of boundary conditions like Dirichlet Boundary condition, Neumann boundary condition
and mixed boundary condition are discussed. Type of error, stability, convergence and truncation
error are also explained. 2nd and 4th order ordinary differential equations are solved by finite
difference scheme. Some numerical results are compared with analytical results and error is
calculated at each point.
Keywords: Finite difference scheme, Dirichlet Boundary condition, Neumann boundary
condition, Mixed boundary condition, Stability, Truncation error.
Introduction
Many problems in science and engineering can be reduced to the problem of solving differential
equations satisfying certain given condition. The analytical methods of solution can be applied to
solve only a selected class of differential equations. Those problem consists differential equation
and complicated conditions which govern physical systems do not possess, in general closed
form solution, and hence recourse muse be made to numerical methods for solving such
differential equations.
Finite difference method is a very useful numerical tool to solve the boundary value problem.
Before we start off this chapter we have to know about the boundary value problem. When we
studied IVP s (Initial Value problem) we saw that a differential equation and the initial value of a
function (initial condition) were given. Now we consider the boundary value problem.
Boundary Value Problem
A boundary value problem is a problem, typically an ordinary differential equation or partial
differential equation, which has values assigned on the physical boundary of the domain in
which the problem is specified.
In this unit we begin by discussing various types of boundary conditions that can be imposed. A
BVP which only has one independent variable is an ODE but we consider BVP in dimensions we
need to use PDE.
Throughout this chapter we consider the linear second order ODE given by
𝑦′′ + (𝑥)𝑦′ + 𝑞(𝑥)𝑦 = 𝑟(𝑥) , 𝑎<𝑥<𝑏 1.1
Corresponding to ODE (1.1), there are three important boundary conditions. They are given by
Dirichlet Boundary Condition
If the values of the function are specified on the boundary in a BVP, this type of constraint is
called Dirichlet boundary condition.
For example, (𝑎) = 𝛼 , 𝑦(𝑏) = 𝛽 in domain [a, b], where α and β are constant.
Neumann Boundary Condition
If the derivatives of the unknown function are specified on the boundary in a BVP, this type of
constraint is called Neumann boundary condition.
For example, y′(a) = 𝘢, y′(𝑏) = 𝛽 in domain [a, b], where α and β are constant.
Mixed (Robin) Boundary Condition
If a weighted combination at the function value and its derivative at the boundary is called Robin
boundary condition or mixed boundary condition.
For example, 𝑦′(𝑎) + 𝑦(𝑎) = 𝛼 , 𝑦′(𝑏) + 𝑦(𝑏) = 𝛽
Finite Difference Method
The finite difference method for the solution of a BVP consists in replacing the derivatives
occurring in the differential equation and in the boundary conditions. Their finite difference
approximations and then solving the resulting linear system of equations are solved by a standard
procedure.
To obtain the approximate finite difference approximations to the derivatives,
Expanding (𝑥 + ℎ) in Talor’s series, we have
2 3
(𝑥 + ℎ) = 𝑦(𝑥) + ℎ𝑦′(𝑥) + ℎ 𝑦′′(𝑥) + ℎ 𝑦′′′(𝑥) + … … … … … .. 1.2
2! 3!
𝑦′(𝑥) = 𝑦(𝑥+ℎ)−𝑦(𝑥) − ℎ 𝑦′′(𝑥) − … … … … … … ….
ℎ 2
Thus, 𝑦′(𝑥) = 𝑦(𝑥+ℎ)−𝑦(𝑥) + 𝑂(ℎ) 1.3
ℎ
which is the forward difference approximation for 𝑦′(𝑥)
Similarly, expansion of (𝑥 − ℎ) in Talor’s series, we have
2 3
(𝑥 − ℎ) = 𝑦(𝑥) − ℎ𝑦′(𝑥) + ℎ 𝑦′′(𝑥) − ℎ 𝑦′′′(𝑥) + … … … … … .. 1.4
2! 3!
𝑦′(𝑥) = 𝑦(𝑥)−𝑦(𝑥−ℎ) + ℎ 𝑦′′(𝑥) − … … … … … … ….
ℎ 2
Thus, 𝑦′(𝑥) = 𝑦(𝑥)−𝑦(𝑥−ℎ) + 𝑂(ℎ) 1.5
ℎ
which is backward difference approximation for 𝑦′(𝑥)
A centre difference approximation for 𝑦′(𝑥) can be obtained by subtracting Eq.1.4 from Eq.1.2
𝑦(𝑥+ℎ)−𝑦(𝑥−ℎ)
𝑦′(𝑥) = + 𝑂(ℎ2) 1.6
2ℎ
It is clear that Eq.1.6 is a better approximation to 𝑦′(𝑥) than either Eq.1.3 or Eq.1.5.
Again adding Eq.1.2 and Eq.1.4, we get an approximation for 𝑦′′(𝑥)
𝑦(𝑥−ℎ)−2𝑦(𝑥)+𝑦(𝑥+ℎ)
𝑦′′(𝑥) = + 𝑂(ℎ2) 1.7
ℎ2
In a similar manner, it is possible to derive finite difference approximations to higher derivatives.
1.3.1 Finite Difference Formula for solving BVP
To solve the BVP defined by (1.1), we divide the range [x0, xn] into n equal subintervals of width
h so that
𝑥i = 𝑥0 + iℎ, i = 1, 2, 3,.......... 𝑛.
The corresponding value of 𝑦 at these points are denoted by
(𝑥i) = 𝑦i = 𝑦(𝑥0 + iℎ), i = 0, 1, 2, ................... n.
From Eqs. 1.6 & 1.7, values of 𝑦′(𝑥) and 𝑦′′(𝑥) at the point 𝑥 = 𝑥i can be written as
𝑦i+1−𝑦i−1 + 𝑂 (ℎ2)
𝑦i′ =
2ℎ
𝑦i−1−2𝑦i+ 𝑦i+1 + (ℎ2)
𝑦i′′ =
ℎ2
Satisfying the differential equation at the point 𝑥 = 𝑥i, we get
𝑦′′ + fi𝑦′ + 𝑔i𝑦i = 𝑟i
i i
Substituting the expressions for 𝑦′ and 𝑦′′
i i
𝑦i−1−2𝑦i+ 𝑦i+1
ℎ2
+ fi 𝑦i+1−𝑦i−1
2ℎ
+ 𝑔i𝑦i = 𝑟i , i = 1, 2, …..n
Where 𝑦i = (𝑥 i) , 𝑔i = 𝑔(𝑥 i)
Error Analysis
Error Calculation
We first find exact solution. Solve the given differential equation, that means, find C.F
(Complementary function) and P.I. (Particular Integral). Then
Absolute Error = | Exact solution – Numerical Solution |
| 𝐸𝑥𝑎𝑐𝑡 𝑠𝑜𝑙𝑢𝑡i𝑜𝑛 – 𝑁𝑢𝑚𝑒𝑟i𝑐𝑎𝑙 𝑆𝑜𝑙𝑢𝑡i𝑜𝑛 |
Relative Error =
𝐸𝑥𝑎𝑐𝑡 𝑠𝑜𝑙𝑢𝑡i𝑜𝑛
| 𝐸𝑥𝑎𝑐𝑡 𝑠𝑜𝑙𝑢𝑡i𝑜𝑛 – 𝑁𝑢𝑚𝑒𝑟i𝑐𝑎𝑙 𝑆𝑜𝑙𝑢𝑡i𝑜𝑛 |
Percentage Error = × 100.
𝐸𝑥𝑎𝑐𝑡 𝑠𝑜𝑙𝑢𝑡i𝑜𝑛
Type of Errors
Round off Error
The round-off error is used because representing every number as a real number isn't
possible. So rounding is introduced to adjust for this situation
Truncation Error
A truncation error occurs when approximation is involved in numerical analysis. The
error factor is related to how much the approximate value is at variance from the actual
value in a formula or math result.
Numerical Stability
A numerical scheme is said to be stable if the difference between the numerical solution and the
exact solution remains bounded as the number of steps tends to infinity.
Numerical Convergence
For any iterative numerical technique, each successive iteration results in a solution that moves
progressively closer to the true solution. This is known as convergence. A numerical method is
not always guaranteed to produce converging results. Convergence is subject to satisfying certain
conditions. If these conditions are not met, each successive iteration produces a result that
progressively moves away from the true solution. This is known as divergence.
Numerical Consistency
A numerical scheme is said to be consistent if the Finite difference representation converges to
the differential equation. We are trying to solve as the space step tends to zero.
Truncation Error Analysis
Truncation error is the error made by truncating an infinite sum and approximating it by a finite
sum. For instance, if we approximate the sine function by the first two nonzero term of its
Taylor’s series, as in 𝑠i𝑛 (𝑥) ≈ 𝑥 − 1 𝑥3 for small 𝑥, the resulting error is truncation error.
6
Consider the 2nd order differential equation
𝑦i′′ + fi𝑦i′ + 𝑔i𝑦i = 𝑟i
To estimate the error in numerical solution, we define the local truncation error, 𝑟, by
𝑦i−1−2𝑦i+𝑦i+1 𝑦i+1−𝑦i−1
𝑟=( − 𝑦i′′) + fi ( − 𝑦′i)
ℎ2 2ℎ
Expanding 𝑦i−1 and 𝑦i+1 by Taylor’s series,
2 3 4
𝑦 = 𝑦 − ℎ𝑦′ + ℎ 𝑦′′ − ℎ 𝑦′′′ + ℎ 𝑦i𝑣 − ............................. (since 𝑥 = 𝑥 − ℎ)
i−1 i i 2! i 3! i 4! i i−1 i
2 3 4
𝑦 = 𝑦 + ℎ𝑦′ + ℎ 𝑦′′ + ℎ 𝑦′′′ + ℎ 𝑦i𝑣 + ............................ (since 𝑥 = 𝑥 + ℎ)
i+1 i i 2! i 3! i 4! i i+1 i
1 2
ℎ2𝑦𝘍𝘍+ ℎ4𝑦 i𝑣+ … 2ℎ𝑦𝘍+ ℎ3𝑦𝘍𝘍𝘍
𝑟= ( i 12 i − 𝑦′′) + fi ( i 3! i − 𝑦′)
ℎ2 i 2ℎ i
2
𝑟 = (𝑦′′ + 1 ℎ2𝑦i𝑣 + … … … … − 𝑦′′) + f (𝑦′ + ℎ 𝑦′′′ + … … … … … − 𝑦′)
i 12 i i i i 6 i i
2
𝑟= ℎ (𝑦i𝑣 + 2f 𝑦′′′) + (ℎ4)
12 i i i
It follows that 𝑟 → 0 as ℎ → 0 , implying that better accuracy in the result can be achieved by
using a smaller value of h. In such a case, of course, more computational effort would be
required since number of equations become larger.
We have explained the method with three types of boundary conditions. In many applied
problems, derivative boundary conditions may be prescribed, and this requires a modification of
the procedures described above. The following examples illustrate the application of finite-
difference method.
Test Problems and verification
Example 1 (Dirichlet Boundary conditions)
A boundary value problem is defined by
𝑦′′ + 𝑦 + 1 = 0, 0 ≤ 𝑥 ≤ 1, (0) = 0 and 𝑦 (1) = 0. Determine the value of (0.5) using
finite difference method with sub-interval ℎ = 0.5. and ℎ = 0.25. Also calculate error at each
point.
Solution:
h h
Case I: When ℎ = 0.5,.
Here interval is 0 ≤ 𝑥 ≤ 1, ie, [0, 1]. X0 X1 X2
So 𝑥0 = 0, 𝑥1 = 𝑥0 + ℎ = 0.5 = 1/2, 𝑥2 = 𝑥0 + 2ℎ = 1
There are only three values of x, so we have three points.
Dirichlet’s boundary conditions are given by (0) = 0 and 𝑦 (1) = 0.
That means, (0) = 𝑦(𝑥0) = 𝑦0 = 0 and 𝑦(1) = 𝑦(𝑥2) = 𝑦2 = [Link]
have to find (0.5) = 𝑦1.
The given differential equation is approximated as
𝑦i−1−2𝑦i+ 𝑦i+1
ℎ2
+ 𝑦i + 1 = 0 1.8
𝑦i−1 − (2 − ℎ2)𝑦i + 𝑦i+1 = −ℎ2 (i = 1, 2, ….n-1) 1.9
Using boundary conditions 𝑦0 = 0 and 𝑦𝑛 = 𝑦2 = 0. Since number of sub-interval
𝑛 = 2 and unknown point is 1, then take i = 1.
Eq. 1.8 becomes 𝑦0 − (2 − 1) 𝑦1 + 𝑦2 = − 1
4 4
Using B.C.S.(boundary conditions) , 𝑦0 = 0, and 𝑦2 = 0
𝑦1 = (0.5) = 1 = 0.142854.
7
Exact Solution: To find exact solution of the given differential equation
𝑦′′ + 𝑦 + 1 = 0
(𝐷2 + 1)𝑦 = −1
A.E. 𝑚2 + 1 = 0 or, 𝑚 = ±i
C. F. 𝑦𝑐 = 𝐶1 cos 𝑥 + 𝐶2 sin 𝑥
P.I = 1
(−1) = −1
𝐷 2+1
The general solution is (𝑥) = 𝐶1 cos 𝑥 + 𝐶2 sin 𝑥 − 1 1.10
Using B.C.S. (0) = 0 in Eq.1.10, we get
𝐶1 = 1
Using B.C.S. (1) = 0 in Eq.1.10, we get
𝐶2 = 0.5463 .
Therefore, the exact solution of the given problem is
(𝑥) = cos 𝑥 + (0.5463) sin 𝑥 − 1 1.11
The value of y at 𝑥 = 0.5 is
(0.5) = 0.139493
Error at 𝑥 = 0.5 is |0.139493 − 0.142854| = 0. 003361
Case II When ℎ = 0.25,
Here interval is 0 ≤ 𝑥 ≤ 1, ie, [0, 1].
So 𝑥0 = 0, 𝑥1 = 𝑥0 + ℎ = 0.25, 𝑥2 = 𝑥0 + 2ℎ = 0.5, 𝑥3 = 𝑥0 + 3ℎ = 0.75,
𝑥4 = 𝑥0 + 4ℎ = 1.
Using ℎ = 0.25, Eq. 1.9 becomes
31 1
𝑦i−1 − 𝑦i + 𝑦i+1 = − (i = 1, 2, ….n-1) 1.12
16 16
Put i = 1, 2, 3 (unknown pints) in Eq.1.12, system of linear equations is
𝑦0 − 31 𝑦1 + 𝑦2 = − 1
16 16
𝑦1 − 31 𝑦2 + 𝑦3 = − 1
16 16
𝑦2 − 31 𝑦3 + 𝑦4 = − 1
16 16
Where 𝑦0 = 0, and 𝑦4 = 0 (Due to B.C.S)
The above equations become
− 31 𝑦1 + 𝑦2 = − 1
16 16
𝑦1 − 31 𝑦2 + 𝑦3 = − 1
16 16
31 1
𝑦2 − 𝑦3 = −
16 16
Solving system of equations, we get
𝑦1 = (0.25) = 0.10476
𝑦2 = (0.5) = 0.14031
𝑦3 = (0.75) = 0.10476
Using Eq.1.11, Exact Solutions at each point are
𝑦1 = (0.25) = 0.1041
𝑦2 = (0.5) = 0.1395
𝑦3 = (0.75) = 0.1041
Errors are 0.0006, 0.0008, 0.0006 at 𝑥 = 0.25, 0.5, 0.75.
Since the ratio of two errors is about 4, it follows that the order of convergence is ℎ2.
These results show that the accuracy obtained by the finite difference method depends upon the
width of the subinterval chosen and also on the order of approximations. As ℎ is reduced, the
accuracy increases but the number of equation to be solved also increases.
Example 2 (Dirichlet Boundary conditions)
Solve the boundary value problem is defined by 𝑦′′ − 𝑦 = 0, 0 ≤ 𝑥 ≤ 2, (0) = 0 and
𝑦 (2) = 3.62686 using finite difference method with sub-interval ℎ = 0.5. The exact solution of
this problem is 𝑦 = sin ℎ𝑥. Calculate error at each point.
Solution: The finite difference approximation is given by
𝑦i−1−2𝑦i+ 𝑦i+1
− 𝑦i = 0 1.13
ℎ2
We subdivided the interval [0, 2] into four equal parts since ℎ = 0.5. Let the values of 𝑦 at the
five points be 𝑦0, 𝑦1, 𝑦2, 𝑦3, 𝑦4. We have 𝑥0 = 0, 𝑥1 = 𝑥0 + ℎ = 0.5 = 1/2, 𝑥2 = 𝑥0 + 2ℎ = 1
𝑥3 = 𝑥0 + 3ℎ = 1.5, 𝑥4 = 𝑥0 + 4ℎ = 2.
From boundary conditions (0) = 𝑦(𝑥0) = 𝑦0 = 0 and 𝑦(2) = 𝑦(𝑥4) = 𝑦4 = 3.62686.
We have to find 𝑦1,, 𝑦2, 𝑦3.
Putting i = 1, 2, 3 (unknown pints) in Eq.1.13, system of linear equations is
4(𝑦0 − 2 𝑦1 + 𝑦2) = 𝑦1
4(𝑦1 − 2 𝑦2 + 𝑦3) = 𝑦2
4(𝑦2 − 2 𝑦3 + 𝑦4) = 𝑦3
Where 𝑦0 = 0, and 𝑦4 = 3.62686 (Due to B.C.S)
The above equations become
-9𝑦1 + 4𝑦2 = 0
4𝑦1 − 9𝑦2 + 4𝑦3 = 0
4𝑦2 − 9𝑦3 = −14.50744
Solving above system of equations, we get
𝑦1 = (0.5) = 0.52635
𝑦2 = (1) = 1.18428
𝑦3 = (1.5) = 2.13829
Using Equation 𝑦 = sin ℎ , exact solutions at each point are
𝑦1 = (0.5) = 0.5211
𝑦2 = (1) = 1.18428
𝑦3 = (1.5) = 2.13829
Errors are 0.00525, 0.00908, 0.00901 at 𝑥 = 0.5, 1, 1.5.
Example 3 (Neumann Boundary conditions)
Solve the boundary value problem defined by
𝑦′′(𝑥) − (1 − 𝑥)𝑦′(𝑥) + 𝑥𝑦(𝑥) = 𝑥, 𝑦′(0) = 0 and 𝑦(1) = 0, using finite difference
method with width ℎ = 1/3.
Solution:
Here interval is 0 ≤ 𝑥 ≤ 1, ie, [0, 1].
Points are given by 0 = 0, 𝑥1 = 𝑥0 + ℎ = 1/3, 𝑥2 = 𝑥0 + 2ℎ = 2/3, 𝑥3 = 𝑥0 + 3ℎ = 3 = 1
3
Therefore, ℎ = 1.
3
To solve the equation 𝑦′′ + (1 − 𝑥 i)′ + 𝑥i𝑦i = 𝑥 i use finite difference approximation
i i
𝑦i−1−2𝑦i+ 𝑦i+1 𝑦i+1−𝑦i−1
+ (1 − 𝑥i) + 𝑥 i 𝑦i = 𝑥 i
ℎ2 2ℎ
(2 − ℎ + 𝑥iℎ)𝑦i−1 − (4 − 2ℎ2𝑥i)𝑦i + (2 + 1 − 𝑥 iℎ)𝑦i+1 = 𝑥i ℎ2
(5 + 𝑥i) 𝑦i−1 − (4 − 2 𝑥 i) 𝑦i + (3 − 𝑥i) 𝑦i+1 = 𝑥i 1.16
3 3 9 3 9
Given boundary conditions are
𝑦′(0) = 0
𝑦0′ = 0
𝑦1−𝑦−1
=0
2ℎ
𝑦1 = 𝑦−1
(1) = 0
𝑦3 = 0
Putting i = 0, 1, 2 (unknown points) in Eq.1.16, we get
5𝑦 − 4𝑦0 + 3𝑦1 = 0
−1
3
6𝑦0 − 7𝑦1 = 0 (∴ 𝑦1 = 𝑦−1)
16𝑦0 − 106 𝑦1 + 26𝑦2 = 1
3 3
104 2
17𝑦1 − 𝑦2 =
3 3
Solving above three equations, we get the numerical approximations
𝑦0 = −8.342 ,
𝑦1 = −7.15
𝑦2 = −3.986
Example 4 (Mixed Boundary conditions)
Solve the boundary value problem defined by
𝑦′′(𝑥) − 𝑥𝑦(𝑥) = 0, 0 ≤ 𝑥 ≤ 1, for 𝑦(𝑥i), 𝑥i = 0, 1 , 2, given that 𝑦(0) + 𝑦′(0) = 1 and
3 3
(1) = 1, using finite difference method.
Solution:
Here interval is 0 ≤ 𝑥 ≤ 1, ie, [0, 1].
Points are given by 0 = 0, 𝑥1 = 𝑥0 + ℎ = 1/3, 𝑥2 = 𝑥0 + 2ℎ = 2/3, 𝑥3 = 𝑥0 + 3ℎ = 3 = 1
3
Therefore, ℎ = 1.
3
Mixed boundary conditions are given by (0) + 𝑦′(0) = 1 and 𝑦(1) = 1.
That means, (0) + 𝑦′(0) = 𝑦(𝑥0) + 𝑦′(𝑥0) = 1 and 𝑦(1) = 𝑦(𝑥3) = 𝑦3 = 1.
We have to find 𝑦0, 𝑦1, 𝑦2.
The given differential equation is approximated as
𝑦i−1−2𝑦i+ 𝑦i+1
ℎ2
= 𝑥i𝑦i
𝑦i−1 − (2 + ℎ2𝑥 i) i + 𝑦i+1 = 0 (i = 0,1, 2) 1.17
Putting i = 0, 1, 2 (unknown points) in Eq.1.17, we get
𝑦−1 − 2𝑦0 + 𝑦1 = 0 (∴ 𝑥0 = 0)
𝑦0 − 55 𝑦1 + 𝑦2 = 0 ( ∴ 𝑥1 = 1) 1.18
27 3
𝑦1 − 56 𝑦2 + 𝑦3 = 0 ( ∴ 𝑥2 = 2)
27 3
The first boundary condition is
(0) + 𝑦′(0) = 1
𝑦0 + 𝑦0′ = 1
𝑦0 + 𝑦1−𝑦−1 = 1 (use centre difference approximation)
2ℎ
2𝑦0 + 3(𝑦1 − 𝑦−1) = 1
2𝑦0+3𝑦1−2
𝑦−1 = 3
The second boundary condition is
(1) = 𝑦3 = 1
Using B.C.S, Eqs. 1.18 become the system of linear equations given by
−2𝑦0 + 3𝑦1 = 1
𝑦0 − 55 𝑦1 + 𝑦2 = 0
27
𝑦1 − 56 𝑦 2 = −1
27
Solving the above equations, we get the numerical approximations
𝑦0 = (0) = −0.9879
𝑦1 = (1/3) = −0.3253
𝑦2 = (2/3) = 0.3253
4th Order Differential Equations
From the Taylor series 1.2 and 1.4 we get the finite difference approximation for 4th order
derivative.
𝑦i−2−4𝑦i−1+6 𝑦i−4𝑦i+1+ 𝑦i+2
𝑦i′𝑣 =
ℎ4
1.6.1 Example
Solve the boundary value problem defined by
𝑦′𝑣 − 16𝑦 = 𝑥, 0 ≤ 𝑥 ≤ 1, for (𝑥i), 𝑥i = 0.25, 0.5, 0.75, given that 𝑦(0) = 0, 𝑦′′(0) = 0
and 𝑦(1) = 0, 𝑦′(1) = 0 using finite difference method.
Solution:
Here interval is 0 ≤ 𝑥 ≤ 1, ie, [0, 1].
Points are given by 𝑥0 = 0, 𝑥1 = 𝑥0 + ℎ = 0.25, 𝑥2 = 𝑥0 + 2ℎ = 0.5, 𝑥3 = 𝑥0 + 3ℎ = 0.75,
𝑥4 = 𝑥0 + 4ℎ = 1.
Therefore, ℎ = 0.25
Boundary conditions are given by (0) = 0, 𝑦′′(1) = 0 and 𝑦(1) = 0, 𝑦′(1) = 0.
We have to find 𝑦1, 𝑦2, 𝑦3.
The given differential equation is approximated as
𝑦i−2−4𝑦i−1+6 𝑦i−4𝑦i+1+ 𝑦i+2
− 16𝑦i = 𝑥i
ℎ4
95 1
𝑦i−2 − 4𝑦i−1 + 𝑦i − 4𝑦i+1 + 𝑦i+2 = 𝑥i 1.16
16 256
Using B.C.S
𝑦0 = (0) = 0 1.17
𝑦 ′′ (0) = 𝑦 ′′ = *𝑦i−1−2𝑦i+𝑦i+1 + =0
0 ℎ2 i=0
𝑦−1 − 2𝑦0 + 𝑦1 = 0
𝑦−1 = −𝑦1 1.18
(1) = 𝑦4 = 0 1.19
𝑦 ′ (1) = 𝑦 ′ = *𝑦i+1−𝑦i−1 + =0
4 2ℎ i=4
𝑦5 = 𝑦3 1.20
Putting i = 1, 2, 3 in Eq. 1.16, using conditions 1.17, 1.18, 1.19, 1.20, we get
79 𝑦 − 4𝑦2 + 𝑦3 = 1
1
16 1024
−4𝑦1 + 95 𝑦2 − 4𝑦3 = 1
16 512
111 3
𝑦1 − 4𝑦2 + 𝑦3 =
16 1024
Solving these above equations, we get
𝑦1 = (0.25) = 0.00255, 𝑦2 = 𝑦(0.5) = 0.0034 𝑦1 = 𝑦(0.75) = 0.00202
Exercise Problems
2
The boundary value problem is 𝑑 𝑦 = 𝑒𝑥2 with (0) = 0 and (1) = 0 . Estimate the
𝑑𝑥 2
values of 𝑦(𝑥) at 𝑥 = 0.25, 0.5 and 0.75.
2
Solve the boundary value problem 𝑑 𝑦 − 𝑦 = 0 with (0) = 0 and (2) = 3.62686 .
𝑑𝑥 2
Taking ℎ = 0.5. Exact solution of this problem is = 𝑠i𝑛ℎ . Also calculate error at each
point.
Solve the boundary value problem 𝑦′′ + (1 − 𝑥)𝑦′ + 𝑥𝑦 = 𝑥 with 𝑦(0) = 0 and 𝑦 (1) =
0. Taking ℎ = 0.25.
Solve the boundary value problem 𝑦′′ − 14 𝑦′ + 𝑥3𝑦 = 2𝑥 with 𝑦(0) + 𝑦′(0) = 0 and
𝑥
(1) = 2, using finite difference method. Taking ℎ = 1/3.
Solve the boundary value problem (1 + 𝑥2)𝑦′′ − 𝑦 = 1 with 𝑦′(0) = 0 and 𝑦(1) = 0,
using finite difference method. Taking ℎ = 1/3.
Solve the boundary value problem 𝑢′′ = 𝑥𝑢 with (0) + 𝑢′(0) = 1 and 𝑢(1) = 1, using
finite difference method. Taking ℎ = 1/3.
Solve the boundary value problem defined by
𝑦′𝑣 = 𝑥, 0 ≤ 𝑥 ≤ 1, for (𝑥i), 𝑥i = 0.25, 0.5, 0.75, given that 𝑦(0) = 0, 𝑦′′(0) = 0 and
(1) = 0, 𝑦′(1) = 0 using finite difference method.
Find the truncation error of the following differential equation
𝑦′′ + 2𝑥𝑦′ + 5𝑦 = 𝑥 3
Find the truncation error of the following differential equation
𝑦′′ + (1 − 𝑥)′ + 𝑦 = 5𝑥
Find the truncation error of the following differential equation
𝑦′′ + (1 − 𝑥 2) = 1
Answers:
1.1 -0.1175, -0.1684, -0.1391.
1.2 0.52635, 1.18428, 2.13829; 0.00525, 0.00908, 0.00901.
1.3 -0.0437, -0.06804, -0.0585.
1.4 0, 0.9941, -0.34302.
1.5 -0.3204, -0.2826, -0.1731
1.6 -0.9879518, -0.3253012, 0.3253012.
1.7 0.00231, 0.00311, 0.00186
Bibliography
Balagurusamy, E., Numerical Methods, McGraw Hill, New Delhi, 1999.
Hildebrand, F. B., Introduction of Numerical Analysis, McGraw Hill, New York, 1956.
Jain M. K., Iyengar S. R. and Jain R. K., Numerical Methods for Scientific and Engineering
Computation, Wiley Eastern Limited, New Delhi, 1985.
Levy, H. and Baggott, E. A., Numerical Solution of Differential Equations, Dover, New York,
1950.
Sastry, S. S., Engineering Mathematics, 3rd eds., Vols., 1 and 2, Prentice-Hall of India, New
Delhi, 2004.
Sastry, S. S., Introductory Methods of Numerical Analysis, PHI, Fifth Edition, New Delhi, 2012.
Scheid, Francis, Theory and Problems of Numerical Analysis, Schaum Series, McGraw Hill,
New York, 1968.