WITH TOLERANCE = 0.0000001 Solution = with 10 iterations Solution = gauss_seidel(A, b, x_0, tolerance=0.001)į'Solution = iterations') Here's my python code: import numpy as npĭef gauss_seidel(A, b, x_0, max_iterations=15, tolerance=0.0000001):Įrror = (diff, ord=np.inf, axis=None) / \ When I don't use the error in the code (only iterations) I obtain the same result as the book. I think the problem is because of infinity norm using scipy to calculate the error. The problem is I obtain the exact solution but with more iterations: 10 iterations with 0.0000001 tolerance but the book obtains the solution with only 6 iterations and 0.001 tolerance. I'm implementing the code and an example from the book: 'Numerical Analysis: Burden and Faires'. I have a python code to solve linear systems with Gauss-Seidel Method, using Numpy and Scipy.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |