Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,16 @@
|
|||
import math
|
||||
|
||||
oldPhi = 1.0
|
||||
phi = 1.0
|
||||
iters = 0
|
||||
limit = 1e-5
|
||||
while True:
|
||||
phi = 1.0 + 1.0 / oldPhi
|
||||
iters += 1
|
||||
if math.fabs(phi - oldPhi) <= limit: break
|
||||
oldPhi = phi
|
||||
|
||||
print(f'Final value of phi : {phi:16.14f}')
|
||||
actualPhi = (1.0 + math.sqrt(5.0)) / 2.0
|
||||
print(f'Number of iterations : {iters}')
|
||||
print(f'Error (approx) : {phi - actualPhi:16.14f}')
|
||||
Loading…
Add table
Add a link
Reference in a new issue