diff --git a/arithmetic_analysis/lu_decomposition.py b/arithmetic_analysis/lu_decomposition.py index 4372621d7..763ba60f3 100644 --- a/arithmetic_analysis/lu_decomposition.py +++ b/arithmetic_analysis/lu_decomposition.py @@ -13,15 +13,15 @@ def LUDecompose(table): if rows != columns: return [] for i in range(columns): - for j in range(i - 1): + for j in range(i): sum = 0 - for k in range(j - 1): + for k in range(j): sum += L[i][k] * U[k][j] L[i][j] = (table[i][j] - sum) / U[j][j] L[i][i] = 1 - for j in range(i - 1, columns): + for j in range(i, columns): sum1 = 0 - for k in range(i - 1): + for k in range(i): sum1 += L[i][k] * U[k][j] U[i][j] = table[i][j] - sum1 return L, U diff --git a/arithmetic_analysis/newton_method.py b/arithmetic_analysis/newton_method.py index fd7ad45c2..542f994aa 100644 --- a/arithmetic_analysis/newton_method.py +++ b/arithmetic_analysis/newton_method.py @@ -27,7 +27,7 @@ def newton(function: RealFunc, derivative: RealFunc, starting_int: int,) -> floa ... ZeroDivisionError: Could not find root """ - prev_guess float(starting_int) + prev_guess = float(starting_int) while True: try: next_guess = prev_guess - function(prev_guess) / derivative(prev_guess)