FiniteDifferenceApprox Notes
FiniteDifferenceApprox Notes
𝑝(𝑥), 𝑞(𝑥), 𝑓(𝑥), 𝑎, 𝑏, 𝛼 and 𝛽 are given, and 𝑝(𝑥), 𝑞(𝑥) and 𝑓(𝑥) are continuous functions on [𝑎, 𝑏].
Review: We previously discussed this problem in Chapter 3, and used three different initial value
problems to approximate the solution.
A different approach:
𝑢′′(𝑥) = 𝑝(𝑥)𝑢′(𝑥) + 𝑞(𝑥)𝑢(𝑥) + 𝑓(𝑥), 𝑎 ≤ 𝑥 ≤ 𝑏
{ } (3)
𝑢(𝑎) = 𝛼, 𝑢(𝑏) = 𝛽
The approach here is very different, but serves as a good lead-in to approximation of solutions to more
complicated problems associated with partial differential equations (see Math 4365 for more
information), where shooting methods cannot be used.
Recall: If ℎ > 0 then the following centered difference approximations are 𝑂(ℎ2 ).
𝑢(𝑥 + ℎ) − 𝑢(𝑥 − ℎ)
𝑢′ (𝑥) ≈
2ℎ
These are the points where we hope to approximate our solution. Now, define our approximations to
𝑢(𝑥𝑖 ) to be denoted by 𝑢𝑖 for each 𝑖. Then the centered difference approximations above become
𝑢(𝑥𝑖 + ℎ) − 𝑢(𝑥𝑖 − ℎ) 𝑢𝑖+1 − 𝑢𝑖−1
𝑢′ (𝑥𝑖 ) ≈ ≈
2ℎ 2ℎ
and
𝑢2 − 2𝑢1 + 𝑢0 (𝑢2 − 𝑢0 )
2
= 𝑝1 + 𝑞1 𝑢1 + 𝑓1
ℎ 2ℎ
𝑢3 − 2𝑢2 + 𝑢1 (𝑢3 − 𝑢1 )
2
= 𝑝2 + 𝑞2 𝑢2 + 𝑓2
ℎ 2ℎ
⋮
𝑢𝑛 − 2𝑢𝑛−1 + 𝑢𝑛−2 (𝑢𝑛 − 𝑢𝑛−2 )
( = 𝑝𝑛−1 + 𝑞𝑛−1 𝑢𝑛−1 + 𝑓𝑛−1 )
ℎ2 2ℎ
Notes:
Then we isolate the 𝑢𝑖 on the left side of each equation, and move everything else to the right side.
This should give
1 1
(−2 − ℎ2 𝑞1 )𝑢1 + (1 − ℎ𝑝1 ) 𝑢2 = ℎ2 𝑓1 − 𝛼(1 + ℎ𝑝1 )
2 2
1 1
(1 + 2 ℎ𝑝2 ) 𝑢1 + (−2 − ℎ2 𝑞2 )𝑢2 + (1 − 2 ℎ𝑝2 ) 𝑢3 = ℎ2 𝑓2
⋮ . (11)
1 2 1 2
(1 + 2 ℎ𝑝𝑛−2 ) 𝑢𝑛−3 + (−2 − ℎ 𝑞𝑛−2 )𝑢𝑛−2 + (1 − 2 ℎ𝑝𝑛−2 ) 𝑢𝑛−1 = ℎ 𝑓𝑛−2
1 2 2 1
( (1 + 2 ℎ𝑝𝑛−1 ) 𝑢𝑛−2 + (−2 − ℎ 𝑞𝑛−1 )𝑢𝑛−1 = ℎ 𝑓𝑛−1 − 𝛽 (1 − 2 ℎ𝑝𝑛−1 ) )
𝑀 =? 𝐹 =?
Example 1: Show that the two-point boundary value problem below has a unique solution.
𝑢′′ (𝑥) = −1 − cos(𝑥) − 2𝑥 𝑢(𝑥), 0 ≤ 𝑥 ≤ 1
{ }
𝑢(0) = 1, 𝑢(1) = 2
Then approximate this solution in two ways. First, use the method described in Chapter 3. Then use the
approximation method guaranteed in Theorem 1 using 𝑛 = 100. Finally, compare the two
approximations.