Successive Over-Relaxation (SOR) Method

Using successive over-relaxation method, this application solves the system of linear equations $Ax=b$, where \[ A = \left[\begin{array}{cccc} a_{11} & a_{12} & \cdots & a_{1n} \\ a_{21} & a_{22} & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{n1} & a_{n2} & \cdots & a_{nn} \end{array}\right],\qquad x = \left[\begin{array}{c} x_1 \\ x_2 \\ \vdots \\ x_n \end{array}\right],\qquad b = \left[\begin{array}{c} b_1 \\ b_2 \\ \vdots \\ b_n \end{array}\right] \] and matrix $A$ is symmetric positive definite. The updated $x_i^{(k+1)}$ is calculated from the relation \[ x_i^{(k+1)} = (1-\omega)x_i^{(k)}+\frac{\omega}{a_{ii}}\left(b_i-\sum_{j=1}^{i-1}a_{ij}x_j^{(k+1)} - \sum_{j=i+1}^na_{ij}x_j^{(k)}\right),\qquad i=1,\ldots, n \] where $\omega$ is the relaxation factor and should be in the interval $0 < \omega < 2$ for the convergence of the method. The calculation stops when $k=1000$ or $\|b-Ax\|_\infty < 10^{-8}$ which in the latter case $x$ is the solution of the problem.

Input Data

See Input Data for how to enter data to a matrix and a vector of real numbers. The input for $\omega$ should be in the interval $0 < \omega < 2$.

SOR Method Calculator