(In reply to
re: Iteration plus guess -- the iterative method by Charlie)
Of course, I was just just being lazy.
What I find curious is that after the first iteration, the answer is exactly 11. Then on the next iteration, the error is about .214, (not surprising), then eventually converges on: 11.000000000000004 rather than 11.
def fa(x):
return (4 - (5 - x)**.5)**.5
def fb(x):
return (4 + (5 - x)**.5)**.5
def fc(x):
return (4 - (5 + x)**.5)**.5
def fd(x):
return (4 + (5 + x)**.5)**.5
abcd = 0
a=b=c=d=0
delta = 100
while delta > 0:
a = fa(a)
b = fb(b)
c = fc(c)
d = fd(d)
old = abcd
abcd = a*b*c*d
delta = abs(old - abcd)
print(abcd)
print(abcd)
11.0
10.786239004264264
11.000095171765523
10.998597593440481
10.999984256915633
10.999989942052382
10.999999762932447
10.999999924707632
10.999999997400211
10.999999999421696
10.999999999974596
10.99999999999548
10.999999999999764
10.999999999999966
10.999999999999998
11.000000000000002
11.000000000000004
11.000000000000004
11.000000000000004
|
Posted by Larry
on 2025-03-06 07:25:18 |