cds203/newton_verfahren_10_5.py
2025-12-05 15:32:22 +01:00

18 lines
354 B
Python

import math
try:
x_zero = float(input("X0 eingeben: "))
except ValueError as error:
print(f"Value {error} is not a number")
quit()
n = 1
T = x_zero - 4 + (math.e ** (x_zero/3)/3)
print(T)
while(T!=0):
f_a2 = 1 + (math.e ** (x_zero/3)/9)
x_zero -= T/f_a2
T = x_zero - 4 + (math.e ** (x_zero/3)/3)
n += 1
print(T)
print(n)