0% found this document useful (0 votes)
179 views52 pages

Numerical Methods

The document discusses boundary value problems (BVPs) in ordinary differential equations. It explains that BVPs involve boundary conditions that prescribe the solution at two different values of x, while initial value problems specify conditions at a single value of x. The key points are: 1) BVPs may or may not have a solution, while initial value problems always have a unique solution. 2) The finite difference method can be used to approximate derivatives and solve BVPs, replacing derivatives with finite difference approximations. 3) This leads to a system of equations that can be solved for the unknown values of y at each point, subject to the known boundary conditions.

Uploaded by

vishnu
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)
179 views52 pages

Numerical Methods

The document discusses boundary value problems (BVPs) in ordinary differential equations. It explains that BVPs involve boundary conditions that prescribe the solution at two different values of x, while initial value problems specify conditions at a single value of x. The key points are: 1) BVPs may or may not have a solution, while initial value problems always have a unique solution. 2) The finite difference method can be used to approximate derivatives and solve BVPs, replacing derivatives with finite difference approximations. 3) This leads to a system of equations that can be solved for the unknown values of y at each point, subject to the known boundary conditions.

Uploaded by

vishnu
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/ 52

SOLUTION OF BOUNDARY VALUE PROBLEMS IN ORDINARY DIFFERENTIAL EQUATIONS

Consider a second order differential equation 𝐹 𝑥, 𝑦, 𝑦 ′ , 𝑦 ′′ = 0.

Its general solution contains two arbitrary constants. To determine these constants we need to
prescribe two conditions.

The conditions are called initial conditions if 𝑦 and 𝑦′ are specified at a certain value of 𝑥.

The differential equation together with the initial conditions is called the initial value problem.

If 𝑦 or 𝑦′ or their combination is prescribed at two different values of 𝑥, then the conditions


are called boundary conditions.

The differential equation together with the boundary conditions is called a boundary value
problem.
1
The solution of an initial value problem, in general, exists and is unique, but the solution of a
boundary value problem may exist or may not.

The following simple examples will illustrate this-

(1) 𝒚′′ + 𝒚 = 𝟎, 𝒚 𝟎 = 𝟎, 𝒚 𝝅 = 𝟏

Auxiliary equation, 𝑚2 + 1 = 0 ⇒ 𝑚 = ±𝑖

The general solution of DF is, 𝑦 = 𝐴 𝑐𝑜𝑠𝑥 + 𝐵𝑠𝑖𝑛𝑥

𝑦 0 = 0 ⇒ A = 0; solution is 𝑦 = 𝐵𝑠𝑖𝑛𝑥

𝑦(𝜋) = 1 ⇒ 1 = 𝐵 0 , which is not possible.

Hence the boundary value problem does not have a solution.

2
𝟐 𝒚′′ + 𝒚 = 𝟎, 𝒚 𝟎 = 𝟎, 𝒚 𝝅 =𝟎

The general solution of DF is, 𝑦 = 𝐴𝑐𝑜𝑠𝑥 + 𝐵𝑠𝑖𝑛𝑥

𝑦 0 = 0 ⇒ A = 0; and solution is 𝑦 = 𝐵𝑠𝑖𝑛𝑥

𝑦(𝜋) = 1 ⇒ 0 = 𝐵 0 .

Here 𝐴 = 0 𝑎𝑛𝑑 𝐵 is undeterminable.

Hence the boundary value problem has an infinite number of solutions, 𝒚 = 𝑩𝒔𝒊𝒏𝒙, Where 𝐵
is an arbitrary constant.

3
𝟑 𝒚′′ + 𝒚 = 𝟎, 𝒚 𝟎 = 𝟎, 𝒚 𝝅/𝟐 = 𝟏

The general solution of DF is, 𝑦 = 𝐴𝑐𝑜𝑠𝑥 + 𝐵𝑠𝑖𝑛𝑥

𝑦 0 = 0 ⇒ A = 0; and solution is 𝑦 = 𝐵𝑠𝑖𝑛𝑥

𝜋
𝑦 = 1 ⇒ 𝐵 = 1.
2

Hence the boundary value problem has the unique solutios, 𝒚 = 𝒔𝒊𝒏𝒙

4
To solve the boundary value problem of the form,

𝑝 𝑥 𝑦 ′′ + 𝑞 𝑥 𝑦 ′ + 𝑟 𝑥 𝑦 = 𝑓(𝑥) with boundary conditions 𝑦 𝑎 = 𝑦𝑎 and 𝑦 𝑏 = 𝑦𝑏 ,


we use finite difference method.
Method of finite differences:
𝑏−𝑎
Divide the interval 𝑎, 𝑏 into 𝑛 sub-intervals, each of length ℎ = .
𝑛
Let 𝑥𝑖 = 𝑎 + 𝑖ℎ, 𝑖 = 0, 1, 2, … , 𝑛, and let us use the following notation:-

𝑥0 = 𝑎 𝑥1 𝑥2 𝑥𝑖 𝑥𝑖+1 𝑥𝑛−1 𝑥𝑛 = b

𝑦 𝑥𝑖 = 𝑦𝑖 , 𝑦 ′ 𝑥𝑖 = 𝑦𝑖′ , 𝑦 ′′ 𝑥𝑖 = 𝑦𝑖′′ .

𝑝 𝑥𝑖 = 𝑝𝑖 , 𝑞 𝑥𝑖 = 𝑞𝑖 , 𝑟 𝑥𝑖 = 𝑟𝑖 , 𝑓 𝑥𝑖 = 𝑓𝑖

5
By Taylor’s series expansion,

ℎ2 ′′ ℎ3 ′′′
𝑦𝑖+1 = 𝑦 𝑥𝑖+1 = 𝑦 𝑥𝑖 + ℎ = 𝑦𝑖 + ℎ𝑦𝑖′ + 𝑦 + 𝑦𝑖 + … ______ (1)
2! 𝑖 3!

ℎ2 ′′ ℎ3 ′′′
𝑦𝑖−1 = 𝑦 𝑥𝑖−1 = 𝑦 𝑥𝑖 − ℎ = 𝑦𝑖 − ℎ𝑦𝑖′ + 𝑦 − 𝑦𝑖 + … ______ (2)
2! 𝑖 3!

1 ℎ
Eqn(1) gives 𝑦 ′ 𝑥𝑖 = 𝑦 𝑥𝑖 + ℎ − 𝑦 𝑥𝑖 − 𝑦 ′′ 𝑥𝑖 − ⋯
ℎ 2

1
i.e., 𝑦 ′ 𝑥𝑖 = 𝑦 𝑥𝑖 + ℎ − 𝑦 𝑥𝑖 +𝑂 ℎ

which is the forward difference approximation of 𝑦′(𝑥𝑖 ) with an error of the order ℎ.

′ 1
Similarly eqn(2) gives 𝑦 𝑥𝑖 = 𝑦 𝑥𝑖 − 𝑦 𝑥𝑖 − ℎ +𝑂 ℎ

which is the backward difference approximation of 𝑦′(𝑥𝑖 ) with an error of the order ℎ.
6
1
Eqn(1)-Eqn(2) ⟹ 𝑦′ 𝑥𝑖 = 𝑦 𝑥𝑖 + ℎ − 𝑦 𝑥𝑖 − ℎ + 𝑂(ℎ2 )
2ℎ

which is the central-difference approximation of 𝑦′(𝑥𝑖 ) with an error of the order ℎ2 .

Clearly this central difference approximation to 𝑦′(𝑥𝑖 ) is better than the forward or
backward difference approximations and hence should be preferred.

Yielding approximation,

′ 𝒚𝒊+𝟏 −𝒚𝒊−𝟏
𝒚𝒊 = with an error of the order ℎ2 .
𝟐𝒉
(3)

7
ℎ4 ′′′′
Eqn(1)+eqn(2) ⟹ 𝑦𝑖+1 + 𝑦𝑖−1 = 2𝑦𝑖 + ℎ2 𝑦𝑖′′ + 𝑦𝑖 + ⋯,
12

We get approximation as

𝒚𝒊+𝟏 −𝟐𝒚𝒊 +𝒚𝒊−𝟏


𝒚′′
𝒊 = with an error of the order ℎ2
𝒉𝟐
(4)

which is the central difference approximation of 𝑦 ′′ 𝑥𝑖 .

In finite difference method 𝑦′ and 𝑦′′ are replaced by the finite differences using eqns (3) and
(4).

8
Consider the two cases that arise while solving linear boundary value problems.

Case (1): The boundary conditions dot not involve 𝒚′

To solve the boundary value problem (BVP),

𝑝 𝑥 𝑦 ′′ + 𝑞 𝑥 𝑦 ′ + 𝑟 𝑥 𝑦 = 𝑓(𝑥) with boundary conditions 𝑦 𝑎 = 𝑦𝑎 and 𝑦 𝑏 = 𝑦𝑏 .

We set 𝑥 = 𝑥𝑖 in BVP and replace 𝑦𝑖 ′ and 𝑦𝑖 ′′ by the approximations eqn(3) and (4) and we get
the system of equations

𝑝𝑖 𝑦𝑖′′ + 𝑞𝑖 𝑦𝑖′ + 𝑟𝑖 𝑦𝑖 = 𝑓𝑖

𝑦𝑖+1 −2𝑦𝑖 +𝑦𝑖−1 𝑦𝑖+1 −𝑦𝑖−1


⟹ 𝑝𝑖 + 𝑞𝑖 + 𝑟𝑖 𝑦𝑖 = 𝑓𝑖 _______ (5)
ℎ2 2ℎ

with 𝑖 = 1, 2, 3, … , 𝑛 − 1 for the 𝑛 − 1 unknowns 𝑦1 , 𝑦2 , … , 𝑦𝑛−1 .


9
The system (5) involves 𝑦0 for 𝑖 = 1 and 𝑦𝑛 for 𝑖 = 𝑛 − 1. However these are known from the
boundary conditions as 𝑦0 = 𝑦 𝑎 = 𝑦𝑎 and 𝑦𝑛 = 𝑦 𝑏 = 𝑦𝑏 .

Examples:

1) Solve 𝒙 𝒚′′ + 𝒚 =0, 𝒚 𝟏 = 𝟏, 𝒚 𝟐 = 𝟐 with 𝒉 = 𝟎. 𝟐𝟓 by finite difference method.

Answer: With ℎ = 0.25, 𝑛 = 4


𝑦0 = 1 𝑦1 =? 𝑦2 =? 𝑦3 =? 𝑦4 = 2

i.e., Divide the interval [1, 2] into 4 equal parts


𝑥0 = 1 𝑥1 = 1.25 𝑥2 = 1.5 𝑥3 = 1.75 𝑥4 = 2

We find the unknowns 𝑦1 , 𝑦2 , 𝑦3 from the system,

𝑦𝑖+1 − 2𝑦𝑖 + 𝑦𝑖−1


𝑥𝑖 2
+ 𝑦𝑖 = 0

10
𝑦𝑖+1 − 2𝑦𝑖 + 𝑦𝑖−1
𝑥𝑖 2 + 𝑦𝑖 = 0
1
4

16𝑥𝑖 𝑦𝑖+1 − 2𝑦𝑖 + 𝑦𝑖−1 + 𝑦𝑖 = 0, 𝑖 = 1, 2, 3


At 𝑖 = 1,
16𝑥1 𝑦2 − 2𝑦1 + 𝑦0 + 𝑦0 = 0

16 1.25 𝑦2 − 2𝑦1 + 1 + 1 = 0

⟹ 𝟑𝟗𝒚𝟏 − 𝟐𝟎𝒚𝟐 = 𝟐𝟎 _____ (1)

11
At 𝑖 = 2,
16𝑥2 𝑦3 − 2𝑦2 + 𝑦1 + 𝑦1 = 0

16 1.5 𝑦3 − 2𝑦2 + 𝑦1 + 𝑦1 = 0

⟹ 𝟐𝟒𝒚𝟏 − 𝟒𝟕𝒚𝟐 + 𝟐𝟒𝒚𝟑 = 𝟎 _____ (2)


At 𝑖 = 3,
16𝑥3 𝑦4 − 2𝑦3 + 𝑦2 + 𝑦2 = 0

16 1.75 2 − 2𝑦3 + 𝑦2 + 𝑦2 = 0

⟹ 𝟐𝟖𝒚𝟐 − 𝟓𝟓𝒚𝟑 = −𝟓𝟔 _____ (3)

Solving equations (1), (2) and (3), We get 𝒚𝟏 = 𝟏. 𝟑𝟓𝟏𝟑, 𝒚𝟐 = 𝟏. 𝟔𝟑𝟒𝟗, 𝒚𝟑 = 𝟏. 𝟖𝟓𝟎𝟖

12
𝟏 𝟏
2) Solve 𝒚′′ − 𝒙𝒚′ + 𝒚 = 𝟏, 𝒚 𝟎 = 𝟎, 𝒚 𝟏 =0 with 𝒉 = by finite difference method.
𝟒 𝟑

1
Answer: With ℎ = , 𝑛 = 3
3

i.e., Divide the interval [0, 1] into 3 equal parts


𝑦1 =? 𝑦2 =? 𝑦3 = 0
𝑦0 = 0

𝑥0 = 0 1 2 𝑥3 = 1
𝑥1 = 𝑥2 =
We find the unknowns 𝑦1 , 𝑦2 from the system, 3 3
1
𝑦 ′′ − 𝑥𝑦 ′ + 𝑦 = 1 ⟹ 𝑦𝑖′′ − 4𝑥𝑖 𝑦𝑖′ + 4𝑦𝑖 = 4
4

𝑦𝑖+1 − 2𝑦𝑖 + 𝑦𝑖−1 𝑦𝑖+1 − 𝑦𝑖−1


2
− 4𝑥𝑖 + 𝑦𝑖 = 4
ℎ 2ℎ

13
𝑦𝑖+1 − 2𝑦𝑖 + 𝑦𝑖−1 𝑦𝑖+1 − 𝑦𝑖−1
⟹ − 4𝑥𝑖 + 𝑦𝑖 = 4
1 2
9 3
⟹ 9 𝑦𝑖+1 − 2𝑦𝑖 + 𝑦𝑖−1 − 6𝑥𝑖 𝑦𝑖+1 − 𝑦𝑖−1 + 4𝑦𝑖 = 4, 𝑖 = 1, 2

When 𝑖 = 1,

1
9 𝑦2 − 2𝑦1 + 𝑦0 −6 𝑦2 − 𝑦0 + 4𝑦1 = 4
3

9 𝑦2 − 2𝑦1 + 0 − 2 𝑦2 − 0 + 4𝑦1 = 4

−𝟏𝟒𝒚𝟏 + 𝟕𝒚𝟐 = 𝟒 ________ (1)

14
When 𝑖 = 2,

2
9 𝑦3 − 2𝑦2 + 𝑦1 −6 𝑦3 − 𝑦1 + 4𝑦2 = 4
3

9 𝑦2 − 2𝑦1 + 0 − 2 𝑦2 − 0 + 4𝑦1 = 4

𝟏𝟑𝒚𝟏 − 𝟏𝟒𝒚𝟐 = 𝟒 ________ (2)

𝟒 𝟑𝟔
Solving equations (1) and (2), We get 𝒚𝟏 = − , 𝒚𝟐 = −
𝟓 𝟑𝟓

15
Case (2): The boundary conditions involve 𝒚′

Examples:

(1) Solve 𝒚′′ + 𝒙𝒚 = 𝟏, 𝒚 𝟎 = 𝟎, 𝒚′ 𝟏 = 𝟏 with 𝒉 = 𝟎. 𝟓 by finite difference method

Answer: With ℎ = 0.5, 𝑛 = 2 𝑦0 = 0 𝑦1 =? 𝑦2 =?

𝑥0 = 0 𝑥1 = 0.5 𝑥2 = 1
i.e., Divide the interval [0, 1] into 2 equal parts
We find the unknowns 𝑦1 , 𝑦2 from the system,

𝑦𝑖′′ + 𝑥𝑖 𝑦𝑖 = 1, 𝑖 = 1, 2

𝑦𝑖+1 − 2𝑦𝑖 + 𝑦𝑖−1


2
+ 𝑥𝑖 𝑦𝑖 = 1

16
𝑦𝑖+1 − 2𝑦𝑖 + 𝑦𝑖−1
2 + 𝑥𝑖 𝑦𝑖 = 1
1
2
4 𝑦𝑖+1 − 2𝑦𝑖 + 𝑦𝑖−1 + 𝑥𝑖 𝑦𝑖 = 1, 𝑖 = 1, 2

When 𝑖 = 1
4 𝑦2 − 2𝑦1 + 𝑦0 + 𝑥1 𝑦1 = 1
4 𝑦2 − 2𝑦1 + 0 + (0.5)𝑦1 = 1

−7.5𝑦1 + 4𝑦2 = 1 _______ (1)

When 𝑖 = 2
4 𝑦3 − 2𝑦2 + 𝑦1 + 𝑥2 𝑦2 = 1

17
4 𝑦3 − 2𝑦2 + 𝑦1 + 1 𝑦2 = 1 _______ (2)

