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