Created
May 19, 2022 08:50
-
-
Save MovsisyanM/3022b182640e3ddd1851c2ccda97cf5c to your computer and use it in GitHub Desktop.
Solves the linear system Ax = b using Gauss-Seidel method.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def Gauss_Seidel(A, b, N): | |
"""Solves the linear system Ax = b using Gauss-Seidel method.""" | |
x = np.zeros(len(b)) | |
e_inverse = np.linalg.inv(np.tril(A)) | |
for i in range(N): | |
x += np.dot(e_inverse, b - np.dot(A, x)) | |
return x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment