Tuesday, September 24, 2024
Google search engine
HomeLanguagessympy.stats.Chi() in Python

sympy.stats.Chi() in Python

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.




# Import sympy and chi
from sympy.stats import Chi, density, E
from sympy import Symbol, simplify
  
k = Symbol("k", integer = True)
z = Symbol("z")
  
# Using sympy.stats.Chi() method
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 :




# Import sympy and chi
from sympy.stats import Chi, density, E
from sympy import Symbol, simplify
  
k = 3
z = 2
  
# Using sympy.stats.Chi() method
X = Chi("x", k)
gfg = density(X)(z)
  
print(gfg)


Output :

4*sqrt(2)*exp(-2)/sqrt(pi)

Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments