Escolar Documentos
Profissional Documentos
Cultura Documentos
The tridiagonal matrix algorithm (TDMA), also known als Thomas algorithm, is a
simplified form of Gaussian elimination that can be used to solve tridiagonal system
of equations
ai xi1 + bi xi + ci xi+1 = yi ,
i = 1, . . . n,
(A.1)
or, in matrix form ( a1 = 0, cn = 0)
b 1 c1 0 . . . . . .
a 2 b 2 c2 . . . . . .
0 a 3 b 3 c3 . . .
. . . . . . . . . . . . . . .
0 . . . . . . 0 an
y1
x1
x2 y2
=
cn1
yn
xn
bn
0
0
0
The TDMA is based on the Gaussian elimination procedure and consist of two parts:
a forward elimination phase and a backward substitution phase [8]. Let us consider
the system (A.1) for i = 1 . . . n and consider following modification of first two equations:
Eqi=2 b1 Eqi=1 a2
which relults in
(b1 b2 c1 a2 )x2 + c2 b1 x3 = b1 y2 a2y1 .
The effect is that x1 has been eliminated from the second equation. In the same
manner one can eliminate x2 , using the modified second equation and the third one
(for i = 3):
(b1 b2 c1 a2 )Eqi=3 a3(mod. Eqi=2 ),
which would give
(b3 (b1 b2 c1 a2 )c2 b1 a3 )x3 +c3 (b1 b2 c1 a2 )x4 = y3 (b1 b2 c1 a2 )(y2 b1 y1 a2 )a3
If the procedure is repeated until the nth equation, the last equation will involve
the unknown function xn only. This function can be then used to solve the modified equation for i = n 1 and so on, until all unknown xi are found (backward
27
substitution phase). That is, we are looking for a backward ansatz of the form:
xi1 = i xi + i .
(A.2)
If we put the last ansatz in Eq. (A.1) and solve the resulting equation with respect to
xi , the following relation can be obtained:
xi =
yi a i i
ci
xi+1 +
ai i + bi
ai i + bi
(A.3)
i+1 =
ci
,
ai i + bi
i+1 =
yi a i i
.
ai i + bi
(A.4)
Equation (A.4) involves the recursion formula for the coefficients i and i for i =
2, . . . , n 1. The missing values 1 and 1 can be derived from the first (i = 1)
equation (A.1):
x1 =
c1
1
y1 c1
x2 2 = , 2 =
1 = 1 = 0.
b1 b1
b1
b1
The last what we need is the value of the function xn for the first backward substitution. We can obtain if we put the ansatz
xn1 = xn + n
into the last (i = n) equation (A.1):
an ( xn + n ) + bnxn = yn ,
yielding
xn =
yn a n n
.
an n + bn
One can get this value directly from Eq. (A.2), if one formal puts
xn+1 = 0.
Altogether, the TDMA can be written as:
1.Set 1 = 1 = 0;
2.Evaluate for i = 1, . . . , n 1
i+1 =
ci
,
ai i + bi
i+1 =
yi a i i
;
ai i + bi
3.Set xn+1 = 0;
4.Find for i = n + 1, . . ., 2
xi1 = i xi + i .
The algorithm admits O(n) operations instead of O(n3 ) required by Gaussian
elimination.
Limitation
The TDMA is only applicable to matrices that are diagonally dominant, i.e.,
|bi | > |ai | + |ci|,
i = 1, . . . , n.
Appendix B
The method of characteristics is a method which can be used to solve an initial value
problem for general first order PDEs [2]. Let us consider a quasilinear equation of
the form
u
u
u(x, 0) = u0 ,
(B.1)
A + B + Cu = 0,
x
t
where u = u(x,t), and A, B and C can be functions of independent variables and
u. The idea of the method is to change coordinates from (x,t) to a new coordinate
system (x0 , s), in which Eq. (B.1) becomes an ordinary differential equation along
certain curves in the (x,t) plane. Such curves, (x(s),t(s)) along which the solution
of (B.1) reduces to an ODE, are called the characteristic curves. The variable s can
be varied, whereas x0 changes along the line t = 0 on the plane (x,t) and remains
constant along the characteristics. Now if we choose
dx
= A,
ds
and
dt
= B,
ds
(B.2)
then we have
du
dx
dt
= ux + ut = Aux + But ,
ds
ds
ds
and Eq. (B.1) becomes the ordinary differential equation
du
+ Cu = 0
ds
(B.3)
Using the results of the first step find s and x0 in terms of x and t and substitute
these values in u(x0 , s) to get the solution u(x,t) of the original equation (B.1).