Wednesday, June 10, 2026
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
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32515 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6896 POSTS0 COMMENTS
Nicole Veronica
12012 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12109 POSTS0 COMMENTS
Shaida Kate Naidoo
7018 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6963 POSTS0 COMMENTS