Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
144 views

Module - 5.1

This document discusses solving boundary value problems in ordinary differential equations using finite difference methods. It provides three examples: 1) Solving d2y/dx2 = x + y with boundary conditions y(0) = y(1) = 0 using a grid with 4 sub-intervals of width 0.25. The system is solved using Gauss elimination to get y1 = -0.0349, y2 = -0.0564, y3 = -0.0501. 2) Solving d2y/dx2 + x2y = 0 with boundary conditions y(0) = 0, y(1) = 1 using the same grid. Gauss elimination gives y1 =

Uploaded by

Harshit
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
144 views

Module - 5.1

This document discusses solving boundary value problems in ordinary differential equations using finite difference methods. It provides three examples: 1) Solving d2y/dx2 = x + y with boundary conditions y(0) = y(1) = 0 using a grid with 4 sub-intervals of width 0.25. The system is solved using Gauss elimination to get y1 = -0.0349, y2 = -0.0564, y3 = -0.0501. 2) Solving d2y/dx2 + x2y = 0 with boundary conditions y(0) = 0, y(1) = 1 using the same grid. Gauss elimination gives y1 =

Uploaded by

Harshit
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

Module - V

SOLUTION OF BOUNDARY VALUE PROBLEMS IN ORDINARY DIFFERENTIAL EQUATION


Formula:
The finite difference approximations to the derivatives are given by
yi+1 − yi−1
yi′ = and
2h
𝒚𝒊−𝟏 − 𝟐𝒚𝒊 + 𝒚𝒊+𝟏
𝒚𝒊 ′′ =
𝒉𝟐
Example 1:
𝐝𝟐 𝐲
Solve the equation 𝐝𝐱𝟐
= 𝒙 + 𝒚 with boundary conditions

𝒚(𝟎) = 𝒚(𝟏) = 𝟎 taking four sub-intervals. (or) taking ∆𝒙 = 𝟎. 𝟐𝟓


Solution:
d2 y
Given that = 𝑦 ′′ = 𝑥 + 𝑦; 𝑦(0) = 𝑦(1) = 0, 𝑛 = 4, here 𝑎 = 0 & 𝑏 = 1
dx2

To find ℎ?
𝑏−𝑎 1−0 1
We know thatℎ = = = 4 = 0.25
𝑛 4

Here, 𝑥0 = 0; 𝑥1 = 0.25; 𝑥2 = 0.5; 𝑥3 = 0.75; 𝑥4 = 1


𝑦0 = 0; 𝑦1 =? ; 𝑦2 =? ; 𝑦3 =? ; 𝑦4 = 0;
′′
Given equation𝒚 = 𝒙 + 𝒚 … … … … … [𝟏]
Apply finite difference scheme to [1], we get
𝒚𝒊 ′′ = 𝒙𝒊 + 𝒚𝒊 where𝑖 = 1,2,3
Using 𝑦𝑖 ′′ formula in the above equation, we get
𝑦𝑖−1 − 2𝑦𝑖 + 𝑦𝑖+1
= 𝑥𝑖 + 𝑦𝑖 … … … . [2], 𝑖 = 1,2,3
ℎ2

Put 𝑖 = 1 in [2] we get


𝑦0 − 2𝑦1 + 𝑦2
= 𝑥1 + 𝑦1
0.0625
⇒ (0 − 2𝑦1 + 𝑦2 ) = 0.0625(0.25 + 𝑦1 )
i.e.,𝑦2 − 2𝑦1 = 0.0156 + 0.0625𝑦1
𝑦2 − 2𝑦1 − 0.0625𝑦1 = 0.0156
𝑦2 − 2.0625𝑦1 = 0.0156 … … … … … [𝟑]

Put 𝑖 = 2 in [2], we get


𝑦1 − 2𝑦2 + 𝑦3
= 𝑥2 + 𝑦2
0.0625
𝑦1 − 2𝑦2 + 𝑦3 = 0.0625(0.5 + 𝑦2 )
𝑦1 − 2𝑦2 + 𝑦3 = 0.0313 + 0.0625𝑦2
𝑦3 − 2.0625𝑦2 + 𝑦1 = 0.0313 … … … … … . . [4]

Put 𝑖 = 3 in [2], we get


𝑦2 − 2𝑦3 + 𝑦4
= 𝑥3 + 𝑦3
0.0625
𝑦2 − 2𝑦3 + 0 = 0.0625(0.75 + 𝑦3)
𝑦2 − 2𝑦3 = 0.0469 + 0.0625𝑦3
𝑦2 − 2.0625𝑦3 = 0.0469 … … … … … . . [5]
Solution of the system by Gauss elimination method
The augmented matrix [𝐴 , 𝐵] is
−2.0625 1 0 0.0156
[𝐴 , 𝐵] = [ 1 −2.0625 1 0.0313 ]
0 1 −2.0625 0.0469
Solving by Gauss elimination method, we get
𝒚𝟏 = −𝟎. 𝟎𝟑𝟒𝟗; 𝒚𝟐 = −𝟎. 𝟎𝟓𝟔𝟒; 𝒚𝟑 = −𝟎. 𝟎𝟓𝟎𝟏
𝐝𝟐 𝐲
Example2 : By finite difference method,𝐝𝐱𝟐 + 𝒙𝟐 𝒚 = 𝟎 with the boundary conditions𝒚(𝟎) = 𝟎 𝒂𝒏𝒅 𝒚(𝟏) = 𝟏. choose 𝒉 = 𝟎. 𝟐𝟓

Solution:
d2 y
Given thatdx2 + 𝑥 2 𝑦 = 0 ⇒ 𝑦 ′′ = −𝑥 2 𝑦 ; 𝑦(0) = 0, 𝑦(1) = 1,

𝑎 = 0 & 𝑏 = 1 , ℎ = 0.25
Here,𝑥0 = 0; 𝑥1 = 0.25; 𝑥2 = 0.5; 𝑥3 = 0.75; 𝑥4 = 1
𝑦0 = 0; 𝑦1 =? ; 𝑦2 =? ; 𝑦3 =? ; 𝑦4 = 1;
d2 y
From given equationdx2 + 𝑥 2 𝑦 = 0

𝑦 ′′ = −𝑥 2 𝑦 … … … . . [𝟏]
Apply finite difference scheme to [1], we get
𝑦𝑖 ′′ = −𝑥𝑖 2 𝑦𝑖 where𝑖 = 1,2,3
Using 𝑦𝑖 ′′ formula in the above equation, we get
𝑦𝑖−1 − 2𝑦𝑖 + 𝑦𝑖+1
= −𝑥𝑖 2 𝑦𝑖 … … … . [𝟐], 𝑖 = 1,2,3
ℎ2

Put 𝑖 = 1 in [2] we get


𝑦0 − 2𝑦1 + 𝑦2
= −𝑥1 2 𝑦1
0.0625
⇒ (0 − 2𝑦1 + 𝑦2 ) = 0.0625[−(0.25)2 𝑦1 ]
i.e.,𝑦2 − 2𝑦1 = −0.0039𝑦1
𝑦2 − 2𝑦1 + 0.0039𝑦1 = 0
𝑦2 − 1.9961𝑦1 = 0 … … … … … [𝟑]

Put 𝑖 = 2 in [2], we get


𝑦1 − 2𝑦2 + 𝑦3
= −𝒙𝟐 𝟐 𝒚𝟐
0.0625
𝑦1 − 2𝑦2 + 𝑦3 = 0.0625[−(0.5)2 𝑦2 ]
𝑦1 − 2𝑦2 + 𝑦3 = −0.0156𝑦2
𝑦3 − 2.0625𝑦2 + 0.0156𝑦2 + 𝑦1 = 0
𝑦3 − 1.9844𝑦2 + 𝑦1 = 0 … … … … … … … [𝟒]

Put 𝑖 = 3 in [2], we get


𝑦2 − 2𝑦3 + 𝑦4
= −𝒙𝟑 𝟐 𝒚𝟑
0.0625
𝑦2 − 2𝑦3 + 1 = 0.0625[−(0.75)2 𝑦3]
𝑦2 − 2𝑦3 + 1 = −0.0352𝑦3
𝑦2 − 2𝑦3 + 0.0352𝑦3 = −1
𝑦2 − 1.9648𝑦3 = −1 … … … … … … . [𝟓]
Solution of the system by Gauss elimination method
The augmented matrix [𝐴 , 𝐵] is
−1.9961 1 0 0
[𝐴 , 𝐵] = [ 1 −1.9844 1 0]
0 1 −1.9648 −1
Solving by Gauss elimination method, we get
𝒚𝟏 = 𝟎. 𝟐𝟔𝟏𝟕; 𝒚𝟐 = 𝟎. 𝟓𝟐𝟐𝟑; 𝒚𝟑 = 𝟎. 𝟕𝟕𝟒𝟖
Example : 3
Solve the equation 𝐱𝒚′′ + 𝒚 = 𝟎 with boundary conditions
𝒚(𝟏) = 𝟏, 𝒚(𝟐) = 𝟐with𝒉 = 𝟎. 𝟐𝟓 by finite difference method.
Solution :
𝑦
Given that x𝑦 ′′ + 𝑦 = 0 ⇒ 𝑦 ′′ = − 𝑥 ; 𝑦(1) = 1, 𝑦(2) = 2, ℎ = 0.25

𝑎 = 1&𝑏 =2
We know that
Here,𝑥0 = 1; 𝑥1 = 1.25; 𝑥2 = 1.5; 𝑥3 = 1.75; 𝑥4 = 2
𝑦0 = 1; 𝑦1 =? ; 𝑦2 =? ; 𝑦3 =? ; 𝑦4 = 2;
′′
From given equationx𝑦 + 𝑦 = 0
𝑦
𝑦 ′′ = − … … … . . [1]
𝑥
Apply finite difference scheme to [1], we get
𝒚
𝒚𝒊 ′′ = − 𝒙𝒊 where𝑖 = 1,2,3
𝒊

′′
Using 𝑦𝑖 formula in the above equation, we get
𝑦𝑖−1 − 2𝑦𝑖 + 𝑦𝑖+1 𝑦𝑖
= − … … … . [𝟐], 𝑖 = 1,2,3
ℎ2 𝑥𝑖
Put 𝑖 = 1 in [2] we get
𝑦0 − 2𝑦1 + 𝑦2 𝑦1
=−
0.0625 𝑥1
𝑦1
⇒ (1 − 2𝑦1 + 𝑦2 ) = 0.0625 [− ]
1.25
i.e.,1 + 𝑦2 − 2𝑦1 = −0.05𝑦1
𝑦2 − 2𝑦1 + 0.05𝑦1 = −1
𝑦2 − 1.95𝑦1 = −1 … … … … … [𝟑]

Put 𝑖 = 2 in [2], we get


𝑦1 − 2𝑦2 + 𝑦3 𝑦2
=−
0.0625 𝑥2
𝒚𝟐
𝑦1 − 2𝑦2 + 𝑦3 = 0.0625 [− ]
1.5
𝑦1 − 2𝑦2 + 𝑦3 = −0.0417𝑦2
𝑦1 − 2𝑦2 + 𝑦3 + 0.0417𝑦2 = 0
𝑦3 − 1.9583𝑦2 + 𝑦1 = 0 … … … … … … … [𝟒]

Put 𝑖 = 3 in [2], we get


𝑦2 − 2𝑦3 + 𝑦4 𝒚𝟑
=−
0.0625 𝑥3
𝒚𝟑
𝑦2 − 2𝑦3 + 2 = 0.0625 [− ]
1.75
𝑦2 − 2𝑦3 + 2 = −0.0357𝑦3
𝑦2 − 2𝑦3 + 0.0357𝑦3 = −2
𝑦2 − 1.9643𝑦3 = −2 … … … … … … . [𝟓]
Solution of the system by Gauss elimination method
The augmented matrix [𝐴 , 𝐵] is
−1.95 1 0 −1
[𝐴 , 𝐵] = [ 1 −1.9583 1 0]
0 1 −1.9643 −2
Solving by Gauss elimination method, we get
𝒚𝟏 = 𝟏. 𝟑𝟓𝟏𝟐;
𝒚𝟐 = 𝟏. 𝟔𝟑𝟒𝟗;
𝒚𝟑 = 𝟏. 𝟖𝟓𝟎𝟓
𝝏𝒖 𝝏𝟐 𝒖
Solution Of One Dimensional Heat Equation : 𝝏𝒕 = 𝜶𝟐 𝝏𝒙𝟐 [Parabolic type]

In this chapter, we will discuss the finite difference solution of one dimensional heat flow equation by explicit and implicit methods.
Explicit Method (Bender-Schmidt Method):
𝝏𝒖 𝝏𝟐 𝒖 𝝏𝟐 𝒖 𝝏𝒖
Consider the one-dimensional heat equation 𝝏𝒕 = 𝜶𝟐 𝝏𝒙𝟐 . (Or) 𝝏𝒙𝟐 = 𝒂 𝝏𝒕
𝟏 𝒂𝒉𝟐 𝟏
In order to apply Bender-Schmidt recurrence relation, For 𝝀 = ,we must choose 𝒌 = for a given 𝒖𝒊,𝒋+𝟏 = [𝒖𝒊−𝟏,𝒋 + 𝒖𝒊+𝟏,𝒋 ] ∀𝒋 = 𝟎, 𝟏, 𝟐 … ..
𝟐 𝟐 𝟐

Physical interpretation
As the B.C’S; 𝑢(0, 𝑡) = 𝑢(4, 𝑡) = 0, both the edges, temperature 𝑢(𝑥, 𝑡) = 0, if means both ends are cooled. The initial temperature 𝑢(𝑥, 0) = 𝑓(𝑥) = 𝑥(4 − 𝑥).
With respect to the central axis, the temperature symmetrically distributed.
Example 1:Solve𝒖𝒙𝒙 = 𝟐𝒖𝒕 when 𝒖(𝟎, 𝒕) = 𝟎, 𝒖(𝟒, 𝒕) = 𝟎 and with initial condition𝒖(𝒙, 𝟎) = 𝒙(𝟒 − 𝒙) upto t = 5 sec, assuming∆𝒙 = 𝒉 = 𝟏.
Solution:Given 𝑢𝑥𝑥 = 2𝑢𝑡 and ∆𝑥 = ℎ = 1.
𝒂𝒉𝟐 2(12 )
Here a=2, h=1. Then choose 𝑘 = = ⇒ 𝑘 = 1.
𝟐 2
𝑲 𝟏
Put 𝑘 = 1in 𝜆 = 𝒂𝒉𝟐 , we get𝝀 = 𝟐

By initial condition
𝒖(𝒙, 𝟎) = 𝒙(𝟒 − 𝒙), we have
𝑢(1,0) = 1(4 − 1) = 3
𝑢(2,0) = 2(4 − 2) = 4
𝑢(3,0) = 3(4 − 3) = 3
By boundary condition 𝑢(0, 𝑡) = 0 and𝑢(4, 𝑡) = 0
By Bender-Schmidt recurrence relation
𝟏
𝒖𝒊,𝒋+𝟏 = [𝒖 + 𝒖𝒊+𝟏,𝒋 ]∀𝒋 = 𝟎, 𝟏, 𝟐 … ..
𝟐 𝒊−𝟏,𝒋
The values of u up to 𝑡 = 5 𝑠𝑒𝑐 are tabulated as follows:
𝒉=𝟏

i
0 1 2 3 4
j
𝒌=𝟏 0 0 3 4 3 0
1 0 2 3 2 0
2 0 1.5 2 1.5 0
3 0 1 1.5 1 0
4 0 1.75 1 0.75 0
5 0 0.5 0.75 0.5 0

𝝏𝒖 𝝏𝟐 𝒖 𝟏
Example2: Solve the equation = subject to the conditions𝒖(𝟎, 𝒕) = 𝒖(𝟓, 𝒕) = 𝟎and 𝒖(𝒙, 𝟎) = 𝒙𝟐 (𝟐𝟓 − 𝒙𝟐 ). Taking h=1 and k= , tabulate the values of uuptot=4sec.
𝝏𝒕 𝝏𝒙𝟐 𝟐
𝟏
Solution:Given 𝑢𝑥𝑥 = 𝑢𝑡 Here a=1, h=1& 𝑘 = 𝟐 .
𝟏
𝟏 𝑲 𝟐 𝟏
Put 𝑘 = 𝟐in 𝜆 = 𝒂𝒉𝟐 , we get𝝀 = =𝟐
𝟏

By initial condition
𝒖(𝒙, 𝟎) = 𝒙𝟐 (𝟐𝟓 − 𝒙𝟐 ),we have
𝑢(1,0) = 24; 𝑢(2,0) = 84; 𝑢(3,0) = 144; 𝑢(4,0) = 144
By boundary condition𝑢(0, 𝑡) = 0and 𝑢(5, 𝑡) = 0
By Bender-Schmidt recurrence relation
𝟏
𝒖𝒊,𝒋+𝟏 = [𝒖 + 𝒖𝒊+𝟏,𝒋 ]∀𝒋 = 𝟎, 𝟏, 𝟐 … ..
𝟐 𝒊−𝟏,𝒋
The values of u up to 𝑡 = 4𝑠𝑒𝑐 are tabulated as follows:
𝒉=𝟏

i
0 1 2 3 4 5
j
0 0 24 84 144 144 0
0.5 0 42 84 144 72 0
1 0 42 78 78 57 0
1.5 0 39 60 67.5 39 0
𝟏
𝒌= 2 0 30 53.25 49.5 33.75 0
𝟐
2.5 0 26.625 39.75 43.5 24.75 0
3 0 19.875 35.0625 32.25 21.75 0
3.5 0 17.5312 26.0625 28.4062 16.125 0
4 0 13.0312 22.9688 21.0938 14.2031 0

Example3:
𝝏𝒖 𝝏𝟐 𝒖
Solve the equation 𝝏𝒕 = 𝝏𝒙𝟐 ,𝟎 < 𝑥 < 1, 𝑡 > 0, 𝑢(𝒙, 𝟎) = 𝟏𝟎𝟎(𝒙 − 𝒙𝟐 ),

𝒖(𝟎, 𝒕) = 𝒖(𝟏, 𝒕) = 𝟎for 4 times steps.


Solution:
Given 𝑢𝑥𝑥 = 𝑢𝑡
1 𝒂𝒉𝟐 1 1
Here a=1,Let us takeℎ = 4. Thenchoose𝑘 = 𝟐
= 16 = 32
2
𝟏
𝑲 𝟑𝟐 𝟏 𝟏𝟔 𝟏
Put 𝑘 = 1in 𝜆 = 𝒂𝒉𝟐 , we get𝝀 = 𝟏 = 𝟑𝟐 × =𝟐
𝟏
𝟏𝟔

By initial condition
𝒖(𝒙, 𝟎) = 𝟏𝟎𝟎(𝒙 − 𝒙𝟐 ),we have
1 1 1 2 1 3
𝑢 ( , 0) = 100 ( − ( ) ) = 18.75; 𝑢 ( , 0) = 25; 𝑢 ( , 0) = 18.75
4 4 4 2 4
By boundary condition 𝑢(0, 𝑡) = 0 and 𝑢(1, 𝑡) = 0
By Bender-Schmidt recurrence relation
𝟏
𝒖𝒊,𝒋+𝟏 = [𝒖 + 𝒖𝒊+𝟏,𝒋 ]∀𝒋 = 𝟎, 𝟏, 𝟐 … ..
𝟐 𝒊−𝟏,𝒋
The values of u up to 4 time steps are tabulated as follows:
𝟏
𝒉=
𝟒
i 𝟏 𝟐 𝟑 𝟒
0 =𝟏
j 𝟒 𝟒 𝟒 𝟒
0 0 18.75 25 18.75 0
1 0 12.5 18.75 12.5 0
2 0 9.375 12.5 9.375 0
3 0 6.25 9.375 6.25 0
4 0 4.6875 6.25 4.6875 0

Problems for Practice:


1. Compute for 4 time steps: 𝑢𝑡 = 𝑢𝑥𝑥 ,0 ≤ 𝑥 ≤ 1, 𝑡 > 0,
1
𝑢(𝑥, 0) = 100𝑠𝑖𝑛𝜋𝑥, 𝑢(0, 𝑡) = 𝑢(1, 𝑡) = 0 choose ℎ = 4
1
ANS. When 𝑡 = 8, then x= 0, 17.67777, 25, 17.67777, 0

2. Solve initial and boundary value problem 𝑢𝑡 = 𝑢𝑥𝑥 ,


𝜋𝑥
𝑢(𝑥, 0) = 𝑐𝑜𝑠 , −1 ≤ 𝑥 ≤ 1, 𝑡 = 0, 𝑢(−1, 𝑡) = 𝑢(1, 𝑡) = 0, 𝑡 > 0
2
1
ANS. When 𝑡 = 2, then x= 0, 0.1767, 0.25, 0.1767, 0

Formula :
𝟏
If 𝝀 ≠ 𝟐 , then Bender-Schmidt finite difference explicit scheme is given by

𝒖𝒊,𝒋+𝟏 = 𝝀(𝒖𝒊−𝟏,𝒋 + 𝒖𝒊+𝟏,𝒋 ) + (𝟏 − 𝟐𝝀)𝒖𝒊,𝒋


Example 1:
𝝏𝒖 𝝏𝟐 𝒖 𝟏
Solve the equation 𝝏𝒕 = 𝝏𝒙𝟐
, 𝒖(𝟎, 𝒕) = 𝒖(𝟒, 𝒕) = 𝟎, 𝑢(𝒙, 𝟎) = 𝒙(𝟒 − 𝒙), assuming 𝒉 = 𝟏and𝒌 = 𝟒. Find the values u up to𝒕 = 𝟏sec using Bender-Schmidt formula.

Solution:
𝟏
Given 𝑢𝑥𝑥 = 𝑢𝑡 Here a=1, h=1 &= 𝟒 .
𝟏
𝟏 𝟏
Put 𝑘 = in 𝜆 = 𝟒 , we get𝝀 =
𝟒 𝟏 𝟒
𝟏
Here,𝝀 ≠ 𝟐, we use following Bender-Schemidt relation

𝒖𝒊,𝒋+𝟏 = 𝝀(𝒖𝒊−𝟏,𝒋 + 𝒖𝒊+𝟏,𝒋 ) + (𝟏 − 𝟐𝝀)𝒖𝒊,𝒋 … … … … . [𝟏]


1
Put 𝜆 = 4 in[1], we get
1 1
𝐮𝐢,𝐣+𝟏 = [𝐮𝐢−𝟏,𝐣 + 𝐮𝐢+𝟏,𝐣 ] + [𝟏 − 𝟐 ( )] 𝐮𝐢,𝐣
4 4
1 1
= [𝐮𝐢−𝟏,𝐣 + 𝐮𝐢+𝟏,𝐣 ] + [𝟏 − 𝟐 ( )] 𝐮𝐢,𝐣
4 4
1 1
𝐮𝐢,𝐣+𝟏 = [𝐮𝐢−𝟏,𝐣 + 𝐮𝐢+𝟏,𝐣 ] + 𝐮𝐢,𝐣
4 2
BY INITIAL CONDITION BY BOUNDARY CONDITION
𝑢(𝑥, 0) = 𝑥(4 − 𝑥),we have 𝑢(0, 𝑡) = 0 and 𝑢(1, 𝑡) = 0
𝑢(1,0) = 3; 𝑢(2,0) = 4; 𝑢(3,0) = 3
The values of u up to 𝑡 = 1 𝑠𝑒𝑐 are tabulated as follows:

