(expr)
return ProductPSpace(*[rv.pspace for rv in rvs])
Returns the underlying Probability Space of a random expression.

    For internal use.

    Examples
    ========

    >>> from sympy.stats import pspace, Normal
    >>> from sympy.stats.rv import ProductPSpace
    >>> X = Normal('X', 0, 1)
    >>> pspace(2*X + 1) == X.pspace
    True
Returns the underlying Probability Space of a random expression.
Returns the underlying Probability Space of a random expression .
def pspace(expr):
    """
    Returns the underlying Probability Space of a random expression.

    For internal use.

    Examples
    ========

    >>> from sympy.stats import pspace, Normal
    >>> from sympy.stats.rv import ProductPSpace
    >>> X = Normal('X', 0, 1)
    >>> pspace(2*X + 1) == X.pspace
    True
    """

    rvs = random_symbols(expr)
    if not rvs:
        return None
    # If only one space present
    if all(rv.pspace == rvs[0].pspace for rv in rvs):
        return rvs[0].pspace
    # Otherwise make a product space
    return ProductPSpace(*[rv.pspace for rv in rvs])
def pspace ( expr ) : rvs = random_symbols ( expr ) if not rvs : return None # If only one space present if all ( rv . pspace == rvs [ 0 ] . pspace for rv in rvs ) : return rvs [ 0 ] . pspace # Otherwise make a product space return ProductPSpace ( * [ rv . pspace for rv in rvs ] )