Esempio n. 1
0
def sampling_E(expr,
               given_condition=None,
               library='scipy',
               numsamples=1,
               evalf=True,
               seed=None,
               **kwargs):
    """
    Sampling version of E

    See Also
    ========

    P
    sampling_P
    sampling_density
    """
    samples = list(
        sample_iter(expr,
                    given_condition,
                    library=library,
                    numsamples=numsamples,
                    seed=seed,
                    **kwargs))
    result = Add(*[samp for samp in samples]) / numsamples

    if evalf:
        return result.evalf()
    else:
        return result
Esempio n. 2
0
File: rv.py Progetto: kayhman/sympy
def sampling_E(condition, given=None, numsamples=1, evalf=True, **kwargs):
    """
    Sampling version of E

    See Also
    ========
    P
    sampling_P
    """

    samples = sample_iter(condition, given, numsamples=numsamples, **kwargs)

    result = Add(*list(samples)) / numsamples
    if evalf:   return result.evalf()
    else:       return result
Esempio n. 3
0
def sampling_E(condition, given=None, numsamples=1, evalf=True, **kwargs):
    """
    Sampling version of E

    See Also
    ========
    P
    sampling_P
    """

    samples = sample_iter(condition, given, numsamples=numsamples, **kwargs)

    result = Add(*list(samples)) / numsamples
    if evalf:
        return result.evalf()
    else:
        return result