𝒉=𝟏
i 0 1 2 3 4
j
0 0 3 4 3 0
𝟏
𝒌= 𝟎. 𝟐𝟓 0 2.5 3.5 2.5 0
𝟒
𝟎. 𝟓 0 2.125 3 2.125 0
𝟎. 𝟕𝟓 0 1.8125 2.5625 1.8125 0
𝟏 0 1.5469 2.1875 1.5469 0

Example 2:
𝝏𝟐 𝒖 𝝏𝒖
Solve the equation 𝝏𝒙𝟐 = 𝝏𝒕
, 𝒖(𝟎, 𝒕) = 𝒖(𝟒, 𝒕) = 𝟎, 𝑢(𝒙, 𝟎) = 𝒙(𝟒 − 𝒙), assuming 𝒉 = 𝟏 and𝒌 = 𝟏. Find the values u upto 𝒕 = 𝟒sec by using

Bender-Schmidt formula.
Solution :
Given 𝑢𝑥𝑥 = 𝑢𝑡 Here a=1, ℎ = 1&𝑘 = 𝟏 .
𝒌
Put 𝑘 = 𝟏in 𝜆 = , we get𝝀 = 𝟏
𝒂𝒉𝟐
𝟏
Here, 𝝀 ≠ 𝟐, we use following Bender-Schemidt relation

𝒖𝒊,𝒋+𝟏 = 𝝀(𝒖𝒊−𝟏,𝒋 + 𝒖𝒊+𝟏,𝒋 ) + (𝟏 − 𝟐𝝀)𝒖𝒊,𝒋 … … … … . [𝟏]


Put 𝜆 = 1 in [1], we get
𝐮𝐢,𝐣+𝟏 = [𝐮𝐢−𝟏,𝐣 + 𝐮𝐢+𝟏,𝐣 ] + [𝟏 − 𝟐]𝐮𝐢,𝐣
= [𝐮𝐢−𝟏,𝐣 + 𝐮𝐢+𝟏,𝐣 ] − 𝐮𝐢,𝐣
BY INITIAL CONDITION BY BOUNDARY CONDITION
𝑢(𝑥, 0) = 𝑥(4 − 𝑥),we have 𝑢(0, 𝑡) = 0 and 𝑢(1, 𝑡) = 0
𝑢(1,0) = 3; 𝑢(2,0) = 4; 𝑢(3,0) = 3
The values of u up to 𝑡 = 4 𝑠𝑒𝑐 are tabulated as follows:
𝒉=𝟏
i 0 1 2 3 4
j
0 0 3 4 3 0
1 0 1 2 1 0
𝟐 0 1 0 1 0
𝟑 0 -1 2 -1 0
𝟒 0 3 -4 3 0

Problem for Practice :


𝜕2𝑢 𝜕𝑢 1 1
1. Solve the equation = , 𝑢(0, 𝑡) = 𝑢(4, 𝑡) = 0, 𝑢(𝑥, 0) = 100(𝑥 − 𝑥 2 ), assuming ℎ = and𝑘 = . Find the values u upto 𝑡 = 1sec by using
𝜕𝑥 2 𝜕𝑡 4 10

Bender-Schmidt formula.
𝝏𝒖 𝝏𝟐 𝒖
CRANK - NICHOLSON (IMPLICIT) METHOD: (𝝏𝒕 = 𝒂𝟐 𝝏𝒙𝟐 )

𝝀(𝒖𝒊+𝟏,𝒋+𝟏 + 𝒖𝒊−𝟏,𝒋+𝟏 ) − 𝟐(𝝀 + 𝟏)𝒖𝒊,𝒋+𝟏 =


𝟐(𝝀 − 𝟏)𝒖𝒊,𝒋 − 𝝀(𝒖𝒊+𝟏,𝒋 + 𝒖𝒊−𝟏,𝒋 ) … … … … (𝑰)
Equation (I) is called Crank-Nicholson difference scheme or method
In Problems, we will use this simplified formula subject to 𝑘 = 𝑎ℎ2

E
D
Scheme
𝑢𝑖−1,𝑗 𝑢𝑖+1,𝑗

B A C

Problem : 1Using Crank-Nicholson’s method solve 𝒖𝒙𝒙 = 𝟏𝟔𝒖𝒕 𝟎 < 𝒙 < 1, 𝒕 > 0 given 𝒖(𝒙, 𝟎) = 𝟎, 𝒖(𝟎, 𝒕) = 𝟎 and 𝒖(𝟏, 𝒕) = 𝟏𝟎𝟎𝒕, Compute 𝒖 for one step in 𝒕 direction
𝟏𝑢 𝑢𝑖,𝑗+1 𝑢𝑖+1,𝑗+1
taking 𝒉 = 𝟒 𝑖−1,𝑗+1

Solution : Given 𝑢𝑥𝑥 = 16𝑢𝑡


1 1
Here 𝑎 = 16, ℎ = ∴ 𝑘 = 𝑎ℎ2 = 16 ( ) = 1
4 16
The Crank-Nicholson’s scheme is
1
𝑢𝑖,𝑗+1 = [𝑢𝑖−1,𝑗+1 + 𝑢𝑖+1,𝑗+1 + 𝑢𝑖−1,𝑗 + 𝑢𝑖+1,𝑗 ] … … … … … (1)
4

x increasing

𝑖
0 0.25 0.5 0.75 1
𝑗
t
0 0 0 0 0 0

1 0 𝑢1 𝑢2 𝑢3 100

1 1
𝑢1 = (0 + 0 + 0 + 𝑢2 ) ∴ 𝑢1 = 𝑢2 … … … … … … (2)
4 4
1 1
𝑢2 = 4 (0 + 0 + 𝑢1 + 𝑢3 ) ∴ 𝑢2 = 4 (𝑢1 + 𝑢3 ) … … … (3)
1 1
𝑢3 = 4 (0 + 0 + 𝑢2 + 100) ∴ 𝑢3 = 4 (𝑢2 + 100) … … . . (4)

Substituting 𝑢1 , 𝑢3 𝑣𝑎𝑙𝑢𝑒𝑠 𝑖𝑛 (3)


1 1 1 1 1 1 25 1 25
𝑢2 = 4 [4 (𝑢2 ) + 4 (𝑢2 + 100)] = 4 [4 (2𝑢2 + 100)] = 8 𝑢2 + 4
𝑢2 − 8 𝑢2 = 4
⇒ 0.875𝑢2 = 6.25 ⇒ 𝑢2 = 7.1429

Using the value 𝑢2 = 7.1429 in (2) & (3) we get 𝑢1 = 1.7857, 𝑢3 = 26.7857
The values are

𝑢1 = 1.7857 𝑢2 = 7.1429 𝑢3 = 26.7857

Problem : 2

Solve by Crank-Nicholson method the equation 𝒖𝒙𝒙 = 𝒖𝒕 subject 𝒕𝒐


𝒖(𝒙, 𝟎) = 𝟎, 𝒖(𝟎, 𝒕) = 𝟎 andu(𝟏, 𝒕) = 𝒕 , for two time steps
Solution :

Given that 𝑢𝑥𝑥 = 𝑢𝑡


1
𝑥ranges from 0 to 1. Take ℎ = 4 ; ℎ𝑒𝑟𝑒 𝑎 = 1
1 2 1
∴ 𝑘 = 𝑎ℎ2 to use simple form. 𝑘 = 1 (4) = 16

The Crank-Nicholson scheme is


1
𝑢𝑖,𝑗+1 = [𝑢𝑖−1,𝑗+1 + 𝑢𝑖+1,𝑗+1 + 𝑢𝑖−1,𝑗 + 𝑢𝑖+1,𝑗 ] … … … (1)
4

x direction

i
0 0.25 0.5 0.75 1
j

0 0 0 0 0 0
t

1 1
0 𝑢1 𝑢2 𝑢3
16 16

2 2
0 𝑢4 𝑢5 𝑢6
16 16

Let the unknown be represented by 𝑢1 , 𝑢2 , 𝑢3 … … … … … … …


Using the scheme (1), we have
1 1
𝑢1 = 4 (0 + 0 + 0 + 𝑢2 ) ∴ 𝑢1 = 4 𝑢2 … … … … … … (2)
1 1
𝑢2 = 4 (0 + 0 + 𝑢1 + 𝑢3 ) ∴ 𝑢2 = 4 (𝑢1 + 𝑢3 ) … … … (3)
1 1 1 1
𝑢3 = 4 (0 + 0 + 𝑢2 + 16) ∴ 𝑢3 = 4 (𝑢2 + 16) … … . . (4)

Solving the three equations given by (2), (3), (4) we get 𝑢1 , 𝑢2 , 𝑢3


Substitute 𝑢3 , 𝑢1 𝑣𝑎𝑙𝑢𝑒𝑠 𝑖𝑛 (3),
1 1 1 1 2 1 8 1 1
𝑢2 = 4 [4 𝑢2 + 4 (𝑢2 + 16)] ⟹ 𝑢2 − 16 𝑢2 = 256 ⟹ 𝑢2 = 7 × 256 ⟹ 𝑢2 = 224
𝟏 𝟏
𝒖𝟐 = = 𝟎. 𝟎𝟎𝟒𝟓 𝒖𝟏 = = 𝟎. 𝟎𝟎𝟏𝟏 𝒖𝟑 = 𝟎. 𝟎𝟏𝟔𝟖
𝟐𝟐𝟒 𝟖𝟗𝟔

Similarly 𝑢4 , 𝑢5 , 𝑢6 can be got again getting 3 equations in 3 unknowns 𝑢4 , 𝑢5 , 𝑢6


We get
1
𝑢4 = (0 + 0 + 𝑢2 + 𝑢5 )
4

⇒ 4𝑢4 − 𝑢5 = 0.0045 … … … … … … (5)


1
𝑢5 = (𝑢1 + 𝑢3 + 𝑢4 + 𝑢6 )
4
⇒ −𝑢4 + 4𝑢5 − 𝑢6 = 0.0179 … … … (6)
1 2 1
𝑢6 = (𝑢2 + 𝑢5 + + ) −𝑢5 + 4𝑢6 = 0.192 … … . . (7)
4 16 16

Solving we get,

𝒖𝟒 = 𝟎. 𝟎𝟎𝟓𝟗𝟏𝟐𝟓 𝒖𝟓 = 𝟎. 𝟎𝟏𝟗𝟏𝟓

𝒖𝟔 = 𝟎. 𝟎𝟓𝟐𝟕𝟖𝟕𝟓
Problem for Practice:
1. Solve by Crank-Nicolson’s implicit method, 𝑢𝑡 = 𝑢𝑥𝑥 , 0 < 𝑥 < 1, 𝑡 > 0
𝑢(𝑥, 0) = 100(𝑥 − 𝑥 2 ), 𝑢(0, 𝑡) = 0and𝑢(1, 𝑡) = 0. Compute 𝑢 for one time step with ℎ = 0.25
ANS: 𝑢1 = 𝑢3 = 9.82, 𝑢2 = 14.29
2. Using Crank-Nicolson method, solve 𝑢𝑥𝑥 = 𝑢𝑡 subject 𝑡𝑜 𝑢(𝑥, 0) = 0,
1 1
𝑢(0, 𝑡) = 0 and (1, 𝑡) = 16𝑡 , taking ℎ = 4 and k= 8 for one time step.

ANS: 𝑢1 = 0.0952, 𝑢2 = 0.2856, 𝑢3 = 0.7619


3. Using Crank-Nicholson method, solve 𝑢𝑡 = 𝑢𝑥𝑥 , 0 < 𝑥 < 5, 𝑡 > 0,
𝑢(𝑥, 0) = 20, 𝑢(0, 𝑡) = 0, 𝑢(5, 𝑡) = 100 for one time step
ANS: 𝑢1 = 9.80, 𝑢2 = 20.19, 𝑢3 = 30.72, 𝑢4 = 59.92

ONE DIMENSIONAL WAVE EQUATION


The one dimensional wave equation (vibration of strings) is given by
𝜕2𝑢 𝜕2𝑢
𝑎2 − =0; 𝒊. 𝒆. , 𝒖𝒕𝒕 = 𝒂𝟐 𝒖𝒙𝒙
𝜕𝑥 2 𝜕𝑡 2

𝒖𝒊,𝒋+𝟏 = 𝟐(𝟏 − 𝝀𝟐 𝒂𝟐 )𝒖𝒊,𝒋 + 𝝀𝟐 𝒂𝟐 (𝒖𝒊−𝟏,𝒋 + 𝒖𝒊+𝟏,𝒋 )


− 𝒖𝒊,𝒋−𝟏 … … … (𝟏)


Equation (1) is called an Explicit scheme or Explicit formula to solve the wave equation.Choose𝑘 = 𝑎

𝑻𝒉𝒆 𝒗𝒂𝒍𝒖𝒆𝒔 𝒐𝒇 𝒖 𝒂𝒕 𝑨 = 𝑽𝒂𝒍𝒖𝒆 𝒐𝒇 𝒖 𝒂𝒕 𝑩 + 𝒗𝒂𝒍𝒖𝒆 𝒐𝒇 𝒖 𝒂𝒕 𝑪 − 𝑽𝒂𝒍𝒖𝒆 𝒐𝒇 𝒖 𝒂𝒕 𝑫

Problem: 1
Solve numerically 𝟒𝒖𝒙𝒙 = 𝒖𝒕𝒕 with the boundary conditions 𝒖(𝟎, 𝒕) = 𝟎, 𝒖(𝟒, 𝒕) = 𝟎 and the initial conditions 𝒖𝒕 (𝒙, 𝟎) = 𝟎 𝒂𝒏𝒅 𝒖(𝒙, 𝟎) = 𝒙(𝟒 − 𝒙), 𝐭𝐚𝐤𝐢𝐧𝐠 𝐡 =
𝟏. 𝐂𝐨𝐦𝐩𝐮𝐭𝐞 𝐮 𝐮𝐩𝐭𝐨 𝟒 𝐬𝐞𝐜𝐬.
Solution :
h 1
Given h = 1, a2 = 4  a = 2, k = a = 2

The finite difference scheme is 𝒖𝒊,𝒋+𝟏 = 𝒖𝒊−𝟏,𝒋 + 𝒖𝒊+𝟏,𝒋 − 𝒖𝒊,𝒋−𝟏


𝑢(0, 𝑡) = 0 ⇒ 𝑢along𝑥 = 0 are all zero
𝑢(4, 𝑡) = 0 ⇒ 𝑢along𝑥 = 4 are all zero.
𝑢(𝑥, 0) = 𝑥(4 − 𝑥)𝑢(0,0) = 0, 𝑢(1,0) = 3, 𝑢(2,0) = 4, 𝑢(3,0) = 3

𝒙
0 1 2 3 4
𝒕

0 0 3 4 3 0

0.5 0 2 3 2 0

1 0 0 0 0 0

1.5 0 -2 -3 -2 0

2 0 -3 -4 -3 0

2.5 0 -2 -3 -2 0

3 0 0 0 0 0

3.5 0 2 3 2 0

4 0 3 4 3 0

Problem: 2 Solve𝟐𝟓𝒖𝒙𝒙 − 𝒖𝒕𝒕 = 𝟎 for ‘u’ at the pivotal points, given 𝒖(𝟎, 𝒕) = 𝒖(𝟓, 𝒕) = 𝟎𝒖𝒕 (𝒙, 𝟎) = 𝟎 𝒂𝒏𝒅 𝒖(𝒙, 𝟎) = 𝒙 𝒇𝒐𝒓
𝟎 ≤ 𝒙 ≤ 𝟐. 𝟓; = 𝟏𝟎 − 𝟐𝒙 𝒇𝒐𝒓 𝟐. 𝟓 ≤ 𝒙 ≤ 𝟓for one half period of vibration.
ℎ 1
Solution :Given h = 1, 𝑎2 = 25 ∴ a = 5, 𝑘 = 𝑎 = 5
2𝑙 2×5
Period of vibration = 𝑎 = 5
= 2 𝑠𝑒𝑐𝑜𝑛𝑑𝑠. Half period =1 second

The finite difference scheme is 𝒖𝒊,𝒋+𝟏 = 𝒖𝒊−𝟏,𝒋 + 𝒖𝒊+𝟏,𝒋 − 𝒖𝒊,𝒋−𝟏


𝑢(0, 𝑡) = 0 ⇒ 𝑢along𝑥 = 0 are all zero
𝑢(5, 𝑡) = 0 ⇒ 𝑢along𝑥 = 5 are all zero.
𝑢(𝑥, 0) = 2𝑥, 𝑓𝑜𝑟 0 ≤ 𝑥 ≤ 2.5
= 10 − 2𝑥, 𝑓𝑜𝑟 2.5 ≤ 𝑥 ≤ 5
𝒙
0 1 2 3 4 5
𝒕
0 0 2 4 4 2 0
𝟏 3
3 2 0
𝟓 0 2
𝟐
0 1 1 1 0
𝟓 1
𝟑
0 -1 -1 0
𝟓 -1 -1
𝟒
0 -2 -3 -3 -2 0
𝟓
𝟏 0 -2 -4 -4 -2 0

 𝑢(0,0) = 0; 𝑢(1,0) = 2, 𝑢(2,0) = 4,


𝑢(3,0) = 4, 𝑢(4,0) = 2, 𝑢(5,0) = 0
Problem:3
𝝏𝟐 𝒖 𝝏𝟐 𝒖
Solve 𝝏𝒕𝟐 = , 𝟎 < 𝒙 < 1, 𝒕 > 0 given 𝒖(𝒙, 𝟎) = 𝟎 𝒖𝒕 (𝒙, 𝟎) = 𝟎 , 𝒖(𝟎, 𝒕) = 𝟎 𝒂𝒏𝒅 𝒖(𝒍, 𝒕) = 𝟏𝟎𝟎 𝐬𝐢𝐧 𝝅 𝒕. Compute 𝒖 for 4 times steps with 𝒉 = 𝟎. 𝟐𝟓
𝝏𝒙𝟐

Solution :
Here, the two ends are not fixed.
∴ 𝑥 = 1is a free end with displacement not equal to zero.
ℎ 0.25
Given h = 0.25, 𝑎2 = 1 ∴ a = 1, 𝑘 = = = 0.25
𝑎 1

The finite difference scheme is 𝒖𝒊,𝒋+𝟏 = 𝒖𝒊−𝟏,𝒋 + 𝒖𝒊+𝟏,𝒋 − 𝒖𝒊,𝒋−𝟏


𝑢(0, 𝑡) = 0 ⇒ 𝑢along𝑥 = 0 are all zero
𝑢(1, 𝑡) = 100 sin 𝜋𝑡𝑢(1,0) = 0,
𝜋
𝑢(1, 0.25) = 100 sin = 70.7106
4
𝜋 3𝜋
𝑢(1, 0.5) = 100 sin = 100 , 𝑢(1, 0.75) = 100 sin = 70.7106
2 4
𝑢(1, 1) =0
𝑢(𝑥, 0) = 0 ⇒ 𝑢along𝑥 = 𝑡 are all zero.
The values of u are tabulated below.

𝒙
0 0.25 0.5 0.75 1
𝒕
0 0 0 0 0 0
0.25 0 0 0 0 70.7106
0.5 0 0 0 70.7106 100
0.75 0 0 70.7106 100 70.7106
1.0 0 70.7106 100 70.7106 0

Problem for Practice:


1. Solve 𝑢𝑡𝑡 = 𝑢𝑥𝑥 upto 𝑡 = 0.5 with spacing of 0.1 given
𝑢(0, 𝑡) = 𝑢(1, 𝑡) = 0, 𝑢𝑡 (𝑥, 0) = 0 and 𝑢(𝑥, 0) = 10 + 𝑥(1 − 𝑥), taking ℎ = 0.1
1
2. Solve𝑢𝑡𝑡 = 𝑢𝑥𝑥 , given u(0, t) = u(4, t) = 0, u(x, 0) = 2 𝑥(4 − 𝑥) and 𝑢𝑡 (𝑥, 0) = 0. Take h = 1. Find the solution upto 5 steps in t direction.

LAPLACE EQUATION

𝝏𝟐 𝒖 𝝏𝟐 𝒖
Solution of Laplace equation 𝝏𝒙𝟐 + 𝝏𝒚𝟐 = 𝟎[𝐄𝐥𝐥𝐢𝐩𝐭𝐢𝐜𝐭𝐲𝐩𝐞]

Standard Five Point Formula (SFPF) :


𝟏
𝒖𝒊,𝒋 = [𝒖 + 𝒖𝒊+𝟏,𝒋 + 𝒖𝒊,𝒋−𝟏 + 𝒖𝒊,𝒋+𝟏 ]
𝟒 𝒊−𝟏,𝒋
𝒖𝒊,𝒋+𝟏

𝒖𝒊−𝟏,𝒋 𝒖𝒊,𝒋

𝒖𝒊+𝟏,𝒋

𝒖𝒊,𝒋−𝟏

Diagonal Five Point Formula (DFPF) :


𝟏
𝒖𝒊,𝒋 = [𝒖 + 𝒖𝒊+𝟏,𝒋+𝟏 + 𝒖𝒊−𝟏,𝒋−𝟏 + 𝒖𝒊+𝟏,𝒋−𝟏 ]
𝟒 𝒊−𝟏,𝒋+𝟏

𝒖𝒊−𝟏,𝒋+𝟏 𝒖𝒊+𝟏,𝒋+𝟏
𝒖𝒊,𝒋

𝒖𝒊−𝟏,𝒋−𝟏 𝒖𝒊+𝟏,𝒋−𝟏
𝝏𝟐 𝒖 𝝏𝟐 𝒖
Example 1: Solve𝝏𝒙𝟐 + 𝝏𝒚𝟐 = 𝟎 by Liemann’s method, at the nine mesh points of the square given below. The values of u at the boundary are specified in the figure.

0 11.1 17.0 19.7 18.6


0 u1 u2 u3 21.9

0 u4 u5 u6 21.0

0 u7 u8 u9 17.0

0 9.0
8.7 12.1 12.6

Solution:
Let 𝑢1 , 𝑢2 , 𝑢3 , … … … 𝑢9 be the values of 𝑢 at the nine interior mesh points of the region respectively.
First we find the rough values of 𝑢

Using SFPF
1
𝑢5 = [21.0 + 17.0 + 0 + 12.1] = 12.5
4
Next to find 𝒖𝟏 , 𝒖𝟑 , 𝒖𝟕, 𝒖𝟗 usingDFPF
1
𝑢1 = [0 + 12.5 + 0 + 17.0] = 7.4
4
1
𝑢3 = [12.5 + 18.6 + 17 + 21] = 17.3
4
1
𝑢7 = [0 + 12.5 + 0 + 12.1] = 6.2
4
1
𝑢9 = [12.5 + 9 + 12.1 + 21.0] = 13.7
4
We useSFPEto get the other values of 𝒖
1
𝑢2 = [17 + 12.5 + 7.4 + 17.3] = 13.6
4
1
𝑢4 = [7.4 + 6.2 + 0 + 12.5] = 6.5
4
1
𝑢6 = [12.5 + 17.3 + 21 + 13.7] = 16.1
4
1
𝑢8 = [12.5 + 12.1 + 6.2 + 13.7] = 11.1
4
Gauss-Seidal iterative scheme
1
𝑢1 = 4 [0 + 𝑢2 + 𝑢4 + 11.1];
1
𝑢2 = [𝑢1 + 𝑢3 + 𝑢5 + 17.0]
4
1
𝑢3 = [𝑢2 + 𝑢6 + 21.9 + 19.7]
4
1
𝑢4 = [0 + 𝑢1 + 𝑢5 + 𝑢7 ]
4
1
𝑢5 = [𝑢2 + 𝑢4 + 𝑢6 + 𝑢8 ]
4
1
𝑢6 = [𝑢3 + 𝑢5 + 𝑢9 + 21.0]
4
1
𝑢7 = [0 + 𝑢4 + 𝑢8 + 8.7]
4
1
𝑢8 = [𝑢5 + 𝑢7 + 𝑢8 + 12.1]
4
1
𝑢9 = [𝑢6 + 𝑢8 + 17.0 + 12.8]
4
The iteration values are tabulated as follows:
Iteration 𝒖𝟏 𝒖𝟐 𝒖𝟑 𝒖𝟒 𝒖𝟓 𝒖𝟔 𝒖𝟕 𝒖𝟖 𝒖𝟗
0 7.4 13.6 17.3 6.5 12.5 16.1 6.2 11.1 13.7
1 7.8 13.7 17.9 6.6 11.9 16.1 6.6 11.1 14.3
2 7.9 13.7 17.9 6.6 11.9 16.3 6.6 11.2 14.3
3 7.9 13.7 17.9 6.6 11.9 16.3 6.6 11.2 14.3
Hence the solution is
𝒖𝟏 = 𝟕. 𝟗, 𝒖𝟐 = 𝟏𝟑. 𝟕, 𝒖𝟑 = 𝟏𝟕. 𝟗, 𝒖𝟒 = 𝟔. 𝟔, 𝒖𝟓 = 𝟏𝟏. 𝟗, 𝒖𝟔 = 𝟏𝟔. 𝟑, 𝒖𝟕 = 𝟔. 𝟔,
, 𝒖𝟖 = 𝟏𝟏. 𝟐, 𝒂𝒏𝒅𝒖𝟗 = 𝟕. 𝟗
Example 2:
Solve 𝒖𝒙𝒙 + 𝒖𝒚𝒚 = 𝟎 over the square mesh of side 4 units satisfying the following boundary conditions
(𝒊)𝒖(𝟎, 𝒚) = 𝟎𝒇𝒐𝒓𝟎 ≤ 𝒚 ≤ 𝟒
(𝒊𝒊)𝒖(𝟒, 𝒚) = 𝟏𝟐 + 𝒚𝒇𝒐𝒓𝟎 ≤ 𝒚 ≤ 𝟒
(𝒊𝒊𝒊)𝒖(𝒙, 𝟎) = 𝟑𝒙𝒇𝒐𝒓𝟎 ≤ 𝒙 ≤ 𝟒
(𝒊𝒗)𝒖(𝒙, 𝟒) = 𝒙𝟐 𝒇𝒐𝒓𝟎 ≤ 𝒙 ≤ 𝟒
Solution:
We divide the square mesh into 16 sub-squares of side 1 unit

𝒖(𝒙, 𝟒) = 𝒙𝟐 𝒇𝒐𝒓 𝟎 ≤ 𝒙 ≤ 𝟒

𝒚=𝟒
y

1 4 9 16
0
𝒖𝟏 𝒖𝟐 𝒖𝟑 𝒙=𝟒
0 15
𝒖𝟒 𝒖𝟓 𝒖𝟔
𝒙=𝟎 0 14 𝒖(𝟒, 𝒚) = 𝟏𝟐 + 𝒚
𝒖=𝟎
𝒖𝟕 𝒖𝟖 𝒖𝟗
0 13

x
Let 𝑢1 , 𝑢20 39 be the values
, 𝑢3 , … … … 𝑢 6 of 𝑢9at the nine
12interior mesh points of the region respectively.
First we find the rough values of 𝑢
UsingSFPF
𝒚=𝟎
1
𝑢5 = [4 + 6 + 0 + 14]𝒖(𝒙, = 6𝟎) = 𝟑𝒙 𝒇𝒐𝒓 𝟎 ≤ 𝒙 ≤ 𝟒
4
Next to find 𝒖𝟏 , 𝒖𝟑 , 𝒖𝟕, 𝒖𝟗 usingDFPF
1
𝑢1 = [0 + 6 + 4 + 0] = 2.5
4
1
𝑢3 = [16 + 6 + 14 + 4] = 10
4
1
𝑢7 = [0 + 6 + 0 + 6] = 3
4
1
𝑢9 = [6 + 14 + 6 + 12] = 9.5
4
We use SFPF to get the other values of 𝑢
1
𝑢2 = [4 + 6 + 2.5 + 10] = 5.6
4
1
𝑢4 = [0 + 6 + 2.5 + 3] = 2.9
4
1
𝑢6 = [6 + 14 + 10 + 9.5] = 9.9
4
1
𝑢8 = [6 + 6 + 3 + 9.5] = 6.1
4
Gauss-Seidal iterative scheme
1 1
𝑢1 = [0 + 1 + 𝑢2 + 𝑢4 ] ; 𝑢6 = [𝑢3 + 𝑢5 + 𝑢9 + 14]
4 4
1 1
𝑢2 = [𝑢1 + 𝑢3 + 𝑢5 + 4] ; 𝑢7 = [0 + 𝑢4 + 𝑢8 + 3]
4 4
1 1
𝑢3 = [𝑢2 + 𝑢6 + 9 + 15] ;𝑢8 = [𝑢5 + 𝑢7 + 𝑢8 + 6]
4 4

1 1
𝑢4 = [0 + 𝑢1 + 𝑢5 + 𝑢7 ]; 𝑢9 = [𝑢6 + 𝑢8 + 13 + 9]
4 4
1
𝑢5 = [𝑢2 + 𝑢4 + 𝑢6 + 𝑢8 ]
4
Gauss seidal iteration values are tabulated as follows:
Iteration 𝒖𝟏 𝒖𝟐 𝒖𝟑 𝒖𝟒 𝒖𝟓 𝒖𝟔 𝒖𝟕 𝒖𝟖 𝒖𝟗
0 2.5 5.6 10 2.9 6 9.9 3 6.1 9.5
1 2.38 5.61 9.87 2.86 6.12 9.87 2.99 6.15 9.51
2 2.37 5.59 9.87 2.87 6.2 9.87 3.01 6.16 9.51
3 2.37 5.59 9.87 2.88 6.13 9.88 3.01 6.16 9.51
4 2.37 5.59 9.87 2.88 6.13 9.88 3.01 6.16 9.51
Hence the solution is
𝒖𝟏 = 𝟐. 𝟑𝟕, 𝒖𝟐 = 𝟓. 𝟓𝟗, 𝒖𝟑 = 𝟗. 𝟖𝟕, 𝒖𝟒 = 𝟐. 𝟖𝟖, 𝒖𝟓 = 𝟔. 𝟏𝟑, 𝒖𝟔 = 𝟗. 𝟖𝟖, 𝒖𝟕 = 𝟑. 𝟎𝟏
, 𝒖𝟖 = 𝟔. 𝟏𝟔, 𝒂𝒏𝒅 𝒖𝟗 = 𝟗. 𝟓𝟏
Example 3 : Write down the finite difference analogue of the equation 𝒖𝒙𝒙 + 𝒖𝒚𝒚 = 𝟎 and solve for the system bounded by the square 𝟎 ≤ 𝒙 ≤ 𝟒, 𝟎 ≤ 𝒚 ≤ 𝟒 and the boundary
conditions being given as 𝒖 = 𝟎 at 𝒙 = 𝟎;
𝒙𝟐
𝒖 = 𝟖 + 𝟐𝒚 𝒂𝒕 𝒙 = 𝟒; 𝒖 = 𝒂𝒕𝒚 = 𝟎; 𝒖 = 𝒙𝟐 𝒂𝒕𝒚 = 𝟒𝒘𝒊𝒕𝒉 𝒉 = 𝒌 = 𝟏. Use Gauss seidal methodto compute the values at the internal mesh points.
𝟐
Solution :
We divide the square mesh into 16 sub-squares of side 1 unit

𝒖 = 𝒙𝟐 𝒇𝒐𝒓 𝒚 = 𝟎, 𝟏, 𝟐, 𝟑, 𝟒

𝒚=𝟒
y

1 4 9 16
0
𝒖𝟏 𝒖𝟐 𝒖𝟑 𝒙=𝟒
0 14
𝒖𝟒 𝒖𝟓 𝒖𝟔 𝒖 = 𝟖 + 𝟐𝒚
0 12
𝒙=𝟎
𝒖𝟕 𝒖𝟖 𝒖𝟗
𝒖=𝟎
10
0

x
𝟏 𝟗
0 2 88
𝟐 𝟐

𝒚=𝟎
𝒙𝟐
𝒖= 𝒇𝒐𝒓𝒙 = 𝟎, 𝟏, 𝟐, 𝟑, 𝟒
𝟐
Let 𝑢1 , 𝑢2 , 𝑢3 , … … … 𝑢9 be the values of 𝑢 at the nine interior mesh points of the region respectively.
First we find the rough values of 𝑢
Using SFPF
1
𝑢5 = [0 + 12 + 4 + 2] = 4.5
4
Next to find 𝒖𝟏 , 𝒖𝟑 , 𝒖𝟕, 𝒖𝟗using DFPF
1
𝑢1 = [0 + 4.5 + 0 + 4] = 2.1
4
1
𝑢3 = [4 + 12 + 16 + 4.5] = 9.1
4
1
𝑢7 = [0 + 2 + 0 + 4.5] = 1.6
4
1
𝑢9 = [8 + 4.5 + 2 + 12] = 6.6
4
We use SFPF to get the other values of 𝒖
1
𝑢2 = [4 + 4.5 + 2.1 + 9.1] = 4.9
4
1
𝑢4 = [0 + 4.5 + 2.1 + 1.6] = 2.1
4
1
𝑢6 = [4.5 + 12 + 9.1 + 6.6] = 8.1
4
1
𝑢8 = [1.6 + 6.6 + 2 + 4.5] = 3.7
4
Gauss-Seidal iterative scheme
1 1
𝑢1 = [0 + 1 + 𝑢2 + 𝑢4 ] ; 𝑢6 = [𝑢3 + 𝑢5 + 𝑢9 + 12]
4 4
1 1
𝑢2 = [𝑢1 + 𝑢3 + 𝑢5 + 4] ; 𝑢7 = [0 + 𝑢4 + 𝑢8 + 0.5]
4 4
1 1
𝑢3 = 4 [𝑢2 + 𝑢6 + 9 + 14] ;𝑢8 = 4 [𝑢5 + 𝑢7 + 𝑢8 + 2]
1 1
𝑢4 = [0 + 𝑢1 + 𝑢5 + 𝑢7 ]; 𝑢9 = [𝑢6 + 𝑢8 + 10 + 4.5]
4 4
1
𝑢5 = [𝑢2 + 𝑢4 + 𝑢6 + 𝑢8 ]
4
Gauss seidal iteration values are tabulated as follows:

