sympy.stats.Chi() in Python
Last Updated :
08 Jun, 2020
With the help of sympy.stats.Chi()
method, we can get the continuous random variable which represents the chi distribution.
Syntax : sympy.stats.Chi(name, k)
Where, k is number of degree of freedom.
Return : Return the continuous random variable.
Example #1 :
In this example we can see that by using sympy.stats.Chi()
method, we are able to get the continuous random variable representing the chi distribution by using this method.
from sympy.stats import Chi, density, E
from sympy import Symbol, simplify
k = Symbol( "k" , integer = True )
z = Symbol( "z" )
X = Chi( "x" , k)
gfg = density(X)(z)
print (gfg)
|
Output :
2**(1 – k/2)*z**(k – 1)*exp(-z**2/2)/gamma(k/2)
Example #2 :
from sympy.stats import Chi, density, E
from sympy import Symbol, simplify
k = 3
z = 2
X = Chi( "x" , k)
gfg = density(X)(z)
print (gfg)
|
Output :
4*sqrt(2)*exp(-2)/sqrt(pi)
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...