Did I find the right examples for you? yes no

All Samples(4)  |  Call(2)  |  Derive(0)  |  Import(2)
Independence of two random expressions

Two expressions are independent if knowledge of one does not change
computations on the other.

Examples
========

>>> from sympy.stats import Normal, independent, given
>>> from sympy import Tuple, Eq(more...)

        def independent(a, b):
    """
    Independence of two random expressions

    Two expressions are independent if knowledge of one does not change
    computations on the other.

    Examples
    ========

    >>> from sympy.stats import Normal, independent, given
    >>> from sympy import Tuple, Eq

    >>> X, Y = Normal('X', 0, 1), Normal('Y', 0, 1)
    >>> independent(X, Y)
    True
    >>> independent(2*X + Y, -Y)
    False
    >>> X, Y = given(Tuple(X, Y), Eq(X+Y,3))
    >>> independent(X, Y)
    False

    See Also
    ========
    dependent
    """
    return not dependent(a, b)
        


src/s/y/sympy-HEAD/sympy/stats/tests/test_rv.py   sympy(Download)
from sympy import (EmptySet, FiniteSet, S, Symbol, Interval, exp, erf, sqrt,
        symbols, simplify, Eq, cos, And, Tuple, integrate, oo, sin, Sum, Basic,
        DiracDelta)
from sympy.stats import (Die, Normal, Exponential, P, E, variance, covariance,
        skewness, density, given, independent, dependent, where, pspace,
def test_dependence():
    X, Y = Die('X'), Die('Y')
    assert independent(X, 2*Y)
    assert not dependent(X, 2*Y)
 
    X, Y = Normal('X', 0, 1), Normal('Y', 0, 1)
    assert independent(X, Y)

src/s/y/sympy-HEAD/sympy/stats/tests/test_finite_rv.py   sympy(Download)
from sympy import (EmptySet, FiniteSet, S, Symbol, Interval, exp, erf, sqrt,
        symbols, simplify, Eq, cos, And, Tuple, Or, Dict, sympify, binomial,
        factor)
from sympy.stats import (DiscreteUniform, Die, Bernoulli, Coin, Binomial,
        Hypergeometric, P, E, variance, covariance, skewness, sample, density,