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

Adjust Python code to follow PEP8

This commit is contained in:
Martin Thoma 2015-11-20 23:12:22 +01:00
parent b36776fc27
commit de1ad26035
14 changed files with 349 additions and 311 deletions

View file

@ -1,13 +1,14 @@
from math import exp, log
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
# 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))
print(iterate(0.5, 6))