Here the problem involves 𝑦3 , the value of 𝑦 outside the given interval.

Equation (2) will enable us to find 𝑦3 in terms of 𝑦1 𝑎𝑛𝑑 𝑦2 as follows,

Given the boundary condition 𝑦 ′ 1 = 1 ⟹ 𝑦 ′ 𝑥2 = 1 (∵ 𝑥2 = 1)


⟹ 𝑦2′ = 1
𝑦𝑖+1 −𝑦𝑖−1
We know that, 𝑦𝑖′ =
2ℎ

𝑦3 −𝑦1
⟹ 𝑦2′ = 1
2 2

⟹ 1 = y3 − y1 or 𝑦3 = 1 + 𝑦1

18
Now equation (2)⟹ 4 1 + 𝑦1 − 2𝑦2 + 𝑦1 + 1 𝑦2 = 1

8𝑦1 − 7𝑦2 = −3 _____ (3)

10 29
Solving equations (1) and (3), we get, 𝑦1 = , 𝑦2 =
41 41

(2) Solve 𝒚′′ + 𝟏 + 𝒙 𝒚′ − 𝒚 = 𝟎, 𝒚 𝟎 = 𝒚′ 𝟎 , 𝒚 𝟏 + 𝒚′ 𝟏 = 𝟏 with 𝒉 = 𝟎. 𝟓 by finite


difference method.

Answer: With ℎ = 0.5, 𝑛 = 2


𝑦0 =? 𝑦1 =? 𝑦2 =?
i.e., Divide the interval [0, 1] into 2 equal parts
𝑥0 = 0 𝑥1 = 0.5 𝑥2 = 1

19
We find the unknowns 𝑦1 , 𝑦2 from the system,
𝑦𝑖′′ + 1 + 𝑥𝑖 𝑦𝑖′ − 𝑦𝑖 = 0, 𝑖 = 0, 1, 2

𝑦𝑖+1 − 2𝑦𝑖 + 𝑦𝑖−1 𝑦𝑖+1 − 𝑦𝑖−1


2
+ 1 + 𝑥𝑖 − 𝑦𝑖 = 0
ℎ 2ℎ
4(𝑦𝑖+1 − 2𝑦𝑖 + 𝑦𝑖−1 ) + (1 + 𝑥𝑖 ) [𝑦𝑖+1 − 𝑦𝑖−1 ] − 𝑦𝑖 = 0, 𝑖 = 0, 1, 2
When 𝑖 = 0,
4(𝑦1 − 2𝑦0 + 𝑦−1 ) + (1 + 𝑥0 ) [𝑦1 − 𝑦−1 ] − 𝑦0 = 0 ---- (1)

Here the problem involves 𝑦−1 , the value of 𝑦 outside the given interval.
Given boundary condition 𝑦 0 = 𝑦 ′ 0

𝑦 𝑥0 = 𝑦 ′ 𝑥0 ∵ 𝑥0 = 0

𝑦0 = 𝑦0′
20
𝑦𝑖+1 −𝑦𝑖−1
We know that, 𝑦𝑖′ =
2ℎ

𝑦1 −𝑦−1
𝑦0 =
2(0.5)

𝑦0 = 𝑦1 − 𝑦−1 ⟹ 𝑦−1 = 𝑦1 − 𝑦0

Now equation (1) ⟹ 4(𝑦1 − 2𝑦0 + 𝑦1 − 𝑦0 ) + (1 + 0) [𝑦1 − (𝑦1 − 𝑦0 )] − 𝑦0 = 0

𝟐𝒚𝟏 − 𝟑𝒚𝟎 = 𝟎_______ (2)


When 𝑖 = 1,

4(𝑦2 − 2𝑦1 + 𝑦0 ) + (1 + 𝑥1 ) [𝑦2 − 𝑦0 ] − 𝑦1 = 0

4(𝑦2 − 2𝑦1 + 𝑦0 ) + (1 + 0.5) [𝑦2 − 𝑦0 ] − 𝑦1 = 0

𝟏𝟏𝒚𝟐 − 𝟏𝟖𝒚𝟏 + 𝟓𝒚𝟎 = 𝟎 ---- (3)


21
When 𝑖 = 2,

4(𝑦3 − 2𝑦2 + 𝑦1 ) + (1 + 𝑥2 ) [𝑦3 − 𝑦1 ] − 𝑦2 = 0

4(𝑦3 − 2𝑦2 + 𝑦1 ) + (1 + 1) [𝑦3 − 𝑦1 ] − 𝑦2 = 0 ---- (4)


Here the problem involves 𝑦3 , the value of 𝑦 outside the given interval.

Given another boundary condition 𝑦 1 + 𝑦 ′ 1 = 1

𝑦 𝑥2 + 𝑦 ′ 𝑥2 = 1 ∵ 𝑥2 = 1
𝑦2 + 𝑦2′ = 1
𝑦𝑖+1 − 𝑦𝑖−1
𝑦3 − 𝑦1 ∵ 𝑦𝑖′ =
𝑦2 + =1 2ℎ
2 0.5
𝑦3 = 1 + 𝑦1 − 𝑦2

22
Now equation (4) ⟹
4(1 + 𝑦1 − 𝑦2 − 2𝑦2 + 𝑦1 ) + (1 + 1) [1 + 𝑦1 − 𝑦2 − 𝑦1 ] − 𝑦2 = 0
𝟏𝟓𝒚𝟐 − 𝟖𝒚𝟏 = 𝟔 −− −(𝟓)

Solving equations (2), (3) and (5), we get,

𝟏 𝟏 𝟐
𝒚𝟎 = , 𝒚𝟏 = , 𝒚𝟐 =
𝟑 𝟐 𝟑

23
Exercises:

Solve the following boundary value problems by finite difference method.

