sympy.stats.Gamma() function in Python
With the help of sympy.stats.Gamma() method, we can create a continuous random variable with a Gamma distribution. The density of the Gamma distribution is given by
with x in [0, 1].
Syntax: sympy.stats.Gamma(name, k, theta)
Parameters:
k: real number, k>0
theta: real number, theta>0
Returns: a continuous random variable with a Gamma distribution.
Example #1 :
Python3
from sympy.stats import Gamma, density
from sympy import Symbol, pprint
k = Symbol( "k" , positive = True )
theta = Symbol( "theta" , positive = True )
z = Symbol( "z" )
X = Gamma( "x" , k, theta)
gamVar = density((X)(z))
pprint(gamVar)
|
Output:
-z
-----
-k k - 1 theta
theta *z *e
---------------------
Gamma(k)
Example #2 :
Python3
from sympy.stats import Gamma, density
from sympy import Symbol, pprint
z = Symbol( "z" )
X = Gamma( "x" , 1 / 3 , 45 )
gamVar = density((X)(z))
pprint(gamVar)
|
Output:
-z
---
3 ____ 45
\/ 75 *e
------------------
2/3
15*z *Gamma(1/3)
Last Updated :
18 Aug, 2020
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...