📜  Python中的 sympy.stats.MultivariateT()函数

📅  最后修改于: 2022-05-13 01:55:50.268000             🧑  作者: Mango

Python中的 sympy.stats.MultivariateT()函数

借助sympy.stats.MultivariateT()方法,我们可以创建具有多元 T 分布的联合随机变量。

Syntax: sympy.stats.MultivariateT(syms, mu, sigma, v)

Parameters:
 syms: the symbol for identifying the random variable
 mu: a matrix representing the location vector
 sigma: The shape matrix for the distribution
 v: a real number

Returns: a joint random variable with multivariate T-distribution.

示例 #1:

Python3
# import sympy, MultivariateT, density, Symbol
from sympy.stats import density, MultivariateT
from sympy import Symbol, pprint
  
x = Symbol("x")
  
# using sympy.stats.MultivariateT() method
X = MultivariateT("x", [1, 1], [[1, 0], [0, 1]], 2)
multiVar = density(X)(1, 2)
  
pprint(multiVar)


Python3
# import sympy, MultivariateT, density, Symbol
from sympy.stats import density, MultivariateT
from sympy import Symbol, pprint
  
x = Symbol("x")
  
# using sympy.stats.MultivariateT() method
X = MultivariateT("x", [1, 1, 1], [[1, 0, 1], [0, 1, 0], [0, 0, 1]], 1 / 2)
multiVar = density(X)(1, 2, 3)
  
pprint(multiVar)


输出 :

2  
----
9*pi

示例 #2:

Python3

# import sympy, MultivariateT, density, Symbol
from sympy.stats import density, MultivariateT
from sympy import Symbol, pprint
  
x = Symbol("x")
  
# using sympy.stats.MultivariateT() method
X = MultivariateT("x", [1, 1, 1], [[1, 0, 1], [0, 1, 0], [0, 0, 1]], 1 / 2)
multiVar = density(X)(1, 2, 3)
  
pprint(multiVar)

输出 :

4 ____   ___           
2*\/ 11 *\/ 2 *Gamma(7/4)
-------------------------
         3/2             
   121*pi   *Gamma(1/4)