Open In App

sympy.stats.Moyal() in python

Last Updated : 05 Jun, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

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

Syntax : sympy.stats.Moyal(name, mu, sigma)
Where, mu and sigma are real number.
Return : Return the continuous random variable.

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




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


Output :

sqrt(2)*exp(-exp((mu – z)/sigma)/2 – (-mu + z)/(2*sigma))/(2*sqrt(pi)*sigma)

Example #2 :




# Import sympy and Moyal
from sympy.stats import Moyal, density, cdf
from sympy import Symbol, pprint
  
z = Symbol("z")
mu = Symbol("mu", positive = True)
sigma = Symbol("sigma", positive = True)
  
# Using sympy.stats.Moyal() method
X = Moyal("x", mu, sigma)
Z = density(X)(z)
gfg = simplify(cdf(X)(z))
  
print(gfg)


Output :

1 – erf(sqrt(2)*exp((mu – z)/(2*sigma))/2)



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads