Did I find the right examples for you? yes no      Crawl my project      Python Jobs

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

The density of the Gamma distribution is given by

.. math::
    f(x) := \frac{1}{\Gamma(k) \theta^k} x^{k - 1} e^{-\frac{x}{\theta}}

with :math:`x \in [0,1]`.

Parameters(more...)

        def Gamma(name, k, theta):
    r"""
    Create a continuous random variable with a Gamma distribution.

    The density of the Gamma distribution is given by

    .. math::
        f(x) := \frac{1}{\Gamma(k) \theta^k} x^{k - 1} e^{-\frac{x}{\theta}}

    with :math:`x \in [0,1]`.

    Parameters
    ==========

    k : Real number, `k > 0`, a shape
    theta : Real number, `\theta > 0`, a scale

    Returns
    =======

    A RandomSymbol.

    Examples
    ========

    >>> from sympy.stats import Gamma, density, cdf, E, variance
    >>> from sympy import Symbol, pprint, simplify

    >>> k = Symbol("k", positive=True)
    >>> theta = Symbol("theta", positive=True)
    >>> z = Symbol("z")

    >>> X = Gamma("x", k, theta)

    >>> D = density(X)(z)
    >>> pprint(D, use_unicode=False)
                      -z
                    -----
         -k  k - 1  theta
    theta  *z     *e
    ---------------------
           gamma(k)

    >>> C = cdf(X, meijerg=True)(z)
    >>> pprint(C, use_unicode=False)
    /                                   /     z  \
    |                       k*lowergamma|k, -----|
    |  k*lowergamma(k, 0)               \   theta/
    <- ------------------ + ----------------------  for z >= 0
    |     gamma(k + 1)           gamma(k + 1)
    |
    \                      0                        otherwise

    >>> E(X)
    theta*gamma(k + 1)/gamma(k)

    >>> V = simplify(variance(X))
    >>> pprint(V, use_unicode=False)
           2
    k*theta


    References
    ==========

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

    return rv(name, GammaDistribution, (k, theta))
        


src/s/y/sympy-HEAD/sympy/stats/__init__.py   sympy(Download)
 
from . import crv_types
from .crv_types import (
    ContinuousRV,
    Arcsin, Benini, Beta, BetaPrime, Cauchy, Chi, ChiNoncentral, ChiSquared,