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

# crv_types.RaisedCosine

All Samples(1)  |  Call(0)  |  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
==========

..  http://en.wikipedia.org/wiki/Raised_cosine_distribution
"""

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