当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Python Sympy stats.GeneralizedMultivariateLogGamma()用法及代码示例


借助sympy.stats.GeneralizedMultivariateLogGamma()方法,我们可以获得连续的联合随机变量,它代表了广义多元对数伽马分布。

用法: GeneralizedMultivariateLogGamma(syms, delta, v, lamda, mu)
参数:
1) Syms - list of symbols
2) Delta - a constant in range [0, 1]
3) V - positive real number
4) Lambda - a list of positive reals
5) mu - a list of positive real numbers.
返回:Return the continuous joint random variable.

范例1:
在这个例子中,我们可以通过使用sympy.stats.GeneralizedMultivariateLogGamma()该方法可以得到代表广义多元对数伽马分布的连续联合随机变量。

# Import sympy and GeneralizedMultivariateLogGamma 
from sympy.stats import density 
from sympy.stats.joint_rv_types import GeneralizedMultivariateLogGamma 
from sympy.stats.joint_rv import marginal_distribution 
from sympy import symbols, S 
  
v = 1
l, mu = [1, 1, 1], [1, 1, 1] 
d = S.Half 
y = symbols('y_1:4', positive = True) 
  
# Using sympy.stats.GeneralizedMultivariateLogGamma() method 
Gd = GeneralizedMultivariateLogGamma('G', d, v, l, mu) 
gfg = density(Gd)(y[0], y[1], y[2]) 
  
pprint(gfg)

输出:

  oo                                                      
_____                                                     
\    `                                                    
 \                                       y_1    y_2    y_3
  \     -n  (n + 1)*(y_1 + y_2 + y_3) - e    - e    - e   
   \   2  *e                                              
   /   ---------------------------------------------------
  /                            3                          
 /                        Gamma (n + 1)                   
/____,                                                    
n = 0                                                     
----------------------------------------------------------
                            2                             

范例2:

# Import sympy and GeneralizedMultivariateLogGamma 
from sympy.stats import density 
from sympy.stats.joint_rv_types import GeneralizedMultivariateLogGamma 
from sympy.stats.joint_rv import marginal_distribution 
from sympy import symbols, S 
  
v = 1
l, mu = [1, 2, 3], [2, 5, 1] 
d = S.One 
y = symbols('y_1:4', positive = True) 
  
# Using sympy.stats.GeneralizedMultivariateLogGamma() method 
Gd = GeneralizedMultivariateLogGamma('G', d, v, l, mu) 
gfg = density(Gd)(y[0], y[1], y[2]) 
  
pprint(gfg)

输出:

   oo                                                                        
______                                                                       
\     `                                                                      
 \                                                               5*y_2    y_3
  \                                                     2*y_1   e        e   
   \                   (n + 1)*(2*y_1 + 5*y_2 + y_3) - e      - ------ - ----
    \       n  -n - 1                                             2       3  
    /   10*0 *6      *e                                                      
   /    ---------------------------------------------------------------------
  /                                      3                                   
 /                                  Gamma (n + 1)                            
/_____,                                                                      
 n = 0                                        



相关用法


注:本文由纯净天空筛选整理自Jitender_1998大神的英文原创作品 Sympy stats.GeneralizedMultivariateLogGamma() in Python。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。