Week 14
Week 14
DIFFERENTIAL EQUATIONS
2
Second Order Linear Partial Differential Equation
- Separation of
variables
- Integral Parabolic Hyperbolic Elliptic
transform eqn. eqn. eqn.
- Characteristic
etc.
Backward-Difference Formula:
𝜕𝜕𝜕𝜕 𝑢𝑢𝑖𝑖,𝑗𝑗 − 𝑢𝑢𝑖𝑖,𝑗𝑗−1 𝜕𝜕𝜕𝜕 𝑢𝑢𝑖𝑖,𝑗𝑗 − 𝑢𝑢𝑖𝑖−1,𝑗𝑗
= =
𝜕𝜕𝜕𝜕 𝑖𝑖,𝑗𝑗 𝑘𝑘 𝜕𝜕𝜕𝜕 𝑖𝑖,𝑗𝑗
ℎ
Central-Difference Formula:
𝜕𝜕𝜕𝜕 𝑢𝑢𝑖𝑖,𝑗𝑗+1 − 𝑢𝑢𝑖𝑖,𝑗𝑗−1 𝜕𝜕𝜕𝜕 𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 𝑢𝑢𝑖𝑖−1,𝑗𝑗
= =
𝜕𝜕𝜕𝜕 𝑖𝑖,𝑗𝑗 2𝑘𝑘 𝜕𝜕𝜕𝜕 𝑖𝑖,𝑗𝑗
2ℎ
2 − 𝑐𝑐 2 =0
𝜕𝜕𝑡𝑡 𝑖𝑖,𝑗𝑗 𝜕𝜕𝑥𝑥 2 𝑖𝑖,𝑗𝑗
is approximated to
6
Step 1: Sketch the grid points.
Recall:
𝑗𝑗 𝑡𝑡
0 ≤ 𝑥𝑥 ≤ 1, 0 ≤ 𝑡𝑡 ≤ 1
3 1 ℎ = 0.5 and 𝑘𝑘 = 1/3
2 2/3
1 1/3
0 𝑥𝑥
0 0.5 1
0 1 2 𝑖𝑖 7
Step 2: Compute boundary and initial values.
8
Step 3: Fill in the values into the grid.
𝑦𝑦
𝑗𝑗
0 𝑢𝑢1,3 0
3 1
0 𝑢𝑢1,2
2 2/3 0
0 𝑢𝑢1,1
1 1/3 0
0 0 0
0 𝑥𝑥
0 0.5 1
0 1 2 𝑖𝑖 9
Step 4: Obtain formula 𝑢𝑢𝑖𝑖,𝑗𝑗+1 from difference formula.
By central-difference formulas,
𝜕𝜕 2 𝑢𝑢 𝜕𝜕 2 𝑢𝑢 𝜕𝜕 2 𝑢𝑢 𝜕𝜕 2 𝑢𝑢
=4 2 2 −4 2 =0
𝜕𝜕𝑡𝑡 2 𝜕𝜕𝑥𝑥 𝜕𝜕𝑡𝑡 𝑖𝑖,𝑗𝑗
𝜕𝜕𝑥𝑥 𝑖𝑖,𝑗𝑗
10
Step 4: Obtain formula 𝑢𝑢𝑖𝑖,𝑗𝑗+1 from difference formula.
By central-difference formulas,
𝜕𝜕 2 𝑢𝑢 𝜕𝜕 2 𝑢𝑢 Recall:
−4 =0
𝜕𝜕𝑡𝑡 2 𝑖𝑖,𝑗𝑗
𝜕𝜕𝑥𝑥 2 𝑖𝑖,𝑗𝑗 ℎ = 0.5 and 𝑘𝑘 = 1/3
is approximated to
By central-difference formulas,
𝜕𝜕𝑢𝑢 𝑢𝑢𝑖𝑖,𝑗𝑗+1 − 𝑢𝑢𝑖𝑖,𝑗𝑗−1
=
𝜕𝜕𝜕𝜕 𝑖𝑖,𝑗𝑗
2𝑘𝑘
12
Step 4: Obtain formula 𝑢𝑢𝑖𝑖,𝑗𝑗+1 from difference formula. Recall:
ℎ = 0.5 and 𝑘𝑘 = 1/3
From the initial velocity,
𝜕𝜕𝑢𝑢 𝜕𝜕𝑢𝑢 𝜕𝜕𝑢𝑢
𝜕𝜕𝜕𝜕
𝑥𝑥, 0 = 4 discretized 𝜕𝜕𝜕𝜕
𝑥𝑥𝑖𝑖 , 0 =
𝜕𝜕𝜕𝜕 𝑖𝑖,𝑗𝑗=0
=4
By central-difference formulas,
𝜕𝜕𝑢𝑢 𝑢𝑢𝑖𝑖,𝑗𝑗+1 − 𝑢𝑢𝑖𝑖,𝑗𝑗−1
=
𝜕𝜕𝜕𝜕 𝑖𝑖,𝑗𝑗
2𝑘𝑘
Hence,
𝜕𝜕𝑢𝑢 𝑢𝑢𝑖𝑖,1 −𝑢𝑢𝑖𝑖,−1
= =4
𝜕𝜕𝜕𝜕 𝑖𝑖,𝑗𝑗=0 2(1/3)
is approximated to
𝑢𝑢𝑖𝑖,1 − 𝑢𝑢𝑖𝑖,−1 = 8/3
𝑢𝑢𝑖𝑖,−1 = 𝑢𝑢𝑖𝑖,1 − 8/3
13
Step 5: Compute solutions for internal points 𝑢𝑢𝑖𝑖,𝑗𝑗 (Refer to grid in Step 3).
16 14 16
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 𝑢𝑢𝑖𝑖−1,𝑗𝑗 − 𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 𝑢𝑢𝑖𝑖,𝑗𝑗−1
9 9 9
𝑢𝑢𝑖𝑖,−1 = 𝑢𝑢𝑖𝑖,1 − 8/3
Let 𝑖𝑖 = 1, 𝑗𝑗 = 0,
16 14 16
𝑢𝑢1,1 = 𝑢𝑢0,0 − 𝑢𝑢1,0 + 𝑢𝑢2,0 − 𝑢𝑢1,−1
9 9 9
16 14 16 8
𝑢𝑢1,1 = (0) − (0) + (0) − (𝑢𝑢1,1 − )
9 9 9 3
2𝑢𝑢1,1 = 2.6667
𝑢𝑢1,1 = 1.3333
14
Step 5: Compute solutions for internal points 𝑢𝑢𝑖𝑖,𝑗𝑗 (Refer to grid in Step 3).
16 14 16
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 𝑢𝑢𝑖𝑖−1,𝑗𝑗 − 𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 𝑢𝑢𝑖𝑖,𝑗𝑗−1
9 9 9
Let 𝑖𝑖 = 1, 𝑗𝑗 = 1,
16 14 16
𝑢𝑢1,2 = 𝑢𝑢0,1 − 𝑢𝑢1,1 + 𝑢𝑢2,1 − 𝑢𝑢1,0
9 9 9
16 14 16
𝑢𝑢1,2 = (0) − (1.3333) + (0) − 0
9 9 9
𝑢𝑢1,2 = −2.0740
15
Step 5: Compute solutions for internal points 𝑢𝑢𝑖𝑖,𝑗𝑗 (Refer to grid in Step 3).
16 14 16
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 𝑢𝑢𝑖𝑖−1,𝑗𝑗 − 𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 𝑢𝑢𝑖𝑖,𝑗𝑗−1
9 9 9
Let 𝑖𝑖 = 1, 𝑗𝑗 = 2,
16 14 16
𝑢𝑢1,3 = 𝑢𝑢0,2 − 𝑢𝑢1,2 + 𝑢𝑢2,2 − 𝑢𝑢1,1
9 9 9
16 14 16
𝑢𝑢1,3 = (0) − (−2.0740) + (0) − 1.3333
9 9 9
𝑢𝑢1,3 = 1.8929
16
Step 6: Fill in the values into the grid.
𝑗𝑗 𝑦𝑦
0 1.8929 0
3 1
0 −2.0740
2 2/3 0
0 1.3333
1 1/3 0
0 0 0
0 𝑥𝑥
0 0.5 1
0 1 2 𝑖𝑖 17
Example 5.20:
Approximate the solution for the following wave equation
𝜕𝜕 2 𝑢𝑢 𝜕𝜕 2 𝑢𝑢
= , 0 < 𝑥𝑥 < 1, 𝑡𝑡 > 0
𝜕𝜕𝑡𝑡 2 𝜕𝜕𝑥𝑥 2
18
Solution:
Step 1: Sketch the grid points.
Recall:
𝑗𝑗 𝑡𝑡
0 ≤ 𝑥𝑥 ≤ 1, 0 ≤ 𝑡𝑡 ≤ 1
ℎ = 1/3 and 𝑘𝑘 = 0.5
2 1
1 0.5
0 𝑥𝑥
0 1/3 2/3 1
0 1 2 3 𝑖𝑖 19
Step 2: Compute boundary and initial values.
Recall:
𝒖𝒖 𝒙𝒙, 𝟎𝟎 = 𝒙𝒙(𝒙𝒙 − 𝟏𝟏), 𝟎𝟎 ≤ 𝒙𝒙 ≤ 𝟏𝟏
ℎ = 1/3 and 𝑘𝑘 = 0.5
𝑢𝑢 0, 0 = 0
𝑢𝑢 0.3333, 0 = −0.2222
𝑢𝑢 0.6667, 0 = −0.2222
𝑢𝑢 1, 0 = 0
20
Step 3: Fill in the values into the grid.
Boundary and initial conditions are
𝑗𝑗 𝑦𝑦 symmetrical about the line 𝑥𝑥 = 0.5.
Hence, 𝑢𝑢1,1 = 𝑢𝑢2,1 and 𝑢𝑢1,2 = 𝑢𝑢2,2
0 𝑢𝑢1,2 𝑢𝑢2,2
2 1 0
0 𝑢𝑢1,1 𝑢𝑢2,1
1 0.5 0
0 −0.2222 −0.2222 0
0 𝑥𝑥
0 1/3 2/3 1
0 1 2 3 𝑖𝑖
21
Step 4: Obtain formula 𝑢𝑢𝑖𝑖,𝑗𝑗+1 from difference formula.
By central-difference formulas,
𝜕𝜕 2 𝑢𝑢 𝜕𝜕 2 𝑢𝑢 Recall:
− =0 ℎ = 1/3 and 𝑘𝑘 = 0.5
𝜕𝜕𝑡𝑡 2 𝑖𝑖,𝑗𝑗 𝜕𝜕𝑥𝑥 2 𝑖𝑖,𝑗𝑗
is approximated to
𝑢𝑢𝑖𝑖,𝑗𝑗+1 − 2𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖,𝑗𝑗−1 𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 2𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖−1,𝑗𝑗
− =0
𝑘𝑘 2 ℎ2
𝑘𝑘 2
𝑢𝑢𝑖𝑖,𝑗𝑗+1 − 2𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖,𝑗𝑗−1 = 2 𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 2𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖−1,𝑗𝑗
ℎ
0.5 2
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 𝑢𝑢 − 2𝑢𝑢𝑖𝑖,𝑗𝑗 + 𝑢𝑢𝑖𝑖−1,𝑗𝑗 + 2𝑢𝑢𝑖𝑖,𝑗𝑗 − 𝑢𝑢𝑖𝑖,𝑗𝑗−1
1/3 2 𝑖𝑖+1,𝑗𝑗
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 2.25𝑢𝑢𝑖𝑖−1,𝑗𝑗 − 2.5𝑢𝑢𝑖𝑖,𝑗𝑗 + 2.25𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 𝑢𝑢𝑖𝑖,𝑗𝑗−1
22
Step 4: Obtain formula 𝑢𝑢𝑖𝑖,𝑗𝑗+ from difference formula.
Recall:
ℎ = 1/3 and 𝑘𝑘 = 0.5
From the initial velocity,
𝜕𝜕𝑢𝑢 𝜕𝜕𝑢𝑢 𝜕𝜕𝑢𝑢
𝑥𝑥, 0 = 1 discretized 𝑥𝑥𝑖𝑖 , 0 = =1
𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝑖𝑖,𝑗𝑗=0
By central-difference formulas,
𝜕𝜕𝑢𝑢 𝑢𝑢𝑖𝑖,𝑗𝑗+1 − 𝑢𝑢𝑖𝑖,𝑗𝑗−1
=
𝜕𝜕𝜕𝜕 𝑖𝑖,𝑗𝑗
2𝑘𝑘
Hence,
𝜕𝜕𝑢𝑢 𝑢𝑢𝑖𝑖,1 −𝑢𝑢𝑖𝑖,−1
= =1
𝜕𝜕𝜕𝜕 𝑖𝑖,𝑗𝑗=0 2(0.5)
is approximated to
𝑢𝑢𝑖𝑖,1 − 𝑢𝑢𝑖𝑖,−1 = 1
𝑢𝑢𝑖𝑖,−1 = 𝑢𝑢𝑖𝑖,1 − 1
23
Step 5: Compute solutions for internal points 𝑢𝑢𝑖𝑖,𝑗𝑗 (Refer to grid in Step 3).
𝑢𝑢𝑖𝑖,𝑗𝑗+1 = 2.25𝑢𝑢𝑖𝑖−1,𝑗𝑗 − 2.5𝑢𝑢𝑖𝑖,𝑗𝑗 + 2.25𝑢𝑢𝑖𝑖+1,𝑗𝑗 − 𝑢𝑢𝑖𝑖,𝑗𝑗−1
𝑢𝑢𝑖𝑖,−1 = 𝑢𝑢𝑖𝑖,1 − 1
Hence,
𝑢𝑢1,1 = 𝑢𝑢2,1 and
𝑢𝑢1,2 = 𝑢𝑢2,2
Let 𝑖𝑖 = 1, 𝑗𝑗 = 0,
𝑢𝑢1,1 = 2.25𝑢𝑢0,0 − 2.5𝑢𝑢1,0 + 2.25𝑢𝑢2,0 − 𝑢𝑢1,−1
𝑢𝑢1,1 = 2.25(0) − 2.5(−0.2222) + 2.25(−0.2222) − (𝑢𝑢1,1 − 1)
2𝑢𝑢1,1 = 1.0556 24
Hence,
𝑢𝑢1,1 = 𝑢𝑢2,1 and
𝑢𝑢1,2 = 𝑢𝑢2,2
Let 𝑖𝑖 = 1, 𝑗𝑗 = 1,
𝑢𝑢1,2 = 2.25𝑢𝑢0,1 − 2.5𝑢𝑢1,1 + 2.25𝑢𝑢2,1 − 𝑢𝑢1,0
𝑢𝑢1,2 = 2.25(0) − 2.5(0.5278) + 2.25(0.5278) − (−0.2222)
25
𝑢𝑢1,2 = 0.0903 ∴ 𝑢𝑢2,2 = 0.0903 due to symmetrical condition
Step 6: Fill in the values into the grid. Boundary and initial
conditions are symmetrical
about the line 𝑥𝑥 = 0.5.
𝑗𝑗 𝑦𝑦
Hence, all grid points are
symmetrical about the line
0 0.0903 0.0903 𝑥𝑥 = 0.5
2 1 0
0 0.5278 0.5278
1 0.5 0
0 −0.2222 −0.2222 0
0 𝑥𝑥
0 1/3 2/3 1
0 1 2 3 𝑖𝑖 26
Exercise 5.11:
1) Approximate the solution for the following wave equation
𝜕𝜕 2 𝑢𝑢 𝜕𝜕 2 𝑢𝑢
= , 0 < 𝑥𝑥 < 1, 𝑡𝑡 > 0
𝜕𝜕𝑡𝑡 2 𝜕𝜕𝑥𝑥 2
with boundary conditions
𝑢𝑢 0, 𝑡𝑡 = 𝑢𝑢 1, 𝑡𝑡 = 0, 0 ≤ 𝑡𝑡 ≤ 0.1
and initial conditions
𝑢𝑢 𝑥𝑥, 0 = sin 𝜋𝜋𝜋𝜋 , 0 ≤ 𝑥𝑥 ≤ 1
𝜕𝜕𝑢𝑢
𝑥𝑥, 0 = 0, 0 ≤ 𝑥𝑥 ≤ 1
𝜕𝜕𝜕𝜕
by using the central-difference formula. Given ℎ = 0.25 and 𝑘𝑘 = 0.05.
[Ans: 𝑢𝑢0,0 = 𝑢𝑢0,1 = 𝑢𝑢0,2 = 𝑢𝑢4,0 = 𝑢𝑢4,1 = 𝑢𝑢4,2 = 0; 𝑢𝑢1,0 = 𝑢𝑢3,0 = 0.7071; 𝑢𝑢2,0 =
1; 𝑢𝑢1,1 = 𝑢𝑢3,1 = 0.6988; 𝑢𝑢2,1 = 0.9883; 𝑢𝑢1,2 = 𝑢𝑢3,2 = 0.6741; 𝑢𝑢2,2 = 0.9534]
27
Exercise 5.11:
2) Approximate the solution for the following wave equation
𝜕𝜕 2 𝑢𝑢 𝜕𝜕 2 𝑢𝑢
=9 2, 0 < 𝑥𝑥 < 𝜋𝜋, 𝑡𝑡 > 0
𝜕𝜕𝑡𝑡 2 𝜕𝜕𝑥𝑥
with boundary conditions
𝑢𝑢 0, 𝑡𝑡 = 𝑢𝑢 𝜋𝜋, 𝑡𝑡 = 0, 0 ≤ 𝑡𝑡 ≤ 1
and initial conditions
𝑥𝑥
𝑢𝑢 𝑥𝑥, 0 = 𝑥𝑥 cos , 0 ≤ 𝑥𝑥 ≤ 𝜋𝜋
2
𝜕𝜕𝑢𝑢
𝑥𝑥, 0 = 2, 0 ≤ 𝑥𝑥 ≤ 𝜋𝜋
𝜕𝜕𝜕𝜕
𝜋𝜋
by using the central-difference formula. Given ℎ = 4 and 𝑘𝑘 = 0.5.
29
Thank You
30