Skip to content
Related Articles

Related Articles

Python | sympy.S.GoldenRatio
  • Last Updated : 26 Jul, 2019

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

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :