Thursday, September 4, 2025
HomeLanguagessympy.stats.Beta() in Python

sympy.stats.Beta() in Python

With the help of sympy.stats.Beta() method, we can get the continuous random variable which represents the beta distribution.

Syntax : sympy.stats.Beta(name, alpha, beta)
Where, alpha and beta is greater than 0.
Return : Return the continuous random variable.

Example #1 :
In this example we can see that by using sympy.stats.Beta() method, we are able to get the continuous random variable represents the beta distribution by using this method.




# Import sympy and beta
from sympy.stats import Beta, density, E, variance
from sympy import Symbol, simplify, pprint, factor
  
alpha = Symbol("alpha", positive = True)
beta = Symbol("beta", positive = True)
z = Symbol("z")
  
# Using sympy.stats.Beta() method
X = Beta("x", alpha, beta)
gfg = density(X)(z)
  
pprint(gfg, use_unicode = False)


Output :

alpha – 1 beta – 1
z *(1 – z)
————————–
B(alpha, beta)

Example #2 :




# Import sympy and beta
from sympy.stats import Beta, density, E, variance
from sympy import Symbol, simplify, pprint, factor
  
alpha = 4
beta = 5
z = Symbol("z")
  
# Using sympy.stats.Beta() method
X = Beta("x", alpha, beta)
gfg = density(X)(z)
  
pprint(gfg, use_unicode = False)


Output :

3 4
z *(1 – z)
———–
B(4, 5)

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

Most Popular

Dominic
32261 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6626 POSTS0 COMMENTS
Nicole Veronica
11795 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11855 POSTS0 COMMENTS
Shaida Kate Naidoo
6747 POSTS0 COMMENTS
Ted Musemwa
7023 POSTS0 COMMENTS
Thapelo Manthata
6695 POSTS0 COMMENTS
Umr Jansen
6714 POSTS0 COMMENTS