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.
from sympy import *
gfg = S.GoldenRatio.n( 10 ) + S( 20 )
print (gfg)
|
Output :
21.61803399
Example #2 :
from sympy import *
gfg = S.GoldenRatio.n( 20 )
print (gfg)
|
Output :
1.6180339887498948482
Share your thoughts in the comments
Please Login to comment...