# t_n+1
# Program to determine the value of golden ratio (phi) = lim ---------
# n->inf t_n
n=input("Enter the decimal place upto which correction is required:")
a=1.0
b=1.0
c=a+b
R1=c/b
R2=b/a
e=R1-R2
n=float(n)
while abs(e)>=n:
a=b
b=c
c=a+b
R1=c/b
R2=b/a
e=R1-R2
print("The value of the Golden ratio is",R1)
# Program to determine the value of golden ratio (phi) = lim ---------
# n->inf t_n
n=input("Enter the decimal place upto which correction is required:")
a=1.0
b=1.0
c=a+b
R1=c/b
R2=b/a
e=R1-R2
n=float(n)
while abs(e)>=n:
a=b
b=c
c=a+b
R1=c/b
R2=b/a
e=R1-R2
print("The value of the Golden ratio is",R1)
Comments
Post a Comment