diff options
Diffstat (limited to 'src/main.py')
-rw-r--r-- | src/main.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main.py b/src/main.py index 01f0c19..551595e 100644 --- a/src/main.py +++ b/src/main.py @@ -1,11 +1,16 @@ from simple import SIMPLE problem = SIMPLE((1, 2), (0.7, 0.5), 0.02, 120) - problem.prep() -for i in range(3000): - print(f'Iteration {i}') +error = 1 +iteration = 0 +while error > 10 ** -7: + iteration += 1 problem.iterate() - if i % 5 == 0 or i == 1: + error = problem.avg_error() + print(f'Iteration {iteration}') + print(f'Avg error: {error}') + + if iteration % 5 == 0 or iteration == 1: problem.plot(True, 2) |