Open In App

Python | sympy.S.GoldenRatio

With the help of sympy.S.GoldenRatio value, We can directly use the value of Golden Ratio constant which is 1.618033989 or we can say that in sympy Golden Ratio constant is a singleton value.

Value of Golden Ratio constant –



Example #1 :
In this example we can see that by using singleton value of Golden Ratio constant, we are able to get the value of Golden Ratio constant.




# import sympy
from sympy import *
  
# Using sympy.S.GoldenRatio value
gfg = S.GoldenRatio.n(10) + S(20)
  
print(gfg)

Output :

21.61803399



Example #2 :




# import sympy
from sympy import *
  
# Using sympy.S.GoldenRatio value
gfg = S.GoldenRatio.n(20)
  
print(gfg)

Output :

1.6180339887498948482

Article Tags :