Saturday, December 28, 2024
Google search engine
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 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