mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-26 06:48:04 +02:00
Klausur 6, Aufgabe 2 gelöst
This commit is contained in:
parent
dffdc90747
commit
69e79a440d
3 changed files with 13 additions and 27 deletions
|
@ -1,22 +1,13 @@
|
|||
"""from math import exp, log
|
||||
from math import exp, log
|
||||
|
||||
def iterate(x):
|
||||
#return x - (2.0*x - exp(-x))/(2.0+exp(-x)) #Newton
|
||||
#return 0.5*exp(-x) #F_1
|
||||
return (-1)*log(2.0*x) #F_2
|
||||
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 = 0.9
|
||||
for i in range(10):
|
||||
print (i, x)
|
||||
x = iterate(x)
|
||||
"""
|
||||
from math import log
|
||||
f = lambda x: -log(2*x)
|
||||
if times > 0:
|
||||
x = iterate(x, times-1)
|
||||
|
||||
return x
|
||||
|
||||
x = 0.35173371124919582602
|
||||
#x = 0.3517337112491958260249093009299510651715
|
||||
for i in range(200):
|
||||
print("x 0.35173371124919582602")
|
||||
print("x 0.3517337112491958260249093009299510651715")
|
||||
print("%i %.30f" % (i, x))
|
||||
x = f(x)
|
||||
print(iterate(0.5,6))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue