Update numethods/solvers.py
This commit is contained in:
@@ -64,7 +64,7 @@ class LUDecomposition:
|
||||
|
||||
|
||||
class GaussJordan:
|
||||
"""Gauss–Jordan elimination."""
|
||||
"""Gauss-Jordan elimination."""
|
||||
|
||||
def __init__(self, A: Matrix):
|
||||
if not A.is_square():
|
||||
@@ -95,7 +95,7 @@ class GaussJordan:
|
||||
return Vector(row[-1] for row in Ab.data)
|
||||
|
||||
def trace(self):
|
||||
print("Gauss–Jordan Trace (row reduction steps)")
|
||||
print("Gauss-Jordan Trace (row reduction steps)")
|
||||
for step, Ab in self.steps:
|
||||
print(f"\nColumn {step}:")
|
||||
print(f"Augmented matrix = {Ab}")
|
||||
@@ -146,7 +146,7 @@ class Jacobi:
|
||||
|
||||
|
||||
class GaussSeidel:
|
||||
"""Gauss–Seidel iterative method for Ax = b."""
|
||||
"""Gauss-Seidel iterative method for Ax = b."""
|
||||
|
||||
def __init__(
|
||||
self, A: Matrix, b: Vector, tol: float = 1e-10, max_iter: int = 10_000
|
||||
@@ -181,7 +181,7 @@ class GaussSeidel:
|
||||
raise ConvergenceError("Gauss-Seidel did not converge within max_iter")
|
||||
|
||||
def trace(self):
|
||||
print("Gauss–Seidel Iteration Trace")
|
||||
print("Gauss-Seidel Iteration Trace")
|
||||
print(f"{'iter':>6} | {'residual norm':>14}")
|
||||
print("-" * 26)
|
||||
for k, res in enumerate(self.history):
|
||||
|
Reference in New Issue
Block a user