From 3367c775b9a1a7c4d62afc48868cd850bdab803e Mon Sep 17 00:00:00 2001 From: schrom01 Date: Thu, 3 Nov 2022 11:23:01 +0100 Subject: [PATCH] created Script for Vereinfachtes Newton Verfahren --- Schenk_Brandenberger_S5_Aufg1.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Schenk_Brandenberger_S5_Aufg1.py b/Schenk_Brandenberger_S5_Aufg1.py index a8019f3..3288ab6 100644 --- a/Schenk_Brandenberger_S5_Aufg1.py +++ b/Schenk_Brandenberger_S5_Aufg1.py @@ -15,9 +15,11 @@ def f_diff(x): def newtonStep(x0, function, function_diff): return x0 - (function(x0)) / (function_diff(x0)) - +def simpleNewtonStep(x0, function, function_diff_x0): + return x0 - ((function(x0)) / (function_diff_x0)) def newton(x0, iterations, function, function_diff): + print("Newton Verfahren:") x = [] x.append(x0) print("x" + str(0) + ":", str(x[0])) @@ -32,3 +34,4 @@ def newton(x0, iterations, function, function_diff): if __name__ == '__main__': newton(x0=2, iterations=4, function=f, function_diff=f_diff) + simpleNewton(x0=0.5, iterations=4, function=f, function_diff=f_diff) \ No newline at end of file