Saturday, February 21, 2026
HomeLanguagessympy.stats.BetaBinomial() function in Python

sympy.stats.BetaBinomial() function in Python

With the help of sympy.stats.BetaBinomial() method, we can create a random variable who are able to denote the betabinomial distribution by using sympy.stats.BetaBinomial() method.

Syntax : sympy.stats.BetaBinomial(name, n, alpha, beta)

Parameters :
Name – It gives a name to a distribution.
N – Positive integer ‘n’ number of trials.
Alpha – Real positive number
Beta – Real positive number

Example #1 :
In this example, we can see that by using sympy.stats.BetaBinomial() method, we are able to create a random variable that denotes the beta-binomial distribution.




# Import Sympy and BetaBinomial
from sympy.stats import BetaBinomial, density
  
  
# Using sympy.stats.BetaBinomial() method
X = BetaBinomial('X', 2, 3, 1)
gfg = density(X).dict
  
print(gfg)


Output :

{0: 3*beta(3, 3), 1: 6*beta(4, 2), 2: 3/5}

Example #2 :




# Import Sympy and BetaBinomial
from sympy.stats import BetaBinomial, density
  
  
# Using sympy.stats.BetaBinomial() method
X = BetaBinomial('X', 5, 3, 4)
gfg = density(X).dict
  
print(gfg)


Output :

{0: beta(3, 9)/beta(3, 4), 1: 5*beta(4, 8)/beta(3, 4), 2: 10*beta(5, 7)/beta(3, 4), 3: 10*beta(6, 6)/beta(3, 4), 4: 5*beta(7, 5)/beta(3, 4), 5: beta(8, 4)/beta(3, 4)}

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

Most Popular

Dominic
32506 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6882 POSTS0 COMMENTS
Nicole Veronica
12005 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12099 POSTS0 COMMENTS
Shaida Kate Naidoo
7011 POSTS0 COMMENTS
Ted Musemwa
7255 POSTS0 COMMENTS
Thapelo Manthata
6967 POSTS0 COMMENTS
Umr Jansen
6956 POSTS0 COMMENTS