Open In App

sympy.stats.Rayleigh() in Python

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



Syntax : sympy.stats.Rayleigh(name, sigma)
Where, sigma are real number and sigma > 0.

Return : Return the continuous random variable.



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




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

Output :

2
-z
——–
2
2*sigma
z*e
———–
2
sigma

Example #2 :




# Import sympy and Rayleigh
from sympy.stats import Rayleigh, density
from sympy import Symbol, pprint
  
z = 0.35
sigma = 2
  
# Using sympy.stats.Rayleigh() method
X = Rayleigh("x", sigma)
gfg = density(X)(z)
  
pprint(gfg)

Output :

0.0861703622690834

Article Tags :