Open In App

sympy.stats.Wald() in Python

Last Updated : 05 Aug, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

With the help of sympy.stats.Wald() method, we can get the continuous random variable which represents the inverse gaussian distribution as well as Wald distribution by using this method.

Syntax : sympy.stats.Wald(name, mean, lambda)
Where, mean and lambda are positive number.

Return : Return the continuous random variable.

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




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


Output :

2
-lambda*(-mean + z)
——————–
____ 2
___ _______ / 1 2*mean *z
\/ 2 *\/ lambda * / — *e
/ 3
\/ z
———————————————–
____
2*\/ pi

Example #2 :




# Import sympy and Wald
from sympy.stats import Wald, density
from sympy import Symbol, pprint
  
z = 0.86
mean = 6
lambda = 2.35
  
# Using sympy.stats.Wald() method
X = Wald("x", mean, lambda)
gfg = density(X)(z)
  
pprint(gfg)


Output :

0.498668646362573
—————–
____
\/ pi



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads