maths.numerical_analysis.gauss_seidel_method

Functions

gauss_seidel(→ list[float])

Solve the linear system Ax = b using the Gauss-Seidel iterative method.

Module Contents

maths.numerical_analysis.gauss_seidel_method.gauss_seidel(coefficients: list[list[float]], rhs: list[float], tol: float = 1e-10, max_iter: int = 1000) list[float]

Solve the linear system Ax = b using the Gauss-Seidel iterative method.

Args:

coefficients (list[list[float]]): Coefficient matrix (n x n) rhs (list[float]): Right-hand side vector (n) tol (float): Convergence tolerance max_iter (int): Maximum number of iterations

Returns:

list[float]: Approximate solution vector

Example:
>>> A = [[4, 1, 2], [3, 5, 1], [1, 1, 3]]
>>> b = [4, 7, 3]
>>> gauss_seidel(A, b)
[0.5, 1.0, 0.5]

Wikipedia: https://en.wikipedia.org/wiki/Gauss%E2%80%93Seidel_method