Newtown Verfahren. Sehr simpel gehalten

This commit is contained in:
Sandro Zimmermann 2025-12-04 20:39:34 +01:00
parent 1d47fd2ac4
commit 3a997bd099

18
newton_verfahren.py Normal file
View File

@ -0,0 +1,18 @@
import math
try:
x_zero = float(input("X0 eingeben: "))
except ValueError as error:
print(f"Value {error} is not a number")
quit()
n = 0
T = math.e ** x_zero + 2 * x_zero
while(T>10**-16):
f_a2 = math.e ** x_zero + 2
x_zero -= T/f_a2
T = math.e ** x_zero + 2 * x_zero
n += 1
print(T)
print(n)