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 Chi distribution.

The density of the Chi distribution is given by

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

with :math:`x \geq 0`.

Parameters(more...)

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

    The density of the Chi distribution is given by

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

    with :math:`x \geq 0`.

    Parameters
    ==========

    k : A positive Integer, `k > 0`, the number of degrees of freedom

    Returns
    =======

    A RandomSymbol.

    Examples
    ========

    >>> from sympy.stats import Chi, density, E, std
    >>> from sympy import Symbol, simplify

    >>> k = Symbol("k", integer=True)
    >>> z = Symbol("z")

    >>> X = Chi("x", k)

    >>> density(X)(z)
    2**(-k/2 + 1)*z**(k - 1)*exp(-z**2/2)/gamma(k/2)

    References
    ==========

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

    return rv(name, ChiDistribution, (k,))
        


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_chi():
    k = Symbol("k", integer=True)
 
    X = Chi('x', k)
    assert density(X)(x) == 2**(-k/2 + 1)*x**(k - 1)*exp(-x**2/2)/gamma(k/2)