1. 𝑦 ′′ − 3𝑦 ′ + 2𝑦 = 1 + 2𝑥, 𝑦 1 = 𝑦 2 = 0, ℎ = 0.25

𝜋 𝜋
2. 𝑦 ′′ + 𝑦 = 0, 𝑦 0 = 0, 𝑦 2
= 1, ℎ =
8

1
3. 𝑦 ′′ + 𝑥𝑦 ′ − 2𝑦 = 0, 𝑦 1 = 𝑦 ′ 1 , 𝑦 2 = 5, ℎ = 2

1
4. 𝑦 ′′ = 𝑥𝑦, 𝑦 0 + 𝑦 ′ 0 = 1, 𝑦 1 = 1, ℎ = 2

24
Partial Differential Equations
Boundary value problems governed by linear second order partial differential equations:
Over a two dimensional Cartesian domain, let 𝑢 be the dependent variable. Then a general second
order partial differential equation may be written as,

𝜕2 𝑢 𝜕2 𝑢 𝜕2 𝑢
𝐴 2 + 𝐵 + 𝐶 2 + 𝐹 𝑥, 𝑦, 𝑢, 𝑢𝑥 , 𝑢𝑦 + 𝐺 = 0 ----------------------(1)
𝜕𝑥 𝜕𝑥𝜕𝑦 𝜕𝑦

where 𝐴, 𝐵, 𝐶 are functions of (𝑥, 𝑦) and 𝐹 may be non-linear function, then equation (1) is called a
quasi-linear partial differential equation. If 𝐹 is also a linear function then equation (1) is called a
linear partial differential equation. If 𝐺 = 0 then equation (1) is homogeneous otherwise non-
homogeneous.

Classification of PDE:

Equation (1) at a point or in a domain is said to be,

Elliptic if 𝐵2 − 4𝐴𝐶 < 0; Parabolic if 𝐵2 − 4𝐴𝐶 = 0; Hyperbolic if 𝐵2 − 4𝐴𝐶 > 0.


Examples:

𝜕2 𝑢 𝜕2 𝑢
1. 𝜕𝑥 2
+
𝜕𝑦 2
= 𝑓 𝑥, 𝑦 is called Poisson equation is an elliptic equation

𝜕2 𝑢 𝜕 𝑢 2
2. = 𝑐2 2 , is called wave equation is hyperbolic equation
𝜕𝑡 2 𝜕𝑥

𝜕u 𝜕 u 2
3. = c2 2 , is called heat equation is parabolic equation
𝜕t 𝜕x

𝜕2 𝑢 𝜕2 𝑢 𝜕2 𝑢 𝜕𝑢 𝜕𝑢
4. 𝜕𝑥 2
+ 4
𝜕𝑥𝜕𝑦
+ 4 2
𝜕𝑦

𝜕𝑥
+2
𝜕𝑦
= 0, is parabolic equation

2 𝜕2 𝑢 𝜕2 𝑢 𝜕2 𝑢
5. 1 + 𝑥 + 5+ 2𝑥 2 + 4+ 𝑥 2 = 0, is Hyperbolic equation.
𝜕𝑥 2 𝜕𝑥𝜕𝑡 𝜕𝑡 2
Finite Difference Methods for Partial Differential Equation:

Consider a rectangular region 𝑅 in the 𝑋𝑌 −plane. Divide the region into rectangular network

of sides Δ𝑥 = ℎ and Δ𝑦 = 𝑘 by drawing lines 𝑥 = 𝑖ℎ and 𝑦 = 𝑗𝑘, where 𝑖, 𝑗 = 0,1,2,3, …


Points of intersection are called nodal points or mesh points or grid points.
Writing 𝑢 𝑥, 𝑦 = 𝑢(𝑖ℎ, 𝑗𝑘) as simply 𝑢𝑖,𝑗 , the finite difference approximations for the first order

partial derivatives can be derived using Taylor series expansion for 2 variables as follows.

ℎ2
We have, 𝑢 𝑥 + ℎ, 𝑦 = 𝑢𝑖+1,𝑗 = 𝑢 𝑥, 𝑦 + ℎ𝑢𝑥 𝑥, 𝑦 + 𝑢 𝑥, 𝑦 + ⋯ -----------(2)
2! 𝑥𝑥

Thus, the forward difference formula can be written as,

𝜕𝑢 1
= 𝑢𝑖+1,𝑗 − 𝑢𝑖,𝑗 + 𝑂 ℎ -----------(3)
𝜕𝑥 𝑖,𝑗 ℎ
ℎ2
Similarly, 𝑢 𝑥 − ℎ, 𝑦 = 𝑢𝑖−1,𝑗 = 𝑢 𝑥, 𝑦 − ℎ𝑢𝑥 𝑥, 𝑦 + 𝑢 𝑥, 𝑦 + ⋯ -----------(4)
2! 𝑥𝑥

Thus, the backward difference formula can be written as,

𝜕𝑢 1
= 𝑢𝑖,𝑗 − 𝑢𝑖−1,𝑗 + 𝑂 ℎ -----------(5)
𝜕𝑥 𝑖,𝑗 ℎ

The central difference formula can be obtained by Eq.(2) –Eq.(4) as,

𝜕𝑢 1
= 𝑢𝑖+1,𝑗 − 𝑢𝑖−1,𝑗 + 𝑂 ℎ2 -----------(6)
𝜕𝑥 𝑖,𝑗 2ℎ
The finite difference approximations for the second order partial derivatives can be obtained by adding
Eq.(2) and (4).
𝜕2 𝑢 1
= 𝑢𝑖+1,𝑗 − 2𝑢𝑖,𝑗 + 𝑢𝑖−1,𝑗 + 𝑂 ℎ2 -----------(7)
𝜕𝑥 2 𝑖,𝑗 ℎ2

Similarly,
𝜕𝑢 1
Forward: = 𝑢𝑖,𝑗+1 − 𝑢𝑖,𝑗 + 𝑂(𝑘) -----------(8)
𝜕𝑦 𝑖,𝑗 𝑘

𝜕𝑢 1
Backward: = 𝑢𝑖,𝑗 − 𝑢𝑖,𝑗−1 + 𝑂 𝑘 -----------(9)
𝜕𝑦 𝑖,𝑗 𝑘

𝜕𝑢 1
Central: = 𝑢𝑖,𝑗+1 − 𝑢𝑖,𝑗−1 + 𝑂 𝑘 2 ----------(10)
𝜕𝑦 𝑖,𝑗 2𝑘

𝜕2 𝑢 1
And = 𝑢𝑖,𝑗+1 − 2𝑢𝑖,𝑗 + 𝑢𝑖,𝑗−1 + 𝑂 𝑘 2 ----------(11)
𝜕𝑦 2 𝑖,𝑗 𝑘2

Replacing the derivatives in any partial differential equation by their corresponding difference
approximation, we obtain the finite-difference analogues of the given equation.
Elliptic partial differential equation:

Most relevant examples of elliptic PDE are Laplace equation and Poisson equation.

The Poisson equation in Cartesian coordinate system is

𝜕2 𝑢 𝜕2 𝑢
+ = 𝑓 𝑥, 𝑦 or 𝛻 2 𝑢 = 𝑓 𝑥, 𝑦 , 𝑎 ≤ 𝑥 ≤ 𝑏, 𝑐 ≤ 𝑦 ≤ 𝑑
𝜕𝑥 2 𝜕𝑦 2

Subject to boundary condition: 𝑢(𝑥, 𝑦) = 𝑔(𝑥, 𝑦) (Dirichlet boundary condition).

The Laplace equation is a special case of Poisson equation with 𝑓 𝑥, 𝑦 = 0.


Solution for Laplace Equation
𝜕2 𝑢 𝜕2 𝑢
+ =0 ----------(12)
𝜕𝑥 2 𝜕𝑦 2

