Weighted Jacobi method for the one-dimensional Poisson equation (source code)

= Weighted Jacobi method for the one-dimensional Poisson equation

For the centered second-difference matrix with diagonal $-2$ and off-diagonals $1$, the weighted-Jacobi eigenvalues are
$$
\lambda_k(\omega)
=1-\omega+\omega\cos\frac{k\pi}{n+1},
\qquad 1\leq k\leq n.
$$
The method converges for every grid size exactly when $0<\omega\leq1$.