
    Ed[>                        d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
mZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZmZ ddlmZ ddlmZmZ ddlmZmZmZ ddl m!Z!m"Z" ddl#m$Z$m%Z% ddl&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z. ddl/m0Z0 ddl1m2Z2 ddl3m4Z4  G d de'          Z5 G d d          Z6 G d d          Z7 G d d          Z8e6e8e8e7dZ9 G d de)e(          Z: G d  d!e+          Z; G d" d#e)          Z<d$S )%zq
Joint Random Variables Module

See Also
========
sympy.stats.rv
sympy.stats.frv
sympy.stats.crv
sympy.stats.drv
    )prod)Basic)Lambda)S)DummySymbol)sympify)
ProductSetIndexed)Product)Sum	summation)Tuple)Integral	integrate)ImmutableMatrixmatrix2numpy
list2numpy)SingleContinuousDistributionSingleContinuousPSpace)SingleDiscreteDistributionSingleDiscretePSpace)ProductPSpaceNamedArgsMixinDistributionProductDomainRandomSymbolrandom_symbolsSingleDomain_symbol_converter)iterable)
filldedent)import_modulec                       e Zd ZdZd Zed             Zed             Zed             Zed             Z	ed             Z
ed             Zed	             Zd
 Zd ZddZd Zd ZddZd ZdS )JointPSpacezt
    Represents a joint probability space. Represented using symbols for
    each component and a distribution.
    c                     t          |t                    rt          ||          S t          |t                    rt	          ||          S t          |          }t          j        | ||          S N)
isinstancer   r   r   r   r!   r   __new__)clssymdists      4lib/python3.11/site-packages/sympy/stats/joint_rv.pyr*   zJointPSpace.__new__)   si    d899 	5)#t444d677 	3'T222$$}S#t,,,    c                     | j         j        S r(   )domainsetselfs    r.   r2   zJointPSpace.set1   s    {r/   c                     | j         d         S )Nr   argsr3   s    r.   symbolzJointPSpace.symbol5       y|r/   c                     | j         d         S N   r6   r3   s    r.   distributionzJointPSpace.distribution9   r9   r/   c                 ,    t          | j        |           S r(   )JointRandomSymbolr8   r3   s    r.   valuezJointPSpace.value=   s     d333r/   c                     | j         j        }t          |t                    r!t	          t          |j                            S t          |t                    r|j        d         d         S t          j	        S )Nr   )
r=   r2   r)   r
   r   lenr7   r   limitsOne)r4   _sets     r.   component_countzJointPSpace.component_countA   s_     $dJ'' 	&S^^$$$g&& 	&;q>"%%ur/   c                 X      fdt           j                  D             }  j        | S )Nc                 :    g | ]}t          j        |          S  r   r8   .0ir4   s     r.   
<listcomp>z#JointPSpace.pdf.<locals>.<listcomp>L   s%    LLL1wt{A&&LLLr/   )rangerG   r=   )r4   r,   s   ` r.   pdfzJointPSpace.pdfJ   s7    LLLLd6J0K0KLLL t #&&r/   c                     t          | j                  }|st          | j        | j        j                  S t          d |D              S )Nc                 &    g | ]}|j         j        S rJ   )pspacer1   rM   rvs     r.   rO   z&JointPSpace.domain.<locals>.<listcomp>T   s    >>>Bry/>>>r/   )r   r=   r    r8   r2   r   r4   rvss     r.   r1   zJointPSpace.domainO   sM    T.// 	DT->-BCCC>>#>>>??r/   c                 &    | j         j        |         S r(   )r2   r7   )r4   indexs     r.   component_domainzJointPSpace.component_domainV   s    x}U##r/   c                    
  j         }|                    t                    rt          d           fdt	          |          D             }d |D             }t          t          ||                    }t           fd|D                       

fd|D             }d}t	          |          D ]S}||vrM||                              j	        j
        j        |                    t          ||                   ||<   |dz  }T j	        j        r$t          
t            j	        | g|R            }	n/ j	        j        r#t          
t!            j	        | g|R            }	|	                    |          S )Nz_Marginal distributions cannot be computed for symbolic dimensions. It is a work under progress.c                 :    g | ]}t          j        |          S rJ   rK   rL   s     r.   rO   z5JointPSpace.marginal_distribution.<locals>.<listcomp>^   s%    >>>AQ''>>>r/   c                 F    g | ]}t          t          |                    S rJ   )r   strrM   rN   s     r.   rO   z5JointPSpace.marginal_distribution.<locals>.<listcomp>_   s$    111qF3q66NN111r/   c           	   3   v   K   | ]3}t          t          t          j        |                              V  4d S r(   )r   r_   r   r8   rL   s     r.   	<genexpr>z4JointPSpace.marginal_distribution.<locals>.<genexpr>a   s?      JJQF3wt{A667788JJJJJJr/   c                     g | ]	}|v|g
S rJ   rJ   )rM   rN   r,   s     r.   rO   z5JointPSpace.marginal_distribution.<locals>.<listcomp>b   s$    9991ASL91$999r/   r   r<   )rG   atomsr   
ValueErrorrP   dictziptupleappendr=   r2   r7   is_Continuousr   r   is_Discreter   xreplace)r4   indicescountorigall_symsreplace_dictrD   rZ   rN   fr,   s   `         @r.   marginal_distributionz!JointPSpace.marginal_distributionY   s   $;;v 	Y X Y Y Y>>>>u>>>11D111C$//00JJJJ'JJJJJ9999999u 	 	A u$$T%6%:%?%BCCC %fUm 4 4u
* 	NsI&7d&7&BLVLLLMMAA* 	NsI&7d&7&BLVLLLMMAzz,'''r/   NFc           	          t           fdt           j                  D                       }p|t          fd|D                       s|S | j        z  }D ]}t          |t                    rC|                    |t          t          |j	                  |j
        d                   i          }Zt          |t                    r|                    ||j        i          } j        t          |          v rt          t!          d                    t           fd|D                       }t#          |g|R  S )Nc              3   2   K   | ]}j         |         V  d S r(   )r@   rL   s     r.   rb   z2JointPSpace.compute_expectation.<locals>.<genexpr>p   s)      HHqTZ]HHHHHHr/   c              3       K   | ]}|v V  	d S r(   rJ   rM   rN   rX   s     r.   rb   z2JointPSpace.compute_expectation.<locals>.<genexpr>r   s'      **18******r/   r<   zq
            Expectations of expression with unindexed joint random symbols
            cannot be calculated yet.c              3      K   | ]S}t          t          |j                  |j        d                    j        j        j        |j        d                   fV  TdS )r<   N)r   r_   baser7   r=   r2   )rM   rV   r4   s     r.   rb   z2JointPSpace.compute_expectation.<locals>.<genexpr>~   ss       D D8:  BGRWQZ88!&rwqz24 D D D D D Dr/   )rh   rP   rG   anyrQ   r)   r   rl   r_   ry   r7   r   r8   r@   r   NotImplementedErrorr#   r   )r4   exprrX   evaluatekwargssymsrV   rD   s   ` `     r.   compute_expectationzJointPSpace.compute_expectationo   sz   HHHHE$2F,G,GHHHHHkT****T***** 	KDH} 	6 	6B"g&& 6}}b'#bg,,
*K*K%LMMB-- 6}}b")_55:--- 	+%j 2) '* '* + + +  D D D D>BD D D D D&v&&&&r/   c                     t                      r(   r{   r4   	conditions     r.   wherezJointPSpace.where       !###r/   c                     t                      r(   r   )r4   r|   s     r.   compute_densityzJointPSpace.compute_density   r   r/   rJ   scipyc                 f    t          | j        |           | j                            |||          iS )zo
        Internal sample method

        Returns dictionary mapping RandomSymbol to realization value.
        )libraryseed)r   r8   r=   sample)r4   sizer   r   s       r.   r   zJointPSpace.sample   s?     T[$//1B1I1I$#$ 2J 20 20 1 	1r/   c                     t                      r(   r   r   s     r.   probabilityzJointPSpace.probability   r   r/   )NFrJ   r   N)__name__
__module____qualname____doc__r*   propertyr2   r8   r=   r@   rG   rQ   r1   r[   rs   r   r   r   r   r   rJ   r/   r.   r&   r&   $   s`        - - -   X   X   X 4 4 X4   X ' ' X' @ @ X@$ $ $( ( (,' ' ' '&$ $ $$ $ $1 1 1 1$ $ $ $ $r/   r&   c                   0    e Zd ZdZddZed             ZdS )SampleJointScipyz7Returns the sample from scipy of the given distributionNc                 0    |                      |||          S r(   )_sample_scipyr+   r-   r   r   s       r.   r*   zSampleJointScipy.__new__         tT222r/   c                   	
 ddl }|t          |t                    r|j                            |          	n|	ddlm
 	