Consider a rectangular region 𝑅 for which 𝑢(𝑥, 𝑦) is known at the boundary. Divide this region into
a network of square mesh of side ℎ (assuming that an exact division of 𝑅 is possible.

Figure-2. Figure-3.
Replacing the derivatives in (12) by their difference approximations, we have

1 1
𝑢 − 2𝑢𝑖,𝑗 + 𝑢𝑖−1,𝑗 + 2 𝑢𝑖,𝑗+1 − 2𝑢𝑖,𝑗 + 𝑢𝑖,𝑗−1 = 0
ℎ2 𝑖+1,𝑗 ℎ
1
Or 𝑢𝑖,𝑗 = 𝑢𝑖+1,𝑗 + 𝑢𝑖−1,𝑗 + 𝑢𝑖,𝑗+1 + 𝑢𝑖,𝑗−1 ----------(13)
4

This shows that the value of 𝑢 at any interior mesh point is the average of its values at four
neighboring points to the left, right, above and below. Equation (13) is called standard 5-point
formula as shown in figure-2.
Sometimes a formula similar to this is used which is given by,

1
𝑢𝑖,𝑗 = (𝑢𝑖−1,𝑗+1 + 𝑢𝑖+1,𝑗−1 + 𝑢𝑖+1,𝑗+1 + 𝑢𝑖−1,𝑗−1 ) ----------(14)
4

Which shows that the value of 𝑢 at any interior mesh point is the average of its values at four
neighboring diagonal mesh points. Equation (14) is also called the diagonal 5-point formula as
shown in figure-3. Although this is less accurate than the standard 5-point formula, it is used in
getting a good approximation for the starting values at the mesh points.
By applying 5-point formula at each interior mesh point, we arrive at linear equations in the nodal
values 𝑢𝑖,𝑗 . These equations can be solved by Jacobi’s iterative method or Gauss-Seidal iterative
method. The iterative methods are repeated till the difference between two consecutive iterates become
negligible.
𝑛
1. Jacobi’s method: Denoting the 𝑛𝑡ℎ iterative value of 𝑢𝑖,𝑗 by 𝑢𝑖,𝑗 , the iterative formula to solve is,
(𝑛+1) 1 (𝑛) (𝑛) (𝑛) (𝑛)
𝑢𝑖,𝑗 = 𝑢𝑖+1,𝑗 + 𝑢𝑖−1,𝑗 + 𝑢𝑖,𝑗+1 + 𝑢𝑖,𝑗−1 ----------(15)
4

It gives improved values of 𝑢𝑖,𝑗 at the interior mesh points.

1. Gauss-Seidal method or Leibmann’s method: In this method, the iteration formula is,
(𝑛+1) 1 (𝑛) (𝑛+1) (𝑛+1) (𝑛)
𝑢𝑖,𝑗 = 𝑢𝑖+1,𝑗 + 𝑢𝑖−1,𝑗 + 𝑢𝑖,𝑗+1 + 𝑢𝑖,𝑗−1 ----------(16)
4

This utilizes the latest iterative values available and evaluates the mesh points symmetrically from
left to right along successive rows.
Note:

 The accuracy of the calculations depends on the mesh-size i.e. smaller the 𝒉, better the

accuracy. But if 𝒉 is too small, it increases the computations.

 The error in solving Laplace and Poisson’s equations by finite-difference method is of the

order 𝒐 𝒉𝟐 .
Solved examples:
𝝏𝟐 𝒖 𝝏𝟐 𝒖 𝟏
1. Solve + 𝟐 = 𝟎, with 𝒉 = , 𝒖 𝒙, 𝟏 = 𝒖 𝟎, 𝒚 = 𝟎, 𝟎 < 𝒙, 𝒚 < 𝟏 and also 𝒖 𝒙, 𝟎 = 𝟗 𝒙 − 𝒙𝟐 ,
𝝏𝒙𝟐 𝝏𝒚 𝟑
𝒖 𝟏, 𝒚 = 𝟗 𝒚 − 𝒚𝟐 .

Solution: Solution is symmetric about principal


diagonal as shown in figure. Using 5-point formula at
each of the unknown mesh points, we have,

4𝑎 = 𝑏 + 𝑑 + 2

4𝑏 = 2𝑎 + 4

4𝑑 = 2𝑎

Solving for unknowns,

𝑎 = 𝑐 = 1; 𝑏 = 1.5; 𝑑 = 0.5
𝝏𝟐 𝒖 𝝏𝟐 𝒖 𝟏
2. Solve + 𝟐 = 𝟎, with 𝒉 = , 𝒖 𝒙, 𝟎 = 𝒖 𝒙, 𝟏 = 𝟎, 𝟎 < 𝒙, 𝒚 < 𝟏 and also 𝒖 𝟎, 𝒚 =
𝝏𝒙𝟐 𝝏𝒚 𝟒

𝟏𝟎𝟎, 𝒖 𝟏, 𝒚 = 𝟎 using Leibmann’s method.

Solution: With reference to the figure, we have equations


in 6 unknowns.
4𝑎 = 100 + 𝑏 + 𝑑
4𝑏 = 𝑎 + 𝑒 + 𝑐
4𝑐 = 𝑏 + 𝑓
4𝑑 = 100 + 2𝑎 + 𝑒
4𝑒 = 2𝑏 + 𝑑 + 𝑓
4𝑓 = 2𝑐 + 𝑒
Solving using Leibmann’s method or Gauss seidal
method(3 iterations),
𝑎 𝑏 𝑐 𝑑 𝑒 𝑓
0 0 0 0 0 0
25 6.25 1.5625 37.5 12.5 0.78125
35.9375 12.5 3.3203 46.09375 17.96875 6.1523 and so on.
Exercise problems:

𝟏
1. Solve Laplace equation 𝛁𝟐 𝒖 = 𝟎, 𝟎 < 𝒙, 𝒚 < 𝟐, with 𝒉 = , 𝒖 𝒙, 𝟎 = 𝟎, 𝒖 𝒙, 𝟐 = 𝟔,
𝟐

𝒖 𝟎, 𝒚 = 𝟏, 𝒖 𝟐, 𝒚 = 𝟏.
𝟏
2. Solve 𝛁𝟐 𝒖 = 𝟎, 𝒙 < 𝟏, 𝒚 < 𝟏, 𝒉 = . Also, 𝒖 ±𝟏, 𝒚 = 𝒚𝟐 , 𝒖 𝒙, ±𝟏 = 𝒙𝟐 .
𝟐

3. Solve 𝛁𝟐 𝒖 = 𝟎, 𝟎 < 𝒙, 𝒚 < 𝟒, with 𝒉 = 𝟏,𝒖 𝒙, 𝟎 = 𝒙𝟐 + 𝟐𝒙, 𝒖 𝟎, 𝒚 = −𝟐𝒚 − 𝒚𝟐 , 𝒖 𝟒, 𝒚 =


𝟐𝟒 − 𝒚𝟐 − 𝟐𝒚, 𝒖 𝒙, 𝟒 = 𝒙𝟐 + 𝟐𝒙 − 𝟐𝟒.
(Hint: Negative symmetry to be considered. Number of variables reduces to six.)
Poisson Equation
The Poisson equation is an elliptic partial differential equation that frequently
emerges when modeling electromagnetic systems. However, like many other partial
differential equations, exact solutions are difficult to obtain for complex
geometries. This motivates the use of numerical methods in order to provide
accurate results for real-world systems. One very simple algorithm is the Finite-
Difference Method (FDM), which works by replacing the continuous derivative
operators with approximate finite differences. Although the Finite-Difference
Method is one of the oldest methods ever devised, comprehensive information is
difficult to find compiled in a single reference.
• Poisson differential equation is
𝜕2 𝑢 𝜕2 𝑢
+ = 𝑓 𝑥, 𝑦 ---------- (1)
𝜕𝑥 2 𝜕𝑦 2
• Its method of solution is similar to that of Laplace equation. Here the
standard 5-point formula takes the form,
𝑢𝑖−1,𝑗 + 𝑢𝑖+1,𝑗 + 𝑢𝑖,𝑗+1 + 𝑢𝑖,𝑗−1 − 4𝑢𝑖,𝑗 = ℎ2 𝑓(𝑖ℎ, 𝑗ℎ) ---------- (2)
By applying formula (2) at each interior mesh point, we arrive at linear
equations in the nodal values 𝑢𝑖,𝑗 . These equations can be solved by
Gauss-Seidal iterative method. The iterative methods are repeated till the
difference between two consecutive iterates become negligible.
Examples:
𝝏𝟐 𝒖 𝝏𝟐 𝒖
1) With 𝒉 = 𝟏, solve + = −𝟏𝟎 𝒙𝟐 + 𝒚𝟐 + 𝟏𝟎 , 𝟎 < 𝒙, 𝒚 < 𝟑 and
𝝏𝒙𝟐 𝝏𝒚𝟐
𝒖 = 𝟎 on the boundary.
Solution: x 0 1 2 3
y 0 1 2 3

By five point formula,


