Python中的sympy.stats.ExGaussian()
借助sympy.stats.ExGaussian()
方法,我们可以得到表示指数修正的高斯分布的连续随机变量。
Syntax : sympy.stats.ExGaussian(name, mean, std, rate)
Return : Return continuous random variable.
示例 #1:
在这个例子中我们可以看到,通过使用sympy.stats.ExGaussian()
方法,我们可以得到代表指数修正高斯分布的连续随机变量。
# Import sympy and ExGaussian
from sympy.stats import ExGaussian, density
from sympy import Symbol
mean = Symbol("mean", integer = True, positive = True)
std = Symbol("std", integer = True, positive = True)
rate = Symbol("rate", integer = True, positive = True)
z = Symbol("z")
# Using sympy.stats.ExGaussian() method
X = ExGaussian("x", mean, std, rate)
gfg = density(X)(z)
pprint(gfg)
输出 :
/ 2 \
rate*\2*mean + rate*std – 2*z/
——————————- / ___ / 2 \\
2 |\/ 2 *\mean + rate*std – z/|
rate*e *erfc|—————————-|
\ 2*std /
————————————————————————
2
示例 #2:
# Import sympy and ExGaussian
from sympy.stats import ExGaussian, density
from sympy import Symbol
mean = 22
std = 21
rate = 7
z = 0.4
# Using sympy.stats.ExGaussian() method
X = ExGaussian("x", mean, std, rate)
gfg = density(X)(z)
pprint(gfg)
输出 :
/ ___\
3.50044639861837e+4758*erfc\74.0142857142857*\/ 2 /