(expr, symbols=None)
return expr.xreplace(swapdict)
Given a random expression replace all random variables with their symbols.

    If symbols keyword is given restrict the swap to only the symbols listed.
Given a random expression replace all random variables with their symbols.
Given a random expression replace all random variables with their symbols .
def rv_subs(expr, symbols=None):
    """
    Given a random expression replace all random variables with their symbols.

    If symbols keyword is given restrict the swap to only the symbols listed.
    """
    if symbols is None:
        symbols = random_symbols(expr)
    if not symbols:
        return expr
    swapdict = dict([(rv, rv.symbol) for rv in symbols])
    return expr.xreplace(swapdict)
def rv_subs ( expr , symbols = None ) : if symbols is None : symbols = random_symbols ( expr ) if not symbols : return expr swapdict = dict ( [ ( rv , rv . symbol ) for rv in symbols ] ) return expr . xreplace ( swapdict )