Python中的 sympy.stats.Benini()
借助sympy.stats.Benini()方法,我们可以得到代表贝尼尼分布的连续随机变量。
Syntax : sympy.stats.Benini(name, alpha, beta, sigma)
Where, alpha, beta and sigma are real number and greater than 0.
Return : Return the continuous random variable.
示例 #1:
在这个例子中,我们可以看到,通过使用 sympy.stats.Benini() 方法,我们可以得到表示贝尼尼分布的连续随机变量。
Python3
# Import sympy and Benini
from sympy.stats import Benini, density, cdf
from sympy import Symbol, simplify, pprint
alpha = Symbol("alpha", positive = True)
beta = Symbol("beta", positive = True)
sigma = Symbol("sigma", positive = True)
z = Symbol("z")
# Using sympy.stats.Benini() method
X = Benini("x", alpha, beta, sigma)
GFG = density(X)(z)
pprint(GFG, use_unicode = False)
Python3
# Import sympy and Benini
from sympy.stats import Benini, density, cdf
from sympy import Symbol, simplify, pprint
alpha = 4
beta = 6
sigma = 3
z = 0.2
# Using sympy.stats.Benini() method
X = Benini("x", alpha, beta, sigma)
GFG = density(X)(z)
pprint(GFG, use_unicode = False)
输出 :
/ / z \\ / z \ 2/ z \
| 2*beta*log|—–|| – alpha*log|—–| – beta*log |—–|
|alpha \sigma/| \sigma/ \sigma/
|—– + —————–|*e
\ z z /
示例 #2:
Python3
# Import sympy and Benini
from sympy.stats import Benini, density, cdf
from sympy import Symbol, simplify, pprint
alpha = 4
beta = 6
sigma = 3
z = 0.2
# Using sympy.stats.Benini() method
X = Benini("x", alpha, beta, sigma)
GFG = density(X)(z)
pprint(GFG, use_unicode = False)
输出 :
-5.60587100451865e-13