Python gauss seidel method

broken image

Print ('The solution vector in iteration', iter1, 'is:', x) The Poisson Equation in Any Space Dimensions def sor_method(A, b, omega, initial_guess, tolerance, max_iterations): See section 3 on the paper The Optimal Relaxation Parameter for the SOR Method Applied to

broken image

Obviously, with higher omega values the number of iterations should decrease.Īs for a working algorithm on SOR this is what I have computed, where best convergence is reached when the optimal omega is used. Phi = sor_solver(A, b, omega, initial_guess, residual_convergence)įor an extended answer on omega and its uses please refer to my other answer SOR method as what is quoted below is not accurate.

broken image
broken image

#An example case that mirrors the one in the Wikipedia article Here I have some python script, which solves the system of linear equations using Gauss-Seidel method: import numpy as np

broken image