Did I find the right examples for you? yes no

# sympy.stats.Exponential

All Samples(28)  |  Call(20)  |  Derive(0)  |  Import(8)
Create a continuous random variable with an Exponential distribution.

The density of the exponential distribution is given by

.. math::
f(x) := \lambda \exp(-\lambda x)

with x > 0. Note that the expected value is 1/\lambda.

Parameters(more...)


        def Exponential(name, rate):
r"""
Create a continuous random variable with an Exponential distribution.

The density of the exponential distribution is given by

.. math::
f(x) := \lambda \exp(-\lambda x)

with x > 0. Note that the expected value is 1/\lambda.

Parameters
==========

rate : A positive Real number, \lambda > 0, the rate (or inverse scale/inverse mean)

Returns
=======

A RandomSymbol.

Examples
========

>>> from sympy.stats import Exponential, density, cdf, E
>>> from sympy.stats import variance, std, skewness
>>> from sympy import Symbol

>>> l = Symbol("lambda", positive=True)
>>> z = Symbol("z")

>>> X = Exponential("x", l)

>>> density(X)(z)
lambda*exp(-lambda*z)

>>> cdf(X)(z)
Piecewise((1 - exp(-lambda*z), z >= 0), (0, True))

>>> E(X)
1/lambda

>>> variance(X)
lambda**(-2)

>>> skewness(X)
2

>>> X = Exponential('x', 10)

>>> density(X)(z)
10*exp(-10*z)

>>> E(X)
1/10

>>> std(X)
1/10

References
==========

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

return rv(name, ExponentialDistribution, (rate, ))


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,

    X = Normal('x', mu1, s1)
Y = Normal('y', mu2, s2)
Z = Exponential('z', rate)
a, b, c = symbols('a b c', real=True, bounded=True)


    assert simplify(variance(X + a*Y + b)) == variance(X) + a**2*variance(Y)

assert E(Z) == 1/rate
assert E(a*Z + b) == a*E(Z) + b
assert E(X + a*Z + b) == mu1 + a/rate + b


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_rs_swap():
X = Normal('x', 0, 1)
Y = Exponential('y', 1)

XX = Normal('x', 0, 2)
YY = Normal('y', 0, 3)

expr = 2*X + Y
assert expr.subs(rs_swap((X, Y), (YY, XX))) == 2*XX + YY


def test_RandomDomain():
from sympy.stats import Normal, Die, Exponential, pspace, where
X = Normal('x1', 0, 1)
assert upretty(where(X > 0)) == u("Domain: x₁ > 0")

D = Die('d1', 6)
assert upretty(where(D > 4)) == u('Domain: d₁ = 5 ∨ d₁ = 6')

A = Exponential('a', 1)
B = Exponential('b', 1)


def test_RandomDomain():
from sympy.stats import Normal, Die, Exponential, pspace, where
X = Normal('x1', 0, 1)
assert str(where(X > 0)) == "Domain: x1 > 0"

D = Die('d1', 6)
assert str(where(D > 4)) == "Domain: Or(d1 == 5, d1 == 6)"

A = Exponential('a', 1)
B = Exponential('b', 1)


def test_latex_RandomDomain():
from sympy.stats import Normal, Die, Exponential, pspace, where
X = Normal('x1', 0, 1)
assert latex(where(X > 0)) == "Domain: x_{1} > 0"

D = Die('d1', 6)
assert latex(where(D > 4)) == r"Domain: d_{1} = 5 \vee d_{1} = 6"

A = Exponential('a', 1)
B = Exponential('b', 1)


def test_RandomDomain():
from sympy.stats import Normal, Die, Exponential, pspace, where
X = Normal('x1', 0, 1)
assert upretty(where(X > 0)) == u("Domain: x₁ > 0")

D = Die('d1', 6)
assert upretty(where(D > 4)) == u('Domain: d₁ = 5 ∨ d₁ = 6')

A = Exponential('a', 1)
B = Exponential('b', 1)


def test_RandomDomain():
from sympy.stats import Normal, Die, Exponential, pspace, where
X = Normal('x1', 0, 1)
assert str(where(X > 0)) == "Domain: x1 > 0"

D = Die('d1', 6)
assert str(where(D > 4)) == "Domain: Or(d1 == 5, d1 == 6)"

A = Exponential('a', 1)
B = Exponential('b', 1)


def test_latex_RandomDomain():