Did I find the right examples for you? yes no

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)
Create a continuous random variable with a Laplace distribution.

The density of the Laplace distribution is given by

.. math::
    f(x) := \frac{1}{2 b} \exp \left(-\frac{|x-\mu|}b \right)

Parameters
==========
(more...)

        def Laplace(name, mu, b):
    r"""
    Create a continuous random variable with a Laplace distribution.

    The density of the Laplace distribution is given by

    .. math::
        f(x) := \frac{1}{2 b} \exp \left(-\frac{|x-\mu|}b \right)

    Parameters
    ==========

    mu : Real number, the location (mean)
    b : Real number, `b > 0`, a scale

    Returns
    =======

    A RandomSymbol.

    Examples
    ========

    >>> from sympy.stats import Laplace, density
    >>> from sympy import Symbol

    >>> mu = Symbol("mu")
    >>> b = Symbol("b", positive=True)
    >>> z = Symbol("z")

    >>> X = Laplace("x", mu, b)

    >>> density(X)(z)
    exp(-Abs(-mu + z)/b)/(2*b)

    References
    ==========

    .. [1] http://en.wikipedia.org/wiki/Laplace_distribution
    .. [2] http://mathworld.wolfram.com/LaplaceDistribution.html
    """

    return rv(name, LaplaceDistribution, (mu, b))
        


src/s/y/sympy-HEAD/sympy/stats/tests/test_continuous_rv.py   sympy(Download)
from sympy.stats import (P, E, where, density, variance, covariance, skewness,
                         given, pspace, cdf, ContinuousRV, sample,
                         Arcsin, Benini, Beta, BetaPrime, Cauchy,
                         Chi, ChiSquared,
                         ChiNoncentral, Dagum, Erlang, Exponential,
def test_laplace():
    mu = Symbol("mu")
    b = Symbol("b", positive=True)
 
    X = Laplace('x', mu, b)