sympy.stats.Normal() in python
Last Updated :
05 Jun, 2020
With the help of sympy.stats.Normal()
method, we can get the continuous random variable which represents the normal distribution.
Syntax : sympy.stats.Normal(name, mean, std)
Where, mean and std are real number.
Return : Return the continuous random variable.
Example #1 :
In this example we can see that by using sympy.stats.Normal()
method, we are able to get the continuous random variable representing normal distribution by using this method.
from sympy.stats import Normal, density
from sympy import Symbol, pprint
z = Symbol( "z" )
mean = Symbol( "mean" , positive = True )
std = Symbol( "std" , positive = True )
X = Normal( "x" , mean, std)
gfg = density(X)(z)
pprint(gfg)
|
Output :
2
-(-mean + z)
————–
2
___ 2*std
\/ 2 *e
———————
____
2*\/ pi *std
Example #2 :
from sympy.stats import Normal, density
from sympy import Symbol, pprint
z = 2
mean = 1.8
std = 4
X = Normal( "x" , mean, std)
gfg = density(X)(z)
pprint(gfg)
|
Output :
0.124843847615573*\/ 2
———————–
____
\/ pi
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...