fd	
fd	
fdd}d	 d
 d d}|                                }|j        j	        |vrdS  ||j        j	                 ||          }|
                    | ||j        j	                 |          z             S )zSample from SciPy.r   Nr   )statsc                     j                             t          | j                                                  t          | j                  |          S )N)meancovr   random_state)multivariate_normalrX   r   muflattensigmar-   r   
rand_statescipy_statss     r.   <lambda>z0SampleJointScipy._sample_scipy.<locals>.<lambda>   sO    A`AdAd!$'**2244 ,,4j Be BR BR r/   c                     j                             t          | j        t                                                    |          S )N)alphar   r   )	dirichletrX   r   r   floatr   r   s     r.   r   z0SampleJointScipy._sample_scipy.<locals>.<lambda>   sE    {?T?X?X U33;;==DWa @Y @c @c r/   c                     j                             t          | j                  t	          | j        t                                                    |          S )N)npr   r   )multinomialrX   intr   r   r   r   r   r   s     r.   r   z0SampleJointScipy._sample_scipy.<locals>.<lambda>   sL    +:Q:U:Udf++DFE!:!:!B!B!D!D4^h ;V ;j ;j r/   MultivariateNormalDistributionMultivariateBetaDistributionMultinomialDistributionc                 X    t          | j                                                  j        S r(   r   r   r   shaper-   s    r.   r   z0SampleJointScipy._sample_scipy.<locals>.<lambda>       <;P;P;X;X;Z;Z;` r/   c                 X    t          | j                                                  j        S r(   r   r   r   r   r   s    r.   r   z0SampleJointScipy._sample_scipy.<locals>.<lambda>       DJ9O9O9W9W9Y9Y9_ r/   c                 X    t          | j                                                  j        S r(   r   r   r   r   r   s    r.   r   z0SampleJointScipy._sample_scipy.<locals>.<lambda>       Jtv4F4F4N4N4P4P4V r/   )numpyr)   r   randomdefault_rngr   r   keys	__class__r   reshape)r+   r-   r   r   r   scipy_rv_mapsample_shape	dist_listsamplesr   r   s            @@r.   r   zSampleJointScipy._sample_scipy   sQ    	 	:dC00 	11t1<<JJJ....../R /R /R /R /R-c -c -c -c -c(j (j (j (j (j
 
 /a.`,_,_'V'V
 
 !%%''	>")3 	47,t~67dCCt&Kl4>3J&KD&Q&QQRRRr/   r(   )r   r   r   r   r*   classmethodr   rJ   r/   r.   r   r      sN        AA3 3 3 3 S S [S S Sr/   r   c                   0    e Zd ZdZddZed             ZdS )SampleJointNumpyz7Returns the sample from numpy of the given distributionNc                 0    |                      |||          S r(   )_sample_numpyr   s       r.   r*   zSampleJointNumpy.__new__   r   r/   c                   	 ddl }|t          |t                    r|j                            |          	n|		fd	fd	fdd}d d	 d
 d}|                                }|j        j        |vrdS  ||j        j                 |t          |                    }|	                    | ||j        j                 |          z             S )zSample from NumPy.r   Nr   c                                          t          | j        t                                                    t          | j        t                    |          S )N)r   r   r   )r   r   r   r   r   r   r-   r   r   s     r.   r   z0SampleJointNumpy._sample_numpy.<locals>.<lambda>   sN    A_A_!$'51199;; U33$ B` B@ B@ r/   c                                          t          | j        t                                                    |          S )N)r   r   )r   r   r   r   r   r   s     r.   r   z0SampleJointNumpy._sample_numpy.<locals>.<lambda>   s?    z?S?S U33;;==D @T @J @J r/   c                                          t          | j                  t          | j        t
                                                    |          S )N)r   pvalsr   )r   r   r   r   r   r   r   r   s     r.   r   z0SampleJointNumpy._sample_numpy.<locals>.<lambda>   sF    *:P:Pdf++Z%>%>%F%F%H%Ht ;Q ;U ;U r/   r   c                 X    t          | j                                                  j        S r(   r   r   s    r.   r   z0SampleJointNumpy._sample_numpy.<locals>.<lambda>   r   r/   c                 X    t          | j                                                  j        S r(   r   r   s    r.   r   z0SampleJointNumpy._sample_numpy.<locals>.<lambda>   r   r/   c                 X    t          | j                                                  j        S r(   r   r   s    r.   r   z0SampleJointNumpy._sample_numpy.<locals>.<lambda>   r   r/   )
r   r)   r   r   r   r   r   r   r   r   )
r+   r-   r   r   r   numpy_rv_mapr   r   r   r   s
            @r.   r   zSampleJointNumpy._sample_numpy   s2    	 	:dC00 	11t1<<JJJ/@ /@ /@ /@-J -J -J -J(U (U (U (U
 
 /a.`,_,_'V'V
 
 !%%''	>")3 	47,t~67d4jjIIt&Kl4>3J&KD&Q&QQRRRr/   r(   )r   r   r   r   r*   r   r   rJ   r/   r.   r   r      sN        AA3 3 3 3 S S [S S Sr/   r   c                   0    e Zd ZdZddZed             ZdS )SampleJointPymcz6Returns the sample from pymc of the given distributionNc                 0    |                      |||          S r(   )_sample_pymcr   s       r.   r*   zSampleJointPymc.__new__   s    dD111r/   c           	      n  	 	 ddl 	n# t          $ r ddl	Y nw xY w	fd	fd	fdd}d d d	 d}|                                }|j        j        |vrdS ddl}|                    d
                              |j	                   	
                                5   ||j        j                 |           	                    t          |          dd|dd          dd         d         }ddd           n# 1 swxY w Y   |                    | ||j        j                 |          z             S )zSample from PyMC.r   Nc                                          dt          | j        t                                                    t          | j        t                    d| j        j        d         f          S )NXr<   r   )r   r   r   )MvNormalr   r   r   r   r   r   r-   pymcs    r.   r   z.SampleJointPymc._sample_pymc.<locals>.<lambda>   s[    cl47E&B&B&J&J&L&L U33Atw}Q?O;P  R R r/   c                                          dt          | j        t                                                              S )Nr   )a)	Dirichletr   r   r   r   r   s    r.   r   z.SampleJointPymc._sample_pymc.<locals>.<lambda>   s3    sjU&C&C&K&K&M&MNN r/   c           	                               dt          | j                  t          | j        t
                                                    dt          | j                  f          S )Nr   r<   )r   r   r   )Multinomialr   r   r   r   r   r   rC   r   s    r.   r   z.SampleJointPymc._sample_pymc.<locals>.<lambda>   sX      DFTVU++3355aTV=M ! O O r/   r   c                 X    t          | j                                                  j        S r(   r   r   s    r.   r   z.SampleJointPymc._sample_pymc.<locals>.<lambda>   r   r/   c                 X    t          | j                                                  j        S r(   r   r   s    r.   r   z.SampleJointPymc._sample_pymc.<locals>.<lambda>   r   r/   c                 X    t          | j                                                  j        S r(   r   r   s    r.   r   z.SampleJointPymc._sample_pymc.<locals>.<lambda>   r   r/   pymc3r<   F)drawschainsprogressbarrandom_seedreturn_inferencedatacompute_convergence_checksr   )r   ImportErrorr   r   r   r   logging	getLoggersetLevelERRORModelr   r   r   )
r+   r-   r   r   pymc_rv_mapr   r   r   r   r   s
            @r.   r   zSampleJointPymc._sample_pymc   s    	!KKKK 	! 	! 	!      	!/R /R /R /R-O -O -O -O(O (O (O (O	
 	
 /a.`,_,_'V'V
 
  $$&&	>")3 	4'""++GM:::ZZ\\ 	i 	i0K/0666kkT

1%]ax}  [`k  a  a  bc  bc  bc  d  eh  iG	i 	i 	i 	i 	i 	i 	i 	i 	i 	i 	i 	i 	i 	i 	i t&Kl4>3J&KD&Q&QQRRRs    AC;;C?C?r(   )r   r   r   r   r*   r   r   rJ   r/   r.   r   r      sN        @@2 2 2 2 "S "S ["S "S "Sr/   r   )r   r   r   r   c                   \    e Zd ZdZdZd Zed             Zed             Zd Z	dd
Z
d Zd	S )JointDistributionz
    Represented by the random variables part of the joint distribution.
    Contains methods for PDF, CDF, sampling, marginal densities, etc.
    rQ   c                    t          t          t          |                    }t          t	          |                    D ]5}t          ||         t                     rt          ||                   ||<   6t          j        | g|R  S r(   )	listmapr	   rP   rC   r)   r   r   r*   )r+   r7   rN   s      r.   r*   zJointDistribution.__new__  sz    C&&''s4yy!! 	3 	3A$q'4(( 3)$q'22Q}S(4((((r/   c                 *    t          | j                  S r(   )r   symbolsr3   s    r.   r1   zJointDistribution.domain%  s    T\***r/   c                 &    | j         j        d         S r;   )densityr7   r3   s    r.   rQ   zJointDistribution.pdf)  s    | ##r/   c           	      R   t          |t                    s!t          |dt          |                    |                                }| j        j        j        }|                     t          d | j
        D                                 }t          t          |                    D ]}}||         j        r1t          |||         ||         j        |||                  f          }@||         j        r0t#          |||         ||         j        |||                  f          }~|S )Nz should be of type dict, got c              3   0   K   | ]}|j         d          V  dS r   Nr6   r`   s     r.   rb   z(JointDistribution.cdf.<locals>.<genexpr>2  s(      >>AafQi>>>>>>r/   )r)   rf   re   typer   r1   r2   setsrQ   rh   r  rP   rC   rj   r   infrk   r   )r4   otherrX   rF   r|   rN   r  s          r.   cdfzJointDistribution.cdf-  s   %&& 	W%%%eUVVVjjll{#xx>>>>>>>??s5zz"" 	$ 	$A1v# $"4#a&$q'+#a&M*# $ $Q# $dSVT!W[#a&M%# $ $r/   rJ   r   Nc                    d}||vrt          dt          |          z            t          |          st          d|z            t	          |         | ||          }||S t          d| j        j        d|          )z, A random realization from the distribution )r   r   r   r   z&Sampling from %s is not supported yet.zFailed to import %sr   NzSampling for z# is not currently implemented from )r{   r_   r$   re   _get_sample_class_jrvr   r   )r4   r   r   r   	librariessampss         r.   r   zJointDistribution.sample<  s     8	)# 	8%&N*-g,,'7 8 8 8W%% 	>2W<===%g.tTEEE 	L!!>***GG5  	r/   c                      | j         | S r(   r   r4   r7   s     r.   __call__zJointDistribution.__call__O      txr/   r   )r   r   r   r   	_argnamesr*   r   r1   rQ   r  r   r  rJ   r/   r.   r   r     s         
 I) ) ) + + X+ $ $ X$     &    r/   r   c                       e Zd ZdZd ZdS )r?   zg
    Representation of random symbols with joint probability distributions
    to allow indexing."
    c                     t          | j        t                    rL| j        j        |k    dk    r(t	          d| j        d| j        j        dz
  d          t          | |          S d S )NTzIndex keys for z can only up to r<   .)r)   rT   r&   rG   re   namer   )r4   keys     r.   __getitem__zJointRandomSymbol.__getitem__W  s    dk;// 	&+s2t; B jYYY ;a ? ? ?"A B B B4%%%		& 	&r/   N)r   r   r   r   r  rJ   r/   r.   r?   r?   R  s-         & & & & &r/   r?   c                   b    e Zd ZdZd Zd Zed             Zed             Zd Z	d Z
