+
    iU                        ^ RI Ht ^ RIHt ^ RIHt ^ RIHt ^ RIH	t	 ^ RI
Ht ^ RIHtHt ^ RIHtHtHtHtHtHtHtHtHt ^ R	IHtHtHtHtHtHtH t  ^ R
I!H"t"  ! R R]4      t#R t$ ! R R4      t% ! R R4      t& ! R R4      t'R]%R]'R]'R]&/t( ! R R] ]4      t) ! R R])4      t*R t+ ! R R])4      t,R t- ! R  R!])4      t.R" t/ ! R# R$])4      t0R% t1R&# )'    )prod)Basic)pi)S)exp)
multigamma)sympify_sympify)	ImmutableMatrixInverseTraceDeterminantMatrixSymbol
MatrixBase	Transpose	MatrixSetmatrix2numpy)_value_checkRandomMatrixSymbolNamedArgsMixinPSpace_symbol_converterMatrixDomainDistribution)import_modulec                      a  ] tR t^t o RtR t]! R 4      t]! R 4      t]R 4       t	]R 4       t
]R 4       tR tRR
 ltRtV tR	# )MatrixPSpacez8
Represents probability space for
Matrix Distributions.
c                    \        V4      p\        V4      \        V4      rCVP                  '       d   VP                  '       g   \        R 4      h\        P
                  ! WW#V4      # )zDimensions should be integers)r   r
   
is_integer
ValueErrorr   __new__)clssymdistributiondim_ndim_ms   &&&&&ڀ/Users/tonyclaw/.openclaw/workspace/skills/math-calculator/venv/lib/python3.14/site-packages/sympy/stats/matrix_distributions.pyr!   MatrixPSpace.__new__   sQ    $u   U%5%5%5<==}}S|EBB    c                (    V P                   ^,          # )   argsselfs   &r'   <lambda>MatrixPSpace.<lambda>    s    1r)   c                (    V P                   ^ ,          # r   r,   r.   s   &r'   r0   r1   !   s    499Q<r)   c                V    \        V P                  V P                  P                  4      # N)r   symbolr$   setr.   s   &r'   domainMatrixPSpace.domain#   s    DKK):):)>)>??r)   c                v    \        V P                  V P                  ^,          V P                  ^,          V 4      # )   )r   r6   r-   r.   s   &r'   valueMatrixPSpace.value'   s'    !$++tyy|TYYq\4PPr)   c                    V P                   0# r5   )r<   r.   s   &r'   valuesMatrixPSpace.values+   s    

|r)   c                    VP                  \        4      p\        V4      ^8  g   \        V\        4      '       g   \	        R4      hV P
                  P                  V4      # )r+   ztCurrently, no algorithm has been implemented to handle general expressions containing multiple matrix distributions.)atomsr   len
isinstanceNotImplementedErrorr$   pdf)r/   exprr-   rmss   &&* r'   compute_densityMatrixPSpace.compute_density/   sT    jj+,s8a<
41C D D% '5 6 6   $$T**r)   Nc                T    V P                   V P                  P                  WVR7      /# )z]
Internal sample method

Returns dictionary mapping RandomMatrixSymbol to realization value.
)libraryseed)r<   r$   sample)r/   sizerL   rM   s   &&&&r'   rN   MatrixPSpace.sample7   s*     

D--44TQU4VWWr)    rQ   scipyN)__name__
__module____qualname____firstlineno____doc__r!   propertyr$   r6   r8   r<   r?   rI   rN   __static_attributes____classdictcell____classdict__s   @r'   r   r      sw     C 56L/0F@ @ Q Q  +X Xr)   r   c                     \        \        \        V4      4      pV! V!  pVP                  ! V!   VP                  p\        WV^ ,          V^,          4      pVP                  # r3   )listmapr	   check	dimensionr   r<   )r6   r"   r-   distdimpspaces   &&&   r'   rvrf   @   sQ    GT"#D:DJJ
..C&AA7F<<r)   c                   >   a  ] tR t^It o RtRR lt]R 4       tRtV t	R# )SampleMatrixScipyz7Returns the sample from scipy of the given distributionNc                &    V P                  WV4      # r5   )_sample_scipyr"   rc   rO   rM   s   &&&&r'   r!   SampleMatrixScipy.__new__K         T22r)   c                  a
 ^ RI Ho
 ^ RIpRV
