Saturday, November 22, 2025
HomeLanguagessympy.stats.Normal() in python

sympy.stats.Normal() in python

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.




# Import sympy and Normal
from sympy.stats import Normal, density
from sympy import Symbol, pprint
  
z = Symbol("z")
mean = Symbol("mean", positive = True)
std = Symbol("std", positive = True)
  
# Using sympy.stats.Normal() method
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 :




# Import sympy and Normal
from sympy.stats import Normal, density
from sympy import Symbol, pprint
  
z = 2
mean = 1.8
std = 4
  
# Using sympy.stats.Normal() method
X = Normal("x", mean, std)
gfg = density(X)(z)
  
pprint(gfg)


Output :

0.124843847615573*\/ 2
———————–
____
\/ pi

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32407 POSTS0 COMMENTS
Milvus
97 POSTS0 COMMENTS
Nango Kala
6785 POSTS0 COMMENTS
Nicole Veronica
11932 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12000 POSTS0 COMMENTS
Shaida Kate Naidoo
6907 POSTS0 COMMENTS
Ted Musemwa
7168 POSTS0 COMMENTS
Thapelo Manthata
6864 POSTS0 COMMENTS
Umr Jansen
6851 POSTS0 COMMENTS