Friday, October 10, 2025
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
32348 POSTS0 COMMENTS
Milvus
87 POSTS0 COMMENTS
Nango Kala
6715 POSTS0 COMMENTS
Nicole Veronica
11878 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11941 POSTS0 COMMENTS
Shaida Kate Naidoo
6837 POSTS0 COMMENTS
Ted Musemwa
7097 POSTS0 COMMENTS
Thapelo Manthata
6791 POSTS0 COMMENTS
Umr Jansen
6791 POSTS0 COMMENTS