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

15 lines
249 B
Python
Raw Normal View History

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