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 student's t distribution.

The density of the student's t distribution is given by

.. math::
    f(x) := \frac{\Gamma \left(\frac{\nu+1}{2} \right)}
            {\sqrt{\nu\pi}\Gamma \left(\frac{\nu}{2} \right)}
            \left(1+\frac{x^2}{\nu} \right)^{-\frac{\nu+1}{2}}

Parameters(more...)

        def StudentT(name, nu):
    r"""
    Create a continuous random variable with a student's t distribution.

    The density of the student's t distribution is given by

    .. math::
        f(x) := \frac{\Gamma \left(\frac{\nu+1}{2} \right)}
                {\sqrt{\nu\pi}\Gamma \left(\frac{\nu}{2} \right)}
                \left(1+\frac{x^2}{\nu} \right)^{-\frac{\nu+1}{2}}

    Parameters
    ==========

    nu : Real number, `\nu > 0`, the degrees of freedom

    Returns
    =======

    A RandomSymbol.

    Examples
    ========

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

    >>> nu = Symbol("nu", positive=True)
    >>> z = Symbol("z")

    >>> X = StudentT("x", nu)

    >>> D = density(X)(z)
    >>> pprint(D, use_unicode=False)
              nu   1
            - -- - -
              2    2
    /     2\
    |    z |              /nu   1\
    |1 + --|        *gamma|-- + -|
    \    nu/              \2    2/
    ------------------------------
         ____   ____      /nu\
       \/ pi *\/ nu *gamma|--|
                          \2 /

    References
    ==========

    .. [1] http://en.wikipedia.org/wiki/Student_t-distribution
    .. [2] http://mathworld.wolfram.com/Studentst-Distribution.html
    """

    return rv(name, StudentTDistribution, (nu, ))
        


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_studentt():
    nu = Symbol("nu", positive=True)
 
    X = StudentT('x', nu)
    assert density(X)(x) == ((x**2/nu + 1)**(-nu/2 - S.Half)