# Tridiagonal system solver based on SOR – C++

The attached code solves a tridiagonal system of equations using the (extrapolated) successive over-relaxation method (SOR / ESOR).

Below you can find a very brief description of the SOR and ESOR methods.

## Successive Over-Relaxation (SOR / ESOR)

The (extrapolated) successive over-relaxation method is a variant of the Gauss–Seidel method for solving a system of linear equations A*x = b, where:

and

The **extrapolated successive over-relaxation** method is an iterative technique that, in the k^{th} iteration, computes the elements of **x**^{(k+1) }using the previous value **x**^{(k)} as follows (until it converges):

By setting τ = w, we reach the well-known** successive over-relaxation** method:

ESOR method for tridiagonal system

The ESOR method can be used to solve a tridiagonal system A*x = d

In the k^{th} iteration, the elements of **x**^{(k+1)} are computed as follows:

which is easily depicted from the original ESOR formula given the special structure of the A matrix (tridiagonal).