Iteration 𝒖𝟏 𝒖𝟐 𝒖𝟑 𝒖𝟒 𝒖𝟓 𝒖𝟔 𝒖𝟕 𝒖𝟖 𝒖𝟗
0 2.13 4.94
4.91
9.13 2.06 4.5 8.06 1.62 3.69 6.63
1 2.00 8.99 2.03 4.67 8.07 1.56 3.72 6.57
2 1.99 4.91 9.00 2.06 4.69 8.07 1.57 3.71 6.57
3 1.99 4.92 9.00 2.06 4.69 8.07 1.57 3.71 6.57
4 2.00 4.92 9.00 2.07 4.69 8.07 1.57 3.71 6.57
5 2.00 4.92 9.00 2.07 4.69 8.07 1.57 3.71 6.57
Hence the solution is𝒖𝟏 = 𝟐, 𝒖𝟐 = 𝟒. 𝟗𝟐, 𝒖𝟑 = 𝟗, 𝒖𝟒 = 𝟐. 𝟎𝟕, 𝒖𝟓 = 𝟒. 𝟔𝟗,
𝒖𝟔 = 𝟖. 𝟎𝟕, 𝒖𝟕 = 𝟏. 𝟓𝟕, 𝒖𝟖 = 𝟑. 𝟕𝟏𝒂𝒏𝒅𝒖𝟗 = 𝟔. 𝟓𝟕
Example 4 : Solve the Laplace equation 𝛁𝟐 𝒖 = 𝟎 inside the square the region bounded by the lines 𝒙 = 𝟎, 𝒙 = 𝟒, 𝒚 = 𝟎𝒂𝒏𝒅𝒚 = 𝟒 given that 𝒖 = 𝒙𝟐 𝒚𝟐 on the boundary.
Solution: Taking ℎ = 𝑘 = 1,The given region is divided into 16 sub-squares and the boundary values are specified below :

𝒖 = 𝒙𝟐 𝒚𝟐 𝒇𝒐𝒓 𝒚 = 𝟎, 𝟏, 𝟐, 𝟑, 𝟒

𝒚=𝟒
y 144
256
16 64
0
144
𝒖𝟏 𝒖𝟐 𝒖𝟑
4
𝒙=𝟎 0
𝒖=𝟎 𝒖𝟒 𝒖𝟓 𝒖𝟔
0 64 𝒙=𝟒
𝒖 = 𝒙𝟐 𝒚𝟐
𝒖𝟕 𝒖𝟖 𝒖𝟗
0 16
0 0 0 0 0
x 𝒚=𝟎
𝒖=𝟎
Let 𝑢1 , 𝑢2 , 𝑢3 , … … … 𝑢9 be the values of 𝑢 at the nine interior mesh points of the region respectively.
First we find the rough values of 𝑢
Using SFPF
1
𝑢5 = [0 + 64 + 0 + 64] = 32
4
Next to find𝒖𝟏 , 𝒖𝟑 , 𝒖𝟕, 𝒖𝟗 usingDFPF
1
𝑢1 = [0 + 32 + 0 + 64] = 24
4
1
𝑢3 = [64 + 64 + 32 + 256] = 104
4
1
𝑢7 = [0 + 0 + 0 + 32] = 8
4
1
𝑢9 = [0 + 32 + 64 + 0] = 24
4
We use SFPF to get the other values of 𝒖
1
𝑢2 = [64 + 32 + 24 + 104] = 56
4
1
𝑢4 = [0 + 32 + 24 + 8] = 16
4
1
𝑢6 = [64 + 32 + 104 + 24] = 56
4
1
𝑢8 = [32 + 0 + 8 + 64] = 26
4
Gauss-Seidal iterative scheme
1 1
𝑢1 = [0 + 16 + 𝑢2 + 𝑢4 ] ; 𝑢6 = [𝑢3 + 𝑢5 + 𝑢9 + 64]
4 4
1 1
𝑢2 = [𝑢1 + 𝑢3 + 𝑢5 + 64] ; 𝑢7 = [0 + 𝑢4 + 𝑢8 + 0]
4 4
1 1
𝑢3 = [𝑢2 + 𝑢6 + 144 + 144] ; 𝑢8 = 4 [𝑢5 + 𝑢7 + 𝑢8 + 0]
4
1 1
𝑢4 = [0 + 𝑢1 + 𝑢5 + 𝑢7 ]; 𝑢9 = [𝑢6 + 𝑢8 + 16 + 0]
4 4
1
𝑢5 = [𝑢2 + 𝑢4 + 𝑢6 + 𝑢8 ]
4
Gauss seidal iteration values are tabulated as follows:
I 𝒖𝟏 𝒖𝟐 𝒖𝟑 𝒖𝟒 𝒖𝟓 𝒖𝟔 𝒖𝟕 𝒖𝟖 𝒖𝟗
0 24 56 104 16 32 56 8 26 24
1 22 56 100 15.5 38.38 56.60 10.38 18.19 22.70
2 21.88 56.07 100.17 17.66 37.13 56 8.96 17.20 22.30
3 22.43 55.93 99.98 17.13 36.57 55.71 8.58 16.86 22.14
4 22.27 55.71 99.86 16.86 36.29 55.57 8.43 16.72 22.07
5 22.14 55.57 99.79 16.72 36.15 55.50 8.36 16.65 22.04
6 22.07 55.5 99.75 16.65 36.08 55.47 8.33 16.61 22.02
7 22.04 55.47 99.74 16.61 36.04 55.45 8.31 16.59 22.01 Hence the solution is𝒖𝟏 = 𝟐𝟐. 𝟎𝟏, 𝒖𝟐 = 𝟓𝟓. 𝟒𝟒, 𝒖𝟑 = 𝟗𝟕. 𝟕𝟐, 𝒖𝟒 = 𝟏𝟔. 𝟓𝟖,
8 22.02 55.45 99.73 16.59 36.04 55.44 8.30 16.58 22.01 𝒖𝟓 = 𝟑𝟔. 𝟎𝟏, 𝒖𝟔 = 𝟓𝟓. 𝟒𝟒, 𝒖𝟕 = 𝟖. 𝟐𝟗, 𝒖𝟖 = 𝟏𝟔. 𝟓𝟖𝒂𝒏𝒅𝒖𝟗 = 𝟐𝟐. 𝟎𝟏
9 22.01 55.44 99.72 16.59 36.01 55.44 8.29 16.58 22.01 POISSON EQUATION
10 22.01 55.44 99.72 16.58 36.01 55.44 8.29 16.58 22.01 𝝏𝟐 𝒖 𝝏𝟐 𝒖
Solution of Poisson equation𝝏𝒙𝟐 + 𝝏𝒚𝟐 = 𝒇(𝒙, 𝒚)[𝐄𝐥𝐥𝐢𝐩𝐭𝐢𝐜𝐭𝐲𝐩𝐞]

(or)𝛁𝟐 𝒖 = 𝒇(𝒙, 𝒚)
Where 𝑓(𝑥, 𝑦) is a function of 𝑥 and 𝑦.
Formula
𝒖𝒊−𝟏,𝒋 + 𝒖𝒊+𝟏,𝒋 + 𝒖𝒊,𝒋−𝟏 + 𝒖𝒊,𝒋+𝟏 − 𝟒𝒖𝒊,𝒋 = 𝒉𝟐 𝒇(𝒊𝒉, 𝒋𝒉) … … … … … … … (𝟏)
Applying this formula (1) at each internal mesh point, we get a system of linear equation in 𝑢𝑖 , where 𝑢𝑖 are the values of u at the internal mesh points. Solving the equation,
the values 𝑢𝑖 are known.

Example 1:

Solve the Poisson equation 𝛁𝟐 𝐮 = −𝟏𝟎(𝐱 𝟐 + 𝐲 𝟐 + 𝟏𝟎) over the square mesh with sides 𝒙 = 𝟎, 𝒚 = 𝟎, 𝒙 = 𝟑, 𝒚 = 𝟑 𝒂𝒏𝒅𝒖 = 𝟎 on the boundary. Assume mesh length 𝒉 = 𝟏 unit.
Solution:

0 0
0 0𝑗=3

A 𝒖𝟏 𝒖𝟐 B
0
0𝑗=2
𝑢=0

0 C 𝒖𝟑 𝒖𝟒 D
0𝑗=1

Here the mesh length ∆𝑥 = ℎ = 1


Let 𝑢1 , 𝑢2 , 𝑢03 , … … … 𝑢9 be
0 the values of 𝑢 0at the nine interior
0 mesh points of the region respectively.
The finite𝑥difference
𝑖 = 0 scheme
𝑖 = 1for Poisson equation
𝑖 = 2 is 𝑖=3
𝒖𝒊−𝟏,𝒋 + 𝒖𝒊+𝟏,𝒋 + 𝒖𝒊,𝒋−𝟏 + 𝒖𝒊,𝒋+𝟏 − 𝟒𝒖𝒊,𝒋 = 𝒉𝟐 𝒇(𝒊𝒉, 𝒋𝒉)
Put𝒉 = 𝟏 in the above, we get
𝑢𝑖−1,𝑗 + 𝑢𝑖+1,𝑗 + 𝑢𝑖,𝑗−1 + 𝑢𝑖,𝑗+1 − 4𝑢𝑖,𝑗 = 𝑓(𝑖, 𝑗)
𝑢𝑖−1,𝑗 + 𝑢𝑖+1,𝑗 + 𝑢𝑖,𝑗−1 + 𝑢𝑖,𝑗+1 − 4𝑢𝑖,𝑗 = −𝟏𝟎(𝒊𝟐 + 𝒋𝟐 + 𝟏𝟎) ……………… [1]
Applying [1]at𝑨(𝒊 = 𝟏, 𝒋 = 𝟐);
0 + 0 + 𝑢2 + 𝑢3 − 4𝑢1 = −10(15)
⇒ 𝑢2 + 𝑢3 − 4𝑢1 = −150…………………… [2]
Applying [1]at(𝒊 = 𝟐, 𝒋 = 𝟐) ;
0 + 0 + 𝑢1 + 𝑢4 − 4𝑢2 = −10(4 + 4 + 10)
⇒ 𝑢1 + 𝑢4 − 4𝑢2 = −180……………… [3]
Applying [1]at𝑪(𝒊 = 𝟏, 𝒋 = 𝟏);
⇒ 𝑢1 + 𝑢4 − 4𝑢3 = −120……………… [4]
Applying [1]atD(𝒊 = 𝟐, 𝒋 = 𝟏);
⇒ 𝑢2 + 𝑢3 − 4𝑢4 = −150……………… [5]
Now [𝟐] − [𝟓], we get
𝑢2 + 𝑢3 − 4𝑢1 = −150……………… [6]
2𝑢1 − 4𝑢2 = −180……………… [7]
2𝑢1 − 4𝑢3 = −120……………… [8]
Gauss seidal iterative scheme
From [6]
−4𝑢1 = −150 − 𝑢2 − 𝑢3
1
𝑢1 = [150 + 𝑢2 + 𝑢3 ]
4
From [7]
1
𝑢2 = [180 + 2𝑢1 ]
4
From [8]
1
𝑢3 = [120 + 2𝑢1 ]
4
Let us assume𝑢2 = 𝑢3 = 0
The iterated values are tabulated as follows:
Iteration 𝒖𝟏 = 𝒖𝟒 𝒖𝟐 𝒖𝟑
1 37.5 63.75 48.75
2 65.63 77.82 62.82
3 72.66 81.33 66.33
4 74.42 82.21 67.21
5 74.86 82.43 67.43
6 74.97 82.48 67.49
7 74.99 82.50 67.50
8 75.00 82.50 67.50
9 75.00 82.50 67.50

Hence the solution is


∴ 𝒖𝟏 = 𝒖𝟒 = 𝟕𝟓, 𝒖𝟐 = 𝟖𝟐. 𝟓 𝒂𝒏𝒅𝒖𝟑 = 𝟔𝟕. 𝟓
Example 2 :
𝝏𝟐 𝒖 𝝏𝟐 𝒖
Solve the Poisson equation 𝝏𝒙𝟐 + 𝝏𝒚𝟐 = −𝟖𝟏𝒙𝒚 , 𝟎 < 𝑥 < 1 ; 0 < 𝑦 < 1
𝒂𝒏𝒅𝒖(𝟎, 𝒚) = 𝒖(𝒙, 𝟎) = 𝟎, 𝒖(𝒙, 𝟏) = 𝒖(𝟏, 𝒚) = 𝟏𝟎𝟎 with the square meshes, each of length 𝒉 = 𝟏/𝟑.
Solution:

𝑦=1
𝑦 100 100
0 100

A 𝒖𝟏 𝒖𝟐 B
0
100
𝑥=0
𝑥=1
ℎ = 1/3
C 𝒖𝟑 𝒖𝟒 D
100
0

0 0 0 0 𝑥
𝑦 = 0 , ℎ = 1/3

Let the values of u at the interior mesh points be𝑢1 , 𝑢2 , 𝑢3 , 𝑢4 .


The Finite difference scheme for Poisson equation is
𝒖𝒊−𝟏,𝒋 + 𝒖𝒊+𝟏,𝒋 + 𝒖𝒊,𝒋−𝟏 + 𝒖𝒊,𝒋+𝟏 − 𝟒𝒖𝒊,𝒋 = 𝒉𝟐 𝒇(𝒊𝒉, 𝒋𝒉)
𝑢𝑖−1,𝑗 + 𝑢𝑖+1,𝑗 + 𝑢𝑖,𝑗−1 + 𝑢𝑖,𝑗+1 − 4𝑢𝑖,𝑗 = ℎ2 [(−81)(𝑖ℎ)(𝑗ℎ)]
𝟏
Put𝒉 = 𝟑
81 1
𝑢𝑖−1,𝑗 + 𝑢𝑖+1,𝑗 + 𝑢𝑖,𝑗−1 + 𝑢𝑖,𝑗+1 − 4𝑢𝑖,𝑗 = ( ) (𝑖𝑗)
9 9
𝒖𝒊−𝟏,𝒋 + 𝒖𝒊+𝟏,𝒋 + 𝒖𝒊,𝒋−𝟏 + 𝒖𝒊,𝒋+𝟏 − 𝟒𝒖𝒊,𝒋 = −𝒊𝒋 … … … … … … … … (𝟏)

Applying (1) at 𝑨(𝒊 = 𝟏, 𝒋 = 𝟐)


0 + 100 + 𝑢2 + 𝑢3 − 4𝑢1 = −2
⇒ 𝑢2 + 𝑢3 − 4𝑢1 = −102 … … … … … … . (𝟐)
Applying (1) at 𝑩(𝒊 = 𝟐, 𝒋 = 𝟐)
𝑢1 + 𝑢4 − 4𝑢2 = −204 … … … … … … … … … … (𝟑)
Applying (1) at 𝑪(𝒊 = 𝟏, 𝒋 = 𝟏)
𝑢1 + 𝑢4 − 4𝑢3 = −1 … … … … … … … … … … … (𝟒)
Applying (1) at 𝑫(𝒊 = 𝟐, 𝒋 = 𝟏)
𝑢2 + 𝑢3 − 4𝑢4 = −102 … … … … … … … … … … (𝟓)
From (2) and (5),we get 𝒖𝟏 = 𝒖𝟒
Put 𝑢1 = 𝑢4 , the four equations reduces to three equations
𝑢2 + 𝑢3 − 4𝑢1 = −102 … … … … … … … … (𝟔)
2𝑢1 − 4𝑢2 = −204 … … … … … … (𝟕)
2𝑢1 − 4𝑢3 = −1 … … … … … … (𝟖)
Gauss seidal iterative scheme
1
𝑢1 = [102 + 𝑢2 + 𝑢3 ]
4
1
𝑢2 = [204 + 2𝑢1 ]
4
1
𝑢3 = [1 + 2𝑢1 ]
4
Let us assume𝑢2 = 𝑢3 = 0
The iterated values are tabulated as follows:
Iteration 𝒖𝟏 = 𝒖𝟒 𝒖𝟐 𝒖𝟑
1 25.5 63.8 13
2 44.7 73.4 22.6
3 49.5 75.8 25
4 50.7 76.4 25.6
5 51.0 76.5 25.8
6 51.1 76.5 25.8
7 51.1 76.5 25.8

Hence the solution is


∴ 𝒖𝟏 = 𝒖𝟒 = 𝟓𝟏. 𝟏, 𝒖𝟐 = 𝟕𝟔. 𝟓 𝒂𝒏𝒅𝒖𝟑 = 𝟐𝟓. 𝟖
Example 3 : Solve the Poisson equation 𝛁𝟐 = 𝟖𝒙𝟐 𝒚𝟐 for square mesh given 𝒖 = 𝟎 on the boundaries dividing the square into 16 sub-squares of length 1 unit.
Solution:
Y

0 0 0 0 0

u1 u2 u3 j=1
0 A B C 0
u4 u5 u6 j=0
X 0 D E F 0
u7 u8 u9
0 G H I 0 j=-1

0 0 0 0 0
i=-1 i=0 i=1

Given that the mesh length is ∆𝒙 = 𝒉 = 𝟏


Let𝒖𝟏 , 𝒖𝟐 , 𝒖𝟑 , … … … 𝒖𝟗 be the values of 𝑢 at the nine interior mesh points of the region respectively.
The finite difference scheme for Poisson equation is
𝒖𝒊−𝟏,𝒋 + 𝒖𝒊+𝟏,𝒋 + 𝒖𝒊,𝒋−𝟏 + 𝒖𝒊,𝒋+𝟏 − 𝟒𝒖𝒊,𝒋 = 𝒉𝟐 𝒇(𝒊𝒉, 𝒋𝒉)
Put𝒉 = 𝟏 in the above, we get
𝑢𝑖−1,𝑗 + 𝑢𝑖+1,𝑗 + 𝑢𝑖,𝑗−1 + 𝑢𝑖,𝑗+1 − 4𝑢𝑖,𝑗 = 𝑓(𝑖, 𝑗)
𝒖𝒊−𝟏,𝒋 + 𝒖𝒊+𝟏,𝒋 + 𝒖𝒊,𝒋−𝟏 + 𝒖𝒊,𝒋+𝟏 − 𝟒𝒖𝒊,𝒋 = 𝟖𝒊𝟐 𝒋𝟐 … … … … … … (𝟏)
Applying (1) at 𝑨(𝒊 = −𝟏, 𝒋 = 𝟏)
0 + 𝑢2 + 𝑢4 + 0 − 4𝑢1 = 8(−1)2 (1)2
⇒ 𝑢2 + 𝑢4 − 4𝑢1 = 8 … … … … … … . (𝟐)
Applying (1) at 𝑩(𝒊 = 𝟎, 𝒋 = 𝟏)
𝑢1 + 𝑢3 + 𝑢5 − 4𝑢2 = 0 … … … … … … … … … … (𝟑)
Applying (1) at 𝑪(𝒊 = 𝟏, 𝒋 = 𝟏)
𝑢2 + 𝑢6 − 4𝑢3 = 8 … … … … … … … … … … … (𝟒)
Applying (1) at 𝑫(𝒊 = −𝟏, 𝒋 = 𝟎)
𝑢1 + 𝑢5 + 𝑢7 − 4𝑢4 = 0 … … … … … … … … … … (𝟓)
Applying (1) at 𝑬(𝒊 = 𝟎, 𝒋 = 𝟎)
𝑢4 + 𝑢6 + 𝑢2 + 𝑢8 − 4𝑢5 = 0 … … … … … … … … … … (𝟔)
Applying (1) at 𝑭(𝒊 = 𝟏, 𝒋 = 𝟎)
𝑢5 + 𝑢3 + 𝑢9 − 4𝑢6 = 0 … … … … … … … … … … … (𝟕)
Applying (1) at 𝑮(𝒊 = −𝟏, 𝒋 = −𝟏)
𝑢8 + 𝑢4 − 4𝑢7 = 8 … … … … … … … … … … (𝟖)
Applying (1) at 𝑯(𝒊 = 𝟎, 𝒋 = −𝟏)
𝑢7 + 𝑢5 + 𝑢9 − 4𝑢8 = 0 … … … … … … … … … … … (𝟗)
Applying (1) at 𝑰(𝒊 = 𝟏, 𝒋 = −𝟏)
𝑢8 + 𝑢6 − 4𝑢9 = 8 … … … … … … … … … … (𝟏𝟎)
Gauss-seidal iterative scheme
1 1
From (2), 𝑢1 = 4 [𝑢2 + 𝑢4 − 8]; From (6), 𝑢5 = 4 [𝑢4 + 𝑢6 + 𝑢2 + 𝑢8 ]
1 1
From (3), 𝑢2 = 4 [𝑢1 + 𝑢3 + 𝑢5 ]; From (7), 𝑢6 = 4 [𝑢3 + 𝑢5 + 𝑢9 ]
1 1
From (4), 𝑢3 = 4 [𝑢2 + 𝑢6 − 8]; From (8), 𝑢7 = 4 [𝑢4 + 𝑢8 − 8]
1 1
From (5), 𝑢4 = 4 [𝑢1 + 𝑢5 + 𝑢7 ]; 𝐅𝐫𝐨𝐦 (𝟗), 𝑢8 = 4 [𝑢5 + 𝑢7 + 𝑢9 ]
1
From (10), 𝑢9 = 4 [𝑢6 + 𝑢8 − 8]

Let us assume 𝑢2 = 𝑢3 = 𝑢4 = 𝑢5 = 𝑢6 = 𝑢7 = 𝑢8 = 𝑢9 = 0
The iterated values are tabulated as follows:
I 𝒖𝟏 𝒖𝟐 𝒖𝟑 𝒖𝟒 𝒖𝟓 𝒖𝟔 𝒖𝟕 𝒖𝟖 𝒖𝟗
1 -2 -0.5 -2.1 -0.5 -0.3 -0.6 -2.1 -0.6 -2.3
2 -2.3 -1.2 -2.5 -1.2 -0.9 -1.4 -2.5 -1.4 -2.7
3 -2.6 -1.5 -2.7 -1.5 -1.5 -1.7 -2.7 -1.7 -2.9
4 -2.8 -1.8 -2.9 -1.8 -1.8 -1.9 -2.9 -1.9 -3.0
5 -2.9 -1.9 -3.0 -1.9 -1.9 -2.0 -3.0 -2.0 -3.0
6 -3.0 -2.0 -3.0 -2.0 -2.0 -2.0 -3.0 -2.0 -3.0
7 -3.0 -2.0 -3.0 -2.0 -2.0 -2.0 -3.0 -2.0 -3.0
Hence the solution is𝒖𝟏 = −𝟑, 𝒖𝟐 = −𝟐, 𝒖𝟑 = −𝟑, 𝒖𝟒 = −𝟐,
𝒖𝟓 = −𝟐, 𝒖𝟔 = −𝟐, 𝒖𝟕 = −𝟑, 𝒖𝟖 = −𝟐𝒂𝒏𝒅𝒖𝟗 = −𝟑
Practice Problems:
𝜕2𝑢 𝜕2𝑢
1.Solve the Poisson equation + = 𝑒 𝑥𝑦 (𝑥 2 + 𝑦 2 ) , 0 < 𝑥 < 1 ; 0 < 𝑦 < 1
𝜕𝑥 2 𝜕𝑦2
𝑢(0, 𝑦) = 1; 𝑢(1, 𝑦) = 𝑒 𝑦 ; 0 ≤ 𝑦 ≤ 1 𝑎𝑛𝑑 𝑢(𝑥, 0) = 1, 𝑢(𝑥, 1) = 𝑒 𝑥 ;
0 ≤ 𝑥 ≤ 1usingℎ = 𝑘 = 1/3.
ANS: 𝒖𝟏 = 𝒖𝟒 = 𝟏. 𝟐𝟐𝟓𝟖, 𝒖𝟐 = 𝟏. 𝟒𝟕𝟖𝟓, 𝒖𝟑 = 𝟏. 𝟏𝟎𝟔𝟎
𝜕2𝑢 𝜕2𝑢
2. Solve the Poisson equation𝜕𝑥 2 + 𝜕𝑦2 = −36(x 2 + y 2 + 5)subject to the condition with sides𝑢 = 0 at𝑥 = 0 and𝑥 = 3 ; 𝑢 = 0 at 𝑦 = 0 𝑎𝑛𝑑
𝑢 = 1 at 𝑦 = 3 for 0 < 𝑥 < 3 Find the solution taking ℎ = 1 with a square mesh.
ANS:𝒖𝟏 = 𝟐𝟓𝟐. 𝟒, 𝒖𝟐 = 𝟑𝟏𝟓. 𝟒, 𝒖𝟑 = 𝟏𝟖𝟗. 𝟏; 𝒖𝟒 = 𝟐𝟓𝟐. 𝟏
PREVIOUS YEAR ANNA UNIVERSITY QUESTION PAPERS

PART-A NOV/DEC 2014


1. What is the central difference approximation for 𝑦 ′′ .
2. Write down the standard five-point formula to find the numerical solution of Laplace equation.
PART-B
𝜕2𝑢 𝜕2𝑢
(a) By iteration method, solve the elliptic equation 𝜕𝑥 2 + 𝜕𝑦2 = 0 over a square region of side 4, satisfying the boundary conditions.

(𝑖) 𝑢(0, 𝑦) = 0, 0 ≤ 𝑦 ≤ 4
(𝑖𝑖) 𝑢(4, 𝑦) = 12 + 𝑦, 0 ≤ 𝑦 ≤ 4
(𝑖𝑖𝑖) 𝑢(𝑥, 0) = 3𝑥, 0 ≤ 𝑥 ≤ 4
(𝑖𝑣)𝑢(𝑥, 4) = 𝑥 2 , 0 ≤ 𝑥 ≤ 4
By dividing the square into 16 square meshes of side 1 and always correcting the computed values to two places of decimals, obtain the values of 𝑢 at 9
interior pivotal points.
𝜕2𝑢 𝜕𝑢
(b)Solve by Crank-Nicolson’s method 𝜕𝑥 2 = 0 < 𝑥 < 1, 𝑡 > 0 satisfying the conditions 𝑢(0, 𝑡) = 0, 𝑢(1, 𝑡) = 0 𝑎𝑛𝑑 𝑢(𝑥, 0) = 100𝑥(1 − 𝑥).
𝜕𝑡
1 1
Compute 𝑢 for one time step with ℎ = 4 and 𝑘 = 64.

PART-A MAY/JUN 2014


1. Obtain the finite difference scheme for the differential equation
2𝑦 ′′ (𝑥) + 𝑦(𝑥) = 5..
2. State whether the Crank Nicholson’s scheme is an explicit or implicit scheme. Justify.
PART-B
𝜕2𝑢 𝜕𝑢
(i)(a)Using Bender-Schmidt’s method Solve = given 𝑢(0, 𝑡) = 0,
𝜕𝑥 2 𝜕𝑡

𝑢(1, 𝑡) = 0, 𝑢(𝑥, 0) = 𝑠𝑖𝑛𝜋𝑥, 0 < 𝑥 < 1 and ℎ = 0.2. Find the values of
𝑢 upto 𝑡 = 0.1
(ii)(a)Solve 𝑦 ′′ − 𝑦 = 𝑥,𝑥 ∈ (0,1) given 𝑦(0) = 𝑦(1) = 0 using finite differences by dividing the interval into four equal parts.
(b)Solve the Poisson equation∇2 𝑢 = −10(𝑥 2 + 𝑦 2 + 10) 0 ≤ 𝑥 ≤ 3,
0 ≤ 𝑦 ≤ 3, 𝑢 = 0 on the boundary.
PART-A NOV/DEC 2013
𝑑 2𝑦
1. Solve the wave equation − 𝑥𝑦 = 0, , 𝑦(0) = −1, 𝑦(1) = 2 𝑏𝑦 finite difference method taking 𝑛 = 2
𝑑𝑥 2

2. Write down the Leibmann’s iteration process to solve the Laplace equation.
PART-B
𝜕2𝑢 𝜕𝑢 1
(a) Using Crank-Nicholson’s method, solve numerically = 16 with boundary conditions 𝑢(𝑥, 0) = 0, 𝑢(0, 𝑡) = 0 and 𝑢(1, 𝑡) = 50𝑡 taking ℎ =
𝜕𝑥 2 𝜕𝑡 4
𝜕2𝑢 𝜕2𝑢
(b) Solve the elliptic equation 𝜕𝑥 2 + 𝜕𝑦2 = 0 for the following square mesh with boundary values as given below:

1 4 9 16
0
0 14 u1 u2 u3
0 12 u4 u5 u6
0 10 u7 u8 u9

0 0.5 2 4.5 8

PART-A MAY/JUN 2013


1. Obtain the finite difference scheme for the differential equation
2𝑦 ′′ + 𝑦 = 5.
2. Write Liebmann’s iteration process.
PART-B
a)Solve ∇2 𝑢 = 8𝑥 2 𝑦 2 over the square 𝑥 = −2, 𝑥 = 2, 𝑦 = −2, 𝑦 = 2 with
𝑢 = 0 on the boundary and mesh length= 1
b)(i) Solve 𝑢𝑥𝑥 = 32𝑢𝑡 , ℎ = 0.25 for 𝑡 ≥ 0, 0 < 𝑥 < 1, 𝑢(0, 𝑡) = 0, 𝑢(𝑥, 0) = 0,
𝑢(1, 𝑡) = 𝑡.
(ii) Solve 4𝑢𝑡𝑡 = 𝑢𝑥𝑥 , 𝑢(0, 𝑡) = 0, 𝑢(4, 𝑡) = 0, 𝑢(𝑥, 0) = 𝑥(4 − 𝑥),
𝑢𝑡 (𝑥, 0) = 0, ℎ = 1 𝑢𝑝𝑡𝑜 𝑡 = 4
PART-A NOV/DEC 2012
1. State the Crank-Nicholson’s difference scheme.
2. Write down Bender-Schmidt’s difference scheme in general form and using
suitable values of 𝜆, write the scheme in simplified form.
PART-B
(a) (i) Solve 𝑦 ′′ − 𝒚 = 𝟎with the boundary conditions 𝑦(0) = 0 and 𝑦(1) = 1
𝜕2𝑢 𝜕2𝑢
(ii) Solve the equation 𝜕𝑥 2 = 𝜕𝑡 2
, 0 < 𝑥 < 1, 𝑡 > 0 satisfying the conditions
𝜕𝑢 1
𝑢(𝑥, 0) = 0, (𝑥, 0) = 0, 𝑢(0, 𝑡) = 0 and 𝑢(1, 𝑡) = 𝑠𝑖𝑛𝜋𝑡. Compute
𝜕𝑡 2
1
𝑢(𝑥, 𝑡)for 4 time steps by taking ℎ = .
4

(b) Solve the Poisson equation ∇ 𝑢 = −10(𝑥 2 + 𝑦 2 + 10) over the square mesh
2

with sides 𝑥 = 0, 𝑦 = 0, 𝑥 = 3 and 𝑦 = 3 with 𝑢 = 0 on the boundary and mesh


length 1 unit.
PART-A MAY/JUN 2012
′′
1. What is the central difference approximation for𝑦 .
2. Write the difference scheme for solving the Poisson equation ∇2 𝑢 = 𝑓(𝑥, 𝑦).
PART-B
Solve the elliptic equation 𝑢𝑥𝑥 + 𝑢𝑦𝑦 = 0 for the following square mesh with boundary values as shown below:
(b) (i) Solve the equation 𝑦 ′′ = 𝒙 + 𝒚 with the boundary conditions
𝒚(𝟎) = 𝒚(𝟏) = 𝟎
𝜕2𝑢 𝜕𝑢
(ii)Solve 𝜕𝑥 2 = 𝜕𝑡
, subject to 𝑢(0, 𝑡) = 𝑢(1, 𝑡) = 0 and 𝑢(𝑥, 0) = 𝑠𝑖𝑛𝜋𝑥,

0 < 𝑥 < 1,using Bender-schmidt method.


PART-A NOV/DEC 2011
1. Classify the PDE y (𝑥0 ) = 𝑦0
2. State standard five point formula with relevant diagram..
PART-B
(a) Using the finite difference method, compute (0.5), given
𝒚′′ − 𝟔𝟒𝒚 + 𝟏𝟎 = 𝟎, 𝑥 ∈ (0,1), 𝑦(0) = 𝑦(1) = 0. sub dividing the interval
into (i)4 equal parts (ii) 2 equal parts.
b)Solve ∇2 𝑢 = 8𝑥 2 𝑦 2 for the square mesh given 𝑢 = 0 on the four boundaries dividing the square into 16 sub-squares of length 1 unit.

PART-A MAY/JUN 2011


1. State the implicit scheme to solve one dimensional heat equation numerically.
2. Write the difference quotients of 𝑢𝑥𝑥 and 𝑢𝑦𝑦 .
PART-B
𝜕2𝑢 𝜕2𝑢
(a) By iteration method, solve the elliptic equation 𝜕𝑥 2 + 𝜕𝑦2 = 0 over a square region of side 4, satisfying the boundary conditions.

(𝑖) 𝑢(0, 𝑦 ) = 0, 0 ≤ 𝑦 ≤ 4
(𝑖𝑖) 𝑢(4, 𝑦) = 12 + 𝑦, 0 ≤ 𝑦 ≤ 4
(𝑖𝑖𝑖) 𝑢(𝑥, 0) = 3𝑥, 0 ≤ 𝑥 ≤ 4
(𝑖𝑣)𝑢(𝑥, 4) = 𝑥 2 , 0 ≤ 𝑥 ≤ 4

(b) (i) Solve 𝑢𝑥𝑥 − 𝑢𝑡𝑡 = 0 given 𝑢(0, 𝑡) = 0, 𝑢(4, 𝑡) = 0,


𝑢(𝑥, 0) = 𝑥(4 − 𝑥).Assume ℎ = 1. Find the values of 𝑢 upto t=5, using explicit method.
(c) (ii) Solve 25𝑢𝑥𝑥 − 2𝑢𝑡 = 0 for 𝑢 at the pivotal points,given
𝑢(0, 𝑡) = 𝑢(5, 𝑡) = 𝑢𝑡 (𝑥, 0) = 0, and 𝑢(𝑥, 0) = 2𝑥 for 0 < 𝑥 < 2.5 and = 10 − 2𝑥 for 2.5 < 𝑥 < 5 for one half period of vibration.
PART-A MAY/JUN 2010
1. Write down the explicit finite difference method for solving one dimensional wave equation.
2. Write down the standard five point formula to find the numerical solution of Laplace equation.
PART-B
(a) Deduce the standard five point formula for ∇2 𝑢 = 0. Hence, solve it over the square region given by the boundary conditions as in the figure below:
u1 u2
u3 u4

𝑘𝑐 2
(b) Obtain the Crank-Nicholson finite difference by taking 𝜆 = = 1.
ℎ2
𝜕2𝑢 𝜕𝑢
Hence, find 𝑢(𝑥, 𝑡) in the rod for two times steps for the heat equation = , given 𝑢(𝑥, 0) = 𝑠𝑖𝑛𝜋𝑥, 𝑢(0, 𝑡) = 0, 𝑢(1, 𝑡) = 0. Take ℎ = 0.2
𝜕𝑥 2 𝜕𝑡

You might also like