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 raised cosine distribution.

The density of the raised cosine distribution is given by

.. math::
    f(x) := \frac{1}{2s}\left(1+\cos\left(\frac{x-\mu}{s}\pi\right)\right)

with :math:`x \in [\mu-s,\mu+s]`.

Parameters(more...)

        def RaisedCosine(name, mu, s):
    r"""
    Create a Continuous Random Variable with a raised cosine distribution.

    The density of the raised cosine distribution is given by

    .. math::
        f(x) := \frac{1}{2s}\left(1+\cos\left(\frac{x-\mu}{s}\pi\right)\right)

    with :math:`x \in [\mu-s,\mu+s]`.

    Parameters
    ==========

    mu : Real number
    s : Real number, `s > 0`

    Returns
    =======

    A RandomSymbol.

    Examples
    ========

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

    >>> mu = Symbol("mu", real=True)
    >>> s = Symbol("s", positive=True)
    >>> z = Symbol("z")

    >>> X = RaisedCosine("x", mu, s)

    >>> D = density(X)(z)
    >>> pprint(D, use_unicode=False)
    /   /pi*(-mu + z)\
    |cos|------------| + 1
    |   \     s      /
    <---------------------  for And(z <= mu + s, mu - s <= z)
    |         2*s
    |
    \          0                        otherwise

    References
    ==========

    .. [1] http://en.wikipedia.org/wiki/Raised_cosine_distribution
    """

    return rv(name, RaisedCosineDistribution, (mu, s))
        


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_raised_cosine():
    mu = Symbol("mu", real=True)
    s = Symbol("s", positive=True)
 
    X = RaisedCosine("x", mu, s)