本文整理汇总了Python中crv.SingleContinuousPSpace类的典型用法代码示例。如果您正苦于以下问题:Python SingleContinuousPSpace类的具体用法?Python SingleContinuousPSpace怎么用?Python SingleContinuousPSpace使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SingleContinuousPSpace类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __new__
def __new__(cls, rate, symbol=None):
_value_check(rate > 0, "Rate must be positive.")
x = symbol or SingleContinuousPSpace.create_symbol()
pdf = rate * exp(-rate*x)
obj = SingleContinuousPSpace.__new__(cls, x, pdf, set=Interval(0, oo))
obj.rate = rate
return obj
示例2: __new__
def __new__(cls, R, symbol=None):
R = sympify(R)
x = symbol or SingleContinuousPSpace.create_symbol()
pdf = 2/(pi*R**2)*sqrt(R**2-x**2)
obj = SingleContinuousPSpace.__new__(cls, x, pdf, set = Interval(-R, R))
return obj
示例3: __new__
def __new__(cls, mean, std, symbol = None):
x = symbol or SingleContinuousPSpace.create_symbol()
pdf = exp(-(x-mean)**2 / (2*std**2)) / (sqrt(2*pi)*std)
obj = SingleContinuousPSpace.__new__(cls, x, pdf)
obj.mean = mean
obj.std = std
obj.variance = std**2
return obj
示例4: compute_cdf
def compute_cdf(self, expr, **kwargs):
from sympy import Lambda, Min
z = Dummy('z', real=True, bounded=True)
result = SingleContinuousPSpace.compute_cdf(self, expr, **kwargs)
result = result(z).subs({Min(z, self.right): z,
Min(z, self.left, self.right): self.left})
return Lambda(z, result)
示例5: __new__
def __new__(cls, name, mu, s):
mu, s = sympify(mu), sympify(s)
x = Symbol(name)
pdf = exp(-(x - mu)/s)/(s*(1 + exp(-(x - mu)/s))**2)
obj = SingleContinuousPSpace.__new__(cls, x, pdf)
return obj