From d288cbd86490452172b7e2896c055538a002cdcf Mon Sep 17 00:00:00 2001 From: Kamil <32775019+quant12345@users.noreply.github.com> Date: Sun, 13 Aug 2023 19:14:20 +0500 Subject: [PATCH] Update jacobi_iteration_method.py left the old algorithm commented out, as it clearly shows what is being done. --- arithmetic_analysis/jacobi_iteration_method.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arithmetic_analysis/jacobi_iteration_method.py b/arithmetic_analysis/jacobi_iteration_method.py index 7bb285b68..ad722ef36 100644 --- a/arithmetic_analysis/jacobi_iteration_method.py +++ b/arithmetic_analysis/jacobi_iteration_method.py @@ -114,6 +114,24 @@ def jacobi_iteration_method( rows, cols = table.shape strictly_diagonally_dominant(table) + + """ + # Iterates the whole matrix for given number of times + for _ in range(iterations): + new_val = [] + for row in range(rows): + temp = 0 + for col in range(cols): + if col == row: + denom = table[row][col] + elif col == cols - 1: + val = table[row][col] + else: + temp += (-1) * table[row][col] * init_val[col] + temp = (temp + val) / denom + new_val.append(temp) + init_val = new_val + """ """ denom - a list of values along the diagonal