2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-26 06:48:04 +02:00
LaTeX-examples/documents/Numerik/Klausur6/aufgabe2.py

14 lines
252 B
Python
Raw Normal View History

2013-09-21 19:57:23 +02:00
from math import exp, log
2013-09-19 12:23:17 +02:00
2013-09-21 19:57:23 +02:00
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
2013-09-19 12:23:17 +02:00
2013-09-21 19:57:23 +02:00
if times > 0:
x = iterate(x, times-1)
return x
2013-09-20 18:24:17 +02:00
2013-09-21 19:57:23 +02:00
print(iterate(0.5,6))