d Zd	 Zd
S )MarginalDistributionz
    Represents the marginal distribution of a joint probability space.

    Initialised using a probability distribution and random variables(or
    their indexed components) which should be a part of the resultant
    distribution.
    c                    t          |          dk    r*t          |d                   rt          |d                   }t          d |D                       st	          t          d                    t          j        d |D                       }t          |t                    s"t          t          |                    dk    r|S t          j        | ||          S )Nr<   r   c              3   N   K   | ] }t          |t          t          f          V  !d S r(   )r)   r   r   rU   s     r.   rb   z/MarginalDistribution.__new__.<locals>.<genexpr>l  s1      IIr:b7L"9::IIIIIIr/   zMarginal distribution can be
             intitialised only in terms of random variables or indexed random
             variablesc              3      K   | ]}|V  d S r(   rJ   rU   s     r.   rb   z/MarginalDistribution.__new__.<locals>.<genexpr>p  s"      ..BR......r/   )rC   r"   rh   allre   r#   r   fromiterr)   r   r   r   r*   )r+   r-   rX   s      r.   r*   zMarginalDistribution.__new__i  s    s88q= 	 Xc!f-- 	 A--CIISIIIII 	Z )      n..#.....$ 122 	s>$;O;O7P7PTU7U 	K}S$,,,r/   c                     d S r(   rJ   r3   s    r.   checkzMarginalDistribution.checku  s    r/   c                 V    d | j         d         D             }t          d |D              S )Nc                 <    g | ]}t          |t                    |S rJ   )r)   r   r`   s     r.   rO   z,MarginalDistribution.set.<locals>.<listcomp>z  s'    FFFQ*Q*E*EFqFFFr/   r<   c                 &    g | ]}|j         j        S rJ   )rT   r2   rU   s     r.   rO   z,MarginalDistribution.set.<locals>.<listcomp>{  s    888bBIM888r/   )r7   r
   rW   s     r.   r2   zMarginalDistribution.setx  s5    FF$)A,FFF88C88899r/   c                 4    | j         d         }d |D             S )Nr<   c                 &    h | ]}|j         j        S rJ   )rT   r8   rU   s     r.   	<setcomp>z/MarginalDistribution.symbols.<locals>.<setcomp>  s    ///R	 ///r/   r6   rW   s     r.   r  zMarginalDistribution.symbols}  s!    il//3////r/   c                    | j         d         | j         d         c}fdt          |          D             }t          |t                    r[t	          |j        j                   }t          dd          t          fd|D                       }|                    |          }nt          d D                       } t          || 
                    ||                     S )	Nr   r<   c                     g | ]}|v|	S rJ   rJ   rw   s     r.   rO   z,MarginalDistribution.pdf.<locals>.<listcomp>  s"    KKKaslK1KKKr/   xT)realc              3   8   K   | ]}t          |          V  d S r(   r   )rM   rN   r/  s     r.   rb   z+MarginalDistribution.pdf.<locals>.<genexpr>  s+      661A666666r/   c              3   r   K   | ]2}t          |t                    r|j        j        n|j        d          V  3dS r	  )r)   r   rT   r8   r7   rU   s     r.   rb   z+MarginalDistribution.pdf.<locals>.<genexpr>  sC      hh^`ZL-I-IY))rwWXzhhhhhhr/   )r7   r   r)   r   rC   r1   r   rh   rQ   r   compute_pdf)r4   r/  r|   marginalise_outrn   r   rX   s    `    @r.   rQ   zMarginalDistribution.pdf  s    IaL$)A,	cKKKKnT&:&:KKKd-.. 	i())Ec%%%A666666666D88D>>DDhhdghhhhhDDvdD,,T?CCDDaHHr/   c                     |D ]>}d}t          |t                    r|j        j        }|                     ||z  |          }?|S r;   )r)   r   rT   rQ   r4  )r4   r|   rX   rV   lpdfs        r.   r3  z MarginalDistribution.compute_pdf  sQ     	7 	7BD"l++ %y}''T	266DDr/   c                 <   ddl m} t          |t                    r|j        j        }nRt          |t                    r=|j                            |j                            |j	        d                             }|
                    ||j        j        i          }|j        j        rt          ||j        j        |f          }nW|j        j        rK|t          j        t          j        t          j        fv r|j        |j        f} |||j        j        |f          }|S )Nr   )r   r<   )sympy.concrete.summationsr   r)   r   rT   r2   r   ry   r[   r7   rl   r8   rj   r   rk   r   IntegersNaturals	Naturals0r  sup)r4   r|   rV   r   doms        r.   r4  z$MarginalDistribution.marginalise_out  s   111111b,'' 	8)-CCG$$ 	8'**	**271:668 8C}}b")"23449" 	6 D29#3S"9::DDY" 	6qz1:q{;; )w(3tbi.455Dr/   c                      | j         | S r(   r   r  s     r.   r  zMarginalDistribution.__call__  r  r/   N)r   r   r   r   r*   r&  r   r2   r  rQ   r3  r4  r  rJ   r/   r.   r  r  `  s         
- 
- 
-   : : X: 0 0 X0
I 
I 
I    &    r/   r  N)=r   mathr   sympy.core.basicr   sympy.core.functionr   sympy.core.singletonr   sympy.core.symbolr   r   sympy.core.sympifyr	   sympy.sets.setsr
   sympy.tensor.indexedr   sympy.concrete.productsr   r8  r   r   sympy.core.containersr   sympy.integrals.integralsr   r   sympy.matricesr   r   r   sympy.stats.crvr   r   sympy.stats.drvr   r   sympy.stats.rvr   r   r   r   r   r   r    r!   sympy.utilities.iterablesr"   sympy.utilities.miscr#   sympy.externalr$   r&   r   r   r   r  r   r?   r  rJ   r/   r.   <module>rQ     s[  	 	       " " " " " " & & & & & & " " " " " " - - - - - - - - & & & & & & & & & & & & ( ( ( ( ( ( + + + + + + 4 4 4 4 4 4 4 4 ' ' ' ' ' ' 9 9 9 9 9 9 9 9 D D D D D D D D D D P P P P P P P P L L L L L L L L= = = = = = = = = = = = = = = = = = = = / . . . . . + + + + + + ( ( ( ( ( (n$ n$ n$ n$ n$- n$ n$ n$b%S %S %S %S %S %S %S %SN%S %S %S %S %S %S %S %SN)S )S )S )S )S )S )S )SZ 	  : : : : :n : : :x
& 
& 
& 
& 
& 
& 
& 
&J J J J J< J J J J Jr/   