mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-26 06:48:04 +02:00
13 lines
252 B
Python
13 lines
252 B
Python
from math import exp, log
|
|
|
|
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))
|