2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-19 11:38:05 +02:00
LaTeX-examples/documents/Numerik/Klausur6/aufgabe2.py
2015-11-20 23:12:22 +01:00

14 lines
249 B
Python

from math import exp
def iterate(x, times=1):
# x = x - (2.0*x - exp(-x))/(2.0+exp(-x)) #Newton
x = 0.5*exp(-x) # F_1
# x = (-1)*log(2.0*x) #F_2
if times > 0:
x = iterate(x, times-1)
return x
print(iterate(0.5, 6))