1
𝑢1 = 4 𝑢2 + 𝑢3 + 150 −−−− − 1
1
𝑢2 = 𝑢1 + 𝑢4 + 180 −−−− −(2)
4
1
𝑢3 = 4 𝑢1 + 𝑢4 + 120 −−−− − 3
1
𝑢4 = 𝑢2 + 𝑢3 + 150 −−−− −(4)
4
From equation (1) and (4), 𝑢1 = 𝑢4 .
Hence equations becomes
4𝑢1 − 𝑢2 − 𝑢3 = 150, 4𝑢2 − 2𝑢1 = 180, 4𝑢3 − 2𝑢1 = 120.
By solving these equations we get,
𝑢1 = 𝑢4 = 75, 𝑢2 = 82.5, 𝑢3 = 67.5.
𝟏
2)Solve 𝛁 𝟐 𝒖
= −𝟖𝟏𝒙𝒚, 𝟎 < 𝒙, 𝒚 < 𝟏, 𝒉 = . Also, 𝒖 𝟎, 𝒚 = 𝒖 𝒙, 𝟎 = 𝟎,
𝟑
𝒖 𝟏, 𝒚 = 𝒖 𝒙, 𝟏 = 𝟏𝟎𝟎.
Solution:
x 0 1/3 2/3 1

y 0 1/3 2/3 1

By standard five point formula,


1
𝑢1 = 𝑢 + 𝑢3 + 102 −−−− −(1)
4 2
1
𝑢2 = 𝑢1 + 𝑢4 + 204 −−−− −(2)
4
1
𝑢3 = 4 𝑢1 + 𝑢4 + 1 −−−− − 3
1
𝑢4 = 𝑢2 + 𝑢3 + 102 −−−− −(4)
4
From equation (1) and (4), 𝑢1 = 𝑢4 .
Hence equations are:
4𝑢1 − 𝑢2 − 𝑢3 = 102, 2𝑢1 − 4𝑢2 = −204, 2𝑢1 − 4𝑢3 = −1
Solving theses equations, we get 𝑢1 = 𝑢4 = 51, 𝑢2 = 76, 𝑢3 = 26.

• Exercise problems:
1) Solve 𝛻 2 𝑢 = −1, 𝑥 < 2, 𝑦 < 2, ℎ = 1.
Also, 𝑢 −2, 𝑦 = 𝑢 𝑥, 2 =𝑢 2, 𝑦 = 𝑢 𝑥, −2 = 0.
2) Solve 𝛻 2 𝑢 = −1, 𝑥 < 2, 𝑦 < 2, ℎ = 1.
Also, 𝑢 −2, 𝑦 = 𝑢 𝑥, 2 =𝑢 2, 𝑦 = 𝑢 𝑥, −2 = 0.
1
3) Solve 𝛻2𝑢 = −1, 𝑥 < 1, 𝑦 < 1, ℎ = . Also, 𝑢 ±1, 𝑦 = 𝑢 𝑥, ±1 = 0.
2
Wave Equation

The wave equation is a second-order linear hyperbolic PDE that


describes the propagation of a variety of waves, such as sound or water
waves. It arises in different fields such as acoustics, electromagnetics,
or fluid dynamics.
The wave equation one dimension is of the form
𝜕2 𝑢 2 𝜕2 𝑢
=𝑐
𝜕𝑡 2 𝜕𝑡 2

46
Numerical Solution of Wave Equation
Consider the initial value problem

𝜕2 𝑢 2 𝜕2 𝑢
=𝑐 , a < x < b, t > 0 --------- (1)
𝜕𝑡 2 𝜕𝑡 2

𝑢
u(x , 0) = f(x), 𝑥, 0 = 𝑔 𝑥 −−−−−−− −(2)
𝑡
ut(a,t) = (x), u(b, t) = (x) -------- (3)

To solve by finite difference method, we divide the interval [a, b] into n


𝑏−𝑎
equal parts each of breadth h, i.e. h =
𝑛
47
Let 𝑥𝑖 = 𝑥0 + 𝑖ℎ [𝑥0 =a], i = 1, 2, …., n --------- (4)
If k is the time internal size, let
𝑡𝑗 = 𝑗𝑘 −−−−−− −(5)
Denote u(𝑥𝑖 , 𝑡𝑗 )=𝑢𝑖𝑗
We have
2 𝑢 𝑢𝑖+1𝑗 −2𝑢𝑖𝑗 +𝑢𝑖−1𝑗
= -------------------(6)
𝑥 2 ℎ 2

2 𝑢 𝑢𝑖𝑗+1−2𝑢𝑖𝑗 +𝑢𝑖𝑗−1
= ----------------------(7)
𝑡 2 𝑘2

48
Using (6) and (7) in (1), we get,

𝑢𝑖𝑗+1 −2𝑢𝑖𝑗 +𝑢𝑖𝑗−1 2 𝑢𝑖+1𝑗 −2𝑢𝑖𝑗 +𝑢𝑖−1𝑗


= 𝑐 ----------------(8)
𝑘2 ℎ2

If k = h/c, (8) simplifies to

𝑢𝑖𝑗+1 =𝑢𝑖+1𝑗 + 𝑢𝑖−1𝑗 − 𝑢𝑖𝑗−1 ----------------------(9)

This is the finite difference scheme for the wave equation.

If we know u at two consecutive time steps 𝑡𝑗 and 𝑡𝑗+1 , (9) gives u at


time t = 𝑡𝑗+1

49
From the initial conditions (2)

1
𝑢𝑖0 = 𝑓𝑖 , 𝑢𝑖1 = 𝑓𝑖−1 + 𝑓𝑖+1 + 𝑘𝑔𝑖
2

From the boundary conditions (3)

𝑢0𝑗 = 𝜑𝑗 , 𝑢𝑛𝑗 = 𝑗

50
Evaluate the pivotal values of the equation utt=16uxx, taking h =1 upto
t = 1.25. The boundary and initial conditions are
u(0, t)=u(5, t) = 0, u(x, 0)=x2(5-x), ut(x,0)=0.
Here c2= 16, h=1. We choose k = h/c=1/4
Finite difference scheme is
𝑢𝑖𝑗+1 =𝑢𝑖+1𝑗 + 𝑢𝑖−1𝑗 − 𝑢𝑖𝑗−1

51
52

You might also like