The Thomas Algorithm

We explain here in the general case how are treated the inversion of the systems resulting from implicit schemes with three space points (i-1, i, i+1). We can write them form :

With boundary conditions :
and

What results in the following matric system :

The boundary conditions can be gathered in the second member :

The matrix obtained possesses three diagonals, then the inversion of the system
is done by
the Thomas Algorithm. It is done in two distinct times :

The first consists to forward sweep the matrix in order to obtain a matrix with two diagonals in "removing" the coefficients :

And we have a new algebraic system defined by :

= | |||

= |

With the new coefficients :

The second time consists to backward sweep the new matrix in order to
calculate
the solution :

We obtain initially

then, we calculate the solutions for any x, with the time step n+1 :

* * * * *