3R lRV
3R l/pRR RR /pVP                  4       pVP                  P
                  V9  d   R# Ve   \        V\        4      '       d   VP                  P                  VR	7      pMTpWQP                  P
                  ,          ! V\        V4      V4      p	V	P                  W&VP                  P
                  ,          ! V4      ,           4      # )
zSample from SciPy.)statsNWishartDistributionc                    < SP                   P                  \        V P                  4      \	        V P
                  \        4      VR 7      # ))dfscalerO   )wishartrvsintnr   scale_matrixfloatrc   rO   
rand_statescipy_statss   &&&r'   r0   1SampleMatrixScipy._sample_scipy.<locals>.<lambda>U   s<    +BUBUBYBYtvv;l43D3De&LSW CZ CYr)   MatrixNormalDistributionc                    < SP                   P                  \        V P                  \        4      \        V P
                  \        4      \        V P                  \        4      WR 7      # ))meanrowcovcolcovrO   random_state)matrix_normalru   r   location_matrixry   scale_matrix_1scale_matrix_2rz   s   &&&r'   r0   r}   W   sQ    {G`G`GdGd!$"6"6>#D$7$7?#D$7$7?d He Her)   c                 .    V P                   P                  # r5   rx   shaperc   s   &r'   r0   r}   ^       0A0A0G0Gr)   c                 .    V P                   P                  # r5   r   r   r   s   &r'   r0   r}   _       d6J6J6P6Pr)   rM   )rS   ro   numpykeys	__class__rT   rD   rv   randomdefault_rngr   reshape)r"   rc   rO   rM   r   scipy_rv_mapsample_shape	dist_listr{   sampr|   s   &&&&      @r'   rj   SampleMatrixScipy._sample_scipyN   s     	/! $Y& )e
 "#G&)P

 !%%'	>>"")3<:dC0011t1<JJNN334T4:zR||D0G0G#H#NNOOr)   rQ   r5   )
rT   rU   rV   rW   rX   r!   classmethodrj   rZ   r[   r\   s   @r'   rh   rh   I   s#     A3 P Pr)   rh   c                   >   a  ] tR t^ot o RtRR lt]R 4       tRtV t	R# )SampleMatrixNumpyz7Returns the sample from numpy of the given distributionNc                &    V P                  WV4      # r5   )_sample_numpyrk   s   &&&&r'   r!   SampleMatrixNumpy.__new__s   rm   r)   c                   / p/ pVP                  4       pVP                  P                  V9  d   R# ^ RIpVe   \	        V\
        4      '       d   VP                  P                  VR7      pMTpWAP                  P                  ,          ! V\        V4      V4      p	V	P                  W%VP                  P                  ,          ! V4      ,           4      # )zSample from NumPy.Nr   )
r   r   rT   r   rD   rv   r   r   r   r   )
r"   rc   rO   rM   numpy_rv_mapr   r   r   r{   r   s
   &&&&      r'   r   SampleMatrixNumpy._sample_numpyv   s    

 !%%'	>>"")3<:dC0011t1<JJNN334T4:zR||D0G0G#H#NNOOr)   rQ   r5   )
rT   rU   rV   rW   rX   r!   r   r   rZ   r[   r\   s   @r'   r   r   o   s#     A3 P Pr)   r   c                   >   a  ] tR t^t o RtRR lt]R 4       tRtV t	R# )SampleMatrixPymcz6Returns the sample from pymc of the given distributionNc                &    V P                  WV4      # r5   )_sample_pymcrk   s   &&&&r'   r!   SampleMatrixPymc.__new__   s    D11r)   c                  a	  ^ RI o	RV	3R lRV	3R l/pRR RR /pVP                  4       pVP                  P
                  V9  d   R# ^ RIpVP                  R4      P                  VP                  4       S	P                  4       ;_uu_ 4        WAP                  P
                  ,          ! V4       S	P                  \        V4      ^R	VR	R	R
7      R,          pRRR4       XP                  W%VP                  P
                  ,          ! V4      ,           4      #   \         d	    ^ RIo	 EL%i ; i  + '       g   i     L^; i)zSample from PyMC.Nr~   c           	         < SP                  R \        V P                  \        4      \        V P                  \        4      \        V P
                  \        4      V P                  P                  R7      # )X)mur   r   r   )MatrixNormalr   r   ry   r   r   r   rc   pymcs   &r'   r0   /SampleMatrixPymc._sample_pymc.<locals>.<lambda>   sW    T5F5Fs 4 4e<#D$7$7?#D$7$7?**00	 6G 62r)   rp   c                    < SP                  R \        V P                  4      \        V P                  \
        4      R7      # )r   )nur   )WishartBartlettrv   rw   r   rx   ry   r   s   &r'   r0   r      s3    0D0DStvv;,t/@/@%"H 1E 1Jr)   c                 .    V P                   P                  # r5   r   r   s   &r'   r0   r      r   r)   c                 .    V P                   P                  # r5   r   r   s   &r'   r0   r      r   r)   r   F)drawschainsprogressbarrandom_seedreturn_inferencedatacompute_convergence_checksr   )r   ImportErrorpymc3r   r   rT   logging	getLoggersetLevelERRORModelrN   r   r   )
r"   rc   rO   rM   pymc_rv_mapr   r   r   sampsr   s
   &&&&     @r'   r   SampleMatrixPymc._sample_pymc   s   	! ' )2
 " $J
 "#G&)P

  $$&	>>"")3&!**7==9ZZ\\//06KKd4j[_v{  Y^K  _  `c  dE  }}T1H1H$I$$OOPP5  	! 	!. \s   D A
D0D-,D-0E 	rQ   r5   )
rT   rU   rV   rW   rX   r!   r   r   rZ   r[   r\   s   @r'   r   r      s#     @2 Q Qr)   r   rS   r   r   r   c                   J   a  ] tR t^t o RtR t]R 4       tR tRR lt	Rt
V tR# )	MatrixDistributionz)
Abstract class for Matrix Distribution.
c                    V Uu. uF/  p\        V\        4      '       d   \        V4      M
\        V4      NK1  	  pp\        P
                  ! V .VO5!  # u upi r5   )rD   r_   r   r
   r   r!   )r"   r-   args   &* r'   r!   MatrixDistribution.__new__   sX    .24.2s )33(=(=$c]#.2 	 4}}S(4((4s   5Ac                     R # r5   rQ   r,   s   *r'   ra   MatrixDistribution.check   s    r)   c                f    \        V\        4      '       d   \        V4      pV P                  V4      # r5   )rD   r_   r   rF   )r/   rG   s   &&r'   __call__MatrixDistribution.__call__   s'    dD!!"4(Dxx~r)   Nc                   . ROpW$9  d   \        R\        V4      ,          4      h\        V4      '       g   \        RV,          4      h\        V,          ! WV4      pVe   V# \        RV P
                  P                  : RV: 24      h)zW
Internal sample method

Returns dictionary mapping RandomSymbol to realization value.
z&Sampling from %s is not supported yet.zFailed to import %szSampling for z# is not currently implemented from )rS   r   r   r   )rE   strr   r    _get_sample_class_matrixrvr   rT   )r/   rO   rL   rM   	librariesr   s   &&&&  r'   rN   MatrixDistribution.sample   s     8	#%&N*-g,'7 8 8W%%2W<==*73DEL!>>**G5 	r)   rQ   rR   )rT   rU   rV   rW   rX   r!   staticmethodra   r   rN   rZ   r[   r\   s   @r'   r   r      s2     )
  
 r)   r   c                   Z   a  ] tR t^t o Rt]R 4       t]R 4       t]R 4       t	R t
RtV tR# )MatrixGammaDistributionc                    \        V\        4      '       g   \        VP                  R 4       \        VP                  R4       \        V P
                  R4       \        VP
                  R4       R# )+The shape matrix must be positive definite.Should be square matrix#Shape parameter should be positive.z#Scale parameter should be positive.NrD   r   r   is_positive_definite	is_squareis_positivealphabetarx   s   &&&r'   ra   MatrixGammaDistribution.check   s[    ,55:: =4 5\++ . 	U&&(MNT%%'LMr)   c                p    V P                   P                  ^ ,          p\        W\        P                  4      # r3   rx   r   r   r   Realsr/   ks   & r'   r7   MatrixGammaDistribution.set   )    ##A&qww''r)   c                .    V P                   P                  # r5   r   r.   s   &r'   rb   !MatrixGammaDistribution.dimension        &&&r)   c                f   V P                   V P                  V P                  rCpVP                  ^ ,          p\	        V\
        4      '       d   \        V4      p\	        V\        \        34      '       g   \        R\        V4      ,          4      h\        V4      ) V,          V,          p\        \        V4      4      W5V,          ,          \        W%4      ,          ,          p\        V4      V) ,          p\        V4      V\!        V^,           4      ^,          ,
          ,          p	Wx,          V	,          # r   4%s should be an isinstance of Matrix or MatrixSymbol)r   r   rx   r   rD   r_   r   r   r   r    r   r   r   r   r   r   r   )
r/   xr   r   rx   psigma_inv_xterm1term2term3s
   &&        r'   rF   MatrixGammaDistribution.pdf  s    $(JJ		4;L;L\q!a"A!j,788 &(+A/ 0 0--a/$6E+&'$5/Z=Q)QR\*uf5Q51QU8A:#56}u$$r)   rQ   Nr   rT   rU   rV   rW   	_argnamesr   ra   rY   r7   rb   rF   rZ   r[   r\   s   @r'   r   r      sP     1IN N ( ( ' '% %r)   r   c                j    \        V\        4      '       d   \        V4      p\        V \        WV34      # )a  
Creates a random variable with Matrix Gamma Distribution.

The density of the said distribution can be found at [1].

Parameters
==========

alpha: Positive Real number
    Shape Parameter
beta: Positive Real number
    Scale Parameter
scale_matrix: Positive definite real square matrix
    Scale Matrix

Returns
=======

RandomSymbol

Examples
========

>>> from sympy.stats import density, MatrixGamma
>>> from sympy import MatrixSymbol, symbols
>>> a, b = symbols('a b', positive=True)
>>> M = MatrixGamma('M', a, b, [[2, 1], [1, 2]])
>>> X = MatrixSymbol('X', 2, 2)
>>> density(M)(X).doit()
exp(Trace(Matrix([
[-2/3,  1/3],
[ 1/3, -2/3]])*X)/b)*Determinant(X)**(a - 3/2)/(3**a*sqrt(pi)*b**(2*a)*gamma(a)*gamma(a - 1/2))
>>> density(M)([[1, 0], [0, 1]]).doit()
exp(-4/(3*b))/(3**a*sqrt(pi)*b**(2*a)*gamma(a)*gamma(a - 1/2))


References
==========

.. [1] https://en.wikipedia.org/wiki/Matrix_gamma_distribution

)rD   r_   r   rf   r   )r6   r   r   rx   s   &&&&r'   MatrixGammar     s1    V ,%%&|4f-\/JKKr)   c                   Z   a  ] tR tRt o Rt]R 4       t]R 4       t]R 4       t	R t
RtV tR# )	rp   iH  c                    \        V\        4      '       g   \        VP                  R 4       \        VP                  R4       \        V P
                  R4       R# )r   r   r   Nr   rw   rx   s   &&r'   ra   WishartDistribution.checkL  sH    ,55:: =4 5\++ . 	Q]]$IJr)   c                p    V P                   P                  ^ ,          p\        W\        P                  4      # r3   r   r   s   & r'   r7   WishartDistribution.setU  r   r)   c                .    V P                   P                  # r5   r   r.   s   &r'   rb   WishartDistribution.dimensionZ  r   r)   c                   V P                   V P                  r2VP                  ^ ,          p\        V\        4      '       d   \        V4      p\        V\        \        34      '       g   \        R\        V4      ,          4      h\        V4      ) V,          \        ^4      ,          p\        \        V4      4      ^WB,          \        ^4      ,          ,          \        V\        ^4      ,          V4      ,          ,          p\        V4      V) \        ^4      ,          ,          p\        V4      \        W$,
          ^,
          4      ^,          ,          pWg,          V,          # r   )rw   rx   r   rD   r_   r   r   r   r    r   r   r   r   r   r   r   )	r/   r   rw   rx   r   r   r   r   r   s	   &&       r'   rF   WishartDistribution.pdf^  s    &&$"3"3<q!a"A!j,788 &(+A/ 0 0--a/!A$6E+&'!ac!A$h-:a!fa;P)PQ\*qb1g6Q1QUQY<>2}u$$r)   rQ   Nr   r   r\   s   @r'   rp   rp   H  sP     %IK K ( ( ' '% %r)   rp   c                h    \        V\        4      '       d   \        V4      p\        V \        W34      # )aY  
Creates a random variable with Wishart Distribution.

The density of the said distribution can be found at [1].

Parameters
==========

n: Positive Real number
    Represents degrees of freedom
scale_matrix: Positive definite real square matrix
    Scale Matrix

Returns
=======

RandomSymbol

Examples
========

>>> from sympy.stats import density, Wishart
>>> from sympy import MatrixSymbol, symbols
>>> n = symbols('n', positive=True)
>>> W = Wishart('W', n, [[2, 1], [1, 2]])
>>> X = MatrixSymbol('X', 2, 2)
>>> density(W)(X).doit()
exp(Trace(Matrix([
[-1/3,  1/6],
[ 1/6, -1/3]])*X))*Determinant(X)**(n/2 - 3/2)/(2**n*3**(n/2)*sqrt(pi)*gamma(n/2)*gamma(n/2 - 1/2))
>>> density(W)([[1, 0], [0, 1]]).doit()
exp(-2/3)/(2**n*3**(n/2)*sqrt(pi)*gamma(n/2)*gamma(n/2 - 1/2))

References
==========

.. [1] https://en.wikipedia.org/wiki/Wishart_distribution

)rD   r_   r   rf   rp   )r6   rw   rx   s   &&&r'   Wishartr  l  s/    P ,%%&|4f)A+<==r)   c                   Z   a  ] tR tRt o Rt]R 4       t]R 4       t]R 4       t	R t
RtV tR# )	r~   i  c           	     B   \        V\        4      '       g   \        VP                  R 4       \        V\        4      '       g   \        VP                  R 4       \        VP                  R4       \        VP                  R4       V P
                  ^ ,          pV P
                  ^,          p\        VP
                  ^ ,          V8H  R\        V4      : R\        V4      : 24       \        VP
                  ^ ,          V8H  R\        V4      : R\        V4      : 24       R# )r   )Scale matrix 1 should be be square matrix)Scale matrix 2 should be be square matrix"Scale matrix 1 should be of shape  x "Scale matrix 2 should be of shape N)rD   r   r   r   r   r   r   )r   r   r   rw   r   s   &&&  r'   ra   MatrixNormalDistribution.check  s    .,77<< ?4 5.,77<< ?4 5^-- 0 	^-- 0 	!!!$!!!$^))!,1!!fc!f4. 	/^))!,1!!fc!f4. 	/r)   c                f    V P                   P                  w  r\        W\        P                  4      # r5   r   r   r   r   r   r/   rw   r   s   &  r'   r7   MatrixNormalDistribution.set  &    ##))qww''r)   c                .    V P                   P                  # r5   r   r.   s   &r'   rb   "MatrixNormalDistribution.dimension      ##)))r)   c                   V P                   V P                  V P                  rCpVP                  w  rV\	        V\
        4      '       d   \        V4      p\	        V\        \        34      '       g   \        R \        V4      ,          4      h\        V4      \        W,
          4      ,          \        V4      ,          W,
          ,          p\        \        V4      ) \        ^4      ,          4      p^\         ,          \        WV,          4      ^,          ,          \#        V4      \        V4      ^,          ,          ,          \#        V4      \        V4      ^,          ,          ,          p	W,          # )r   )r   r   r   r   rD   r_   r   r   r   r    r   r   r   r   r   r   r   r   )
r/   r   MUVrw   r   r   numdens
   &&        r'   rF   MatrixNormalDistribution.pdf  s    &&(;(;T=P=Pawwa"A!j,788 &(+A/ 0 0
9QU++GAJ6>5<-!$%tqvax ;q>AaDF#;;k!nqQRtTUv>VVwr)   rQ   N)r   r   r   r   r\   s   @r'   r~   r~     sN     GI/ /$ ( ( * * r)   r~   c                    \        V\        4      '       d   \        V4      p\        V\        4      '       d   \        V4      p\        V\        4      '       d   \        V4      pWV3p\        V \        V4      # )aC  
Creates a random variable with Matrix Normal Distribution.

The density of the said distribution can be found at [1].

Parameters
==========

location_matrix: Real ``n x p`` matrix
    Represents degrees of freedom
scale_matrix_1: Positive definite matrix
    Scale Matrix of shape ``n x n``
scale_matrix_2: Positive definite matrix
    Scale Matrix of shape ``p x p``

Returns
=======

RandomSymbol

Examples
========

>>> from sympy import MatrixSymbol
>>> from sympy.stats import density, MatrixNormal
>>> M = MatrixNormal('M', [[1, 2]], [1], [[1, 0], [0, 1]])
>>> X = MatrixSymbol('X', 1, 2)
>>> density(M)(X).doit()
exp(-Trace((Matrix([
[-1],
[-2]]) + X.T)*(Matrix([[-1, -2]]) + X))/2)/(2*pi)
>>> density(M)([[3, 4]]).doit()
exp(-4)/(2*pi)

References
==========

.. [1] https://en.wikipedia.org/wiki/Matrix_normal_distribution

)rD   r_   r   rf   r~   )r6   r   r   r   r-   s   &&&& r'   r   r     sd    R /4(()/:.$''(8.$''(8^<Df.55r)   c                   Z   a  ] tR tRt o Rt]R 4       t]R 4       t]R 4       t	R t
RtV tR# )	MatrixStudentTDistributioni  c           	        \        V\        4      '       g   \        VP                  R 8g  R4       \        V\        4      '       g   \        VP                  R 8g  R4       \        VP                  R 8g  R4       \        VP                  R 8g  R4       VP
                  ^ ,          pVP
                  ^,          p\        VP
                  ^ ,          V8H  R\        V4      : R\        V4      : 24       \        VP
                  ^ ,          V8H  R\        V4      : R\        V4      : 24       \        V P                  R 8g  R4       R# )	Fr   r  r  r  r  r  z#Degrees of freedom must be positiveN)rD   r   r   r   r   r   r   r   )r   r   r   r   rw   r   s   &&&&  r'   ra    MatrixStudentTDistribution.check  s$   .,77<<E Hb c.,77<<E Hb c^--6 9B 	C^--6 9B 	C!!!$!!!$^))!,1JMa&RUVWRX4Z 	[^))!,1JMa&RUVWRX4Z 	[R^^u,.STr)   c                f    V P                   P                  w  r\        W\        P                  4      # r5   r  r  s   &  r'   r7   MatrixStudentTDistribution.set  r  r)   c                .    V P                   P                  # r5   r   r.   s   &r'   rb   $MatrixStudentTDistribution.dimension  r  r)   c           	        ^ RI Hp \        V\        4      '       d   \	        V4      p\        V\
        \        34      '       g   \        R\        V4      ,          4      hV P                  V P                  V P                  V P                  3w  r4rVVP                  w  rx\        W7,           V,           ^,
          ^,          V4      \        V4      V) ^,          ,          ,          \        V4      V) ^,          ,          ,          \         Wx,          ^,          ,          \        W8,           ^,
          ^,          V4      ,          ,          p	V	\        V! V4      \#        V4      W,
          ,          \#        V4      ,          \%        W,
          4      ,          ,           4      W7,           V,           ^,
          ) ^,          ,          ,          # )r   )eyer   )sympy.matrices.denser*  rD   r_   r   r   r   r    r   r   r   r   r   r   r   r   r   r   r   )
r/   r   r*  r   r  OmegaSigmarw   r   Ks
   &&        r'   rF   MatrixStudentTDistribution.pdf  sL   ,a"A!j,788 /14Q8 9 9"ggt';';T=P=PRVReReeuww
Q)1-E0BaRT0JJ[Y^M_cdbdefbfMggac!e}z26A:q.!<<>KA)?)NyYZY^O_)_ _`FQJM"1$& & 	&r)   rQ   N)r   r   r   r   r   r\   s   @r'   r"  r"    sP     MIU U& ( ( * *& &r)   r"  c                    \        V\        4      '       d   \        V4      p\        V\        4      '       d   \        V4      p\        V\        4      '       d   \        V4      pWW43p\        V \        V4      # )a  
Creates a random variable with Matrix Gamma Distribution.

The density of the said distribution can be found at [1].

Parameters
==========

nu: Positive Real number
    degrees of freedom
location_matrix: Positive definite real square matrix
    Location Matrix of shape ``n x p``
scale_matrix_1: Positive definite real square matrix
    Scale Matrix of shape ``p x p``
scale_matrix_2: Positive definite real square matrix
    Scale Matrix of shape ``n x n``

Returns
=======

RandomSymbol

Examples
========

>>> from sympy import MatrixSymbol,symbols
>>> from sympy.stats import density, MatrixStudentT
>>> v = symbols('v',positive=True)
>>> M = MatrixStudentT('M', v, [[1, 2]], [[1, 0], [0, 1]], [1])
>>> X = MatrixSymbol('X', 1, 2)
>>> density(M)(X)
gamma(v/2 + 1)*Determinant((Matrix([[-1, -2]]) + X)*(Matrix([
[-1],
[-2]]) + X.T) + Matrix([[1]]))**(-v/2 - 1)/(pi**1.0*gamma(v/2)*Determinant(Matrix([[1]]))**1.0*Determinant(Matrix([
[1, 0],
[0, 1]]))**0.5)

References
==========

.. [1] https://en.wikipedia.org/wiki/Matrix_t-distribution

)rD   r_   r   rf   r"  )r6   r   r   r   r   r-   s   &&&&& r'   MatrixStudentTr1  /  sd    X /4(()/:.$''(8.$''(8@Df0$77r)   N)2mathr   sympy.core.basicr   sympy.core.numbersr   sympy.core.singletonr   &sympy.functions.elementary.exponentialr   'sympy.functions.special.gamma_functionsr   sympy.core.sympifyr	   r
   sympy.matricesr   r   r   r   r   r   r   r   r   sympy.stats.rvr   r   r   r   r   r   r   sympy.externalr   r   rf   rh   r   r   r   r   r   r   rp   r  r~   r   r"  r1  rQ   r)   r'   <module>r<     s     " ! " 6 > 0* * *K K K ()X6 )XX#P #PLP P>&Q &QR 
	 '~ '`#%0 #%J-Ld"%, "%H*>^+1 +Z06j.&!3 .&d38r)   