{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Tutorial 04 - Linear algebra (cont'd)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Iterative and gradient methods for solving linear algebraic equation systems, Jacobi method, Gauss-Seidel method, successive over-relaxation method, conjugate gradient method, power iteration and eigensystems." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import scipy.linalg as la\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Iterative methods for linear algebraic equations" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Jacobi method\n", "\n", "A system of $ n $ linear algebraic equations $ \\mathbb{A} x = b $ with [diagonally dominant](https://en.wikipedia.org/wiki/Diagonally_dominant_matrix) coefficient matrix $ \\mathbb{A} $ can be solved iteratively using [Jacobi method](https://en.wikipedia.org/wiki/Jacobi_method):\n", "\n", "$$\n", "x_i^{(k+1)} = \\frac{1}{a_{ii}} \\left( b_i - \\sum_{j = 1}^{i-1} a_{ij} x_j^{(k)} - \\sum_{j = i + 1}^{n} a_{ij} x_j^{(k)} \\right), \\qquad i = 0, 1, \\dots, n-1,\n", "$$\n", "\n", "where $ x^{(k)} $ and $ x^{(k+1)} $ are, respectively, the k-th and k+1-th iterations of $ x $." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "