Skip to content
Related Articles

Related Articles

Improve Article
sympy.stats.Moyal() in python
  • Last Updated : 05 Jun, 2020

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)

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course




My Personal Notes arrow_drop_up
Recommended Articles
Page :