Friday, September 5, 2025
HomeLanguagessympy.stats.RaisedCosine() in Python

sympy.stats.RaisedCosine() in Python

With the help of sympy.stats.RaisedCosine() method, we can get the continuous random variable which represents the Raised Cosine distribution.

Syntax : sympy.stats.RaisedCosine(name, mu, s)
Where, mu and s are real number and mu, s > 0.

Return : Return the continuous random variable.

Example #1 :
In this example we can see that by using sympy.stats.RaisedCosine() method, we are able to get the continuous random variable representing raised cosine distribution by using this method.




# Import sympy and RaisedCosine
from sympy.stats import RaisedCosine, density
from sympy import Symbol, pprint
  
z = Symbol("z")
mu = Symbol("mu", positive = True)
s = Symbol("s", positive = True)
  
# Using sympy.stats.RaisedCosine() method
X = RaisedCosine("x", mu, s)
gfg = density(X)(z)
  
pprint(gfg)


Output :

/ /pi*(-mu + z)\
|cos|————| + 1
| \ s /
= mu – s, z <= mu + s)
| 2*s
|
\ 0 otherwise

Example #2 :




# Import sympy and RaisedCosine
from sympy.stats import RaisedCosine, density
from sympy import Symbol, pprint
  
z = 1.2
mu = 1
s = 3
  
# Using sympy.stats.RaisedCosine() method
X = RaisedCosine("x", mu, s)
gfg = density(X)(z)
  
pprint(gfg)


Output :

cos(0.0666666666666667*pi) 1
————————– + –
6 6

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32265 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6634 POSTS0 COMMENTS
Nicole Veronica
11801 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11863 POSTS0 COMMENTS
Shaida Kate Naidoo
6752 POSTS0 COMMENTS
Ted Musemwa
7025 POSTS0 COMMENTS
Thapelo Manthata
6701 POSTS0 COMMENTS
Umr Jansen
6718 POSTS0 COMMENTS