#Python code to computer first 28 digits of golder ration (phi)
from decimal import*
def babylonian(m):
n=m
xn=2
yn=3
error=Decimal(10**(-323))
#print error
while abs(yn-xn)>error:
xn=Decimal(yn)
yn=Decimal((xn+n/xn)/2)
return Decimal(yn)
print (1+babylonian(5))/2
To read more on Golden ratio......
from decimal import*
def babylonian(m):
n=m
xn=2
yn=3
error=Decimal(10**(-323))
#print error
while abs(yn-xn)>error:
xn=Decimal(yn)
yn=Decimal((xn+n/xn)/2)
return Decimal(yn)
print (1+babylonian(5))/2
To read more on Golden ratio......
Ily babe
ReplyDelete