Boundary-Value Problems: Example 6.1-1
Boundary-Value Problems: Example 6.1-1
Boundary-Value Problems: Example 6.1-1
Boundary-Value Problems
6.1 Introduction
The solution of an ordinary differential equation requires auxiliary conditions. For an nth-
order equation, n conditions are required. If all the conditions are specified at the same value
of the independent variable, we have an initial-value problem. If the conditions are known at
different values of the independent variable, usually at the extreme points or boundaries of a
system, we have a boundary-value problem.
Solve the following ordinary differential equation (ODE) using finite difference with x =
0.5
d2y x
(1 ) y = x ; y(1) = 2,
dx 2
5
y(3) = 1
Solution
y0 y1 y2 y3 y4
x 1 1 .5 2 2 .5 3
There are five nodes with x = 0.5: y0, y1, y2, y3, and y4. However there are only three
unknowns since y0 = y(1) = 2 and y4 = y(3) = 1. In finite difference form, the ODE becomes
yi 1 2 yi yi 1 x
(1 i ) yi = xi i = 1, 2, 3
x 2
5
xi
yi-1 [2 + x2(1 ) ]yi + yi+1 = x2xi
5
1.5
i = 1, xi = 1.5 y0 [2 + .52(1 ) ]y1 + y2 = .521.5
5
2
i = 2, xi = 2.0 y1 [2 + .52(1 ) ]y2 + y3 = .522
5
1
2 .5
i = 3, xi = 2.5 y2 [2 + .52(1 ) ]y3 + y4 = .522.5
5
In matrix notation
2.175 1 0 y1 1.625
1 2.150 1 y
2 = 0.5
0 1 2.125 y 1.625
3
The three linear equations can be solved for the three unknowns to obtain
Let solve the problem again with h = x = 0.2. We now have 9 unknowns that can be solved
from the following system
Ay = r
where
A =
2.0304 1 0 0 0 0 0 0 0
1 2.0288 1 0 0 0 0 0 0
0 1 2.0272 1 0 0 0 0 0
0 0 1 2.0256 1 0 0 0 0
0 0 0 1 2.0240 1 0 0 0
0 0 0 0 1 2.0224 1 0 0
0 0 0 0 0 1 2.0208 1 0
0 0 0 0 0 0 1 2.0192 1
0 0 0 0 0 0 0 1 2.0176
y = y1 y 2 y 3 y 4 y5 y 6 y 7 y8 y 9 T
r = 1.952 0.056 0.064 0.072 0.080 0.088 0.096 0.104 1.112 T
b1 c1 0 0 y1 r1
a b2 c2 0 0 y r
2 2 2
0 a3 b3 c3 0 y3 r3
=
0 0 a n 1 bn 1 cn 1 y n 1 rn 1
0 0 an bn y n rn
xi
bi = [2 + x2(1 ) ], i = 1, , 9
5
ci = 1, i = 1, , 9
The Thomas algorithm can be used to obtain the solutions for tridiagonal matrix system as
follows:
1 = b1
1 = r1/1
For i = 2, , n
i = bi (ai ci-1/i-1)
i = (ri ai i-1)/i
yn = n
For j = 1, , n1
End
Table 6.1-1 lists the MATLAB program using the Thomas algorithm to solve example 6.1-1.
3
end
y(n)=gam(n);
for j=1:n-1
y(n-j)=gam(n-j)-c(n-j)*y(n-j+1)/beta(n-j);
end
disp('y =');disp(y')
y=
1.3513
0.7918
0.3110
-0.0974
-0.4362
-0.7055
-0.9025
-1.0224
-1.0579