[Video/Article] How to Get Standard Normal Function in Python

https://www.youtube.com/shorts/V-yssaFYwvY

Short video on how to get the standard Normal/Gaussian/Bell Curve function in Python without writing your own implementation which is complex and error prone.

# Example of Standard Bell Curve Function in Python
from matplotlib import pyplot as plt
import numpy as np
import math  # no Gaussian function

# Get scipy add on module from scipy.org
from scipy.stats import norm  # Gaussian function in scipy.stats


# Custom Gaussian/Normal/Bell Curve custom function
def gaussian(x, mean, sigma):
    return 1./(math.sqrt(2.0*math.pi)*sigma)\
        * np.exp(-0.5*np.power((x - mean)/sigma, 2.))


x = np.linspace(-3, 3, 100)
# plt.plot(gaussian(x, 0.0, 1.0))
plt.plot(norm.pdf(x, loc=0.0, scale=1.0))
plt.grid(True)
plt.show()

(C) 2022 by John F. McGowan, Ph.D.

About Me

John F. McGowan, Ph.D. solves problems using mathematics and mathematical software, including developing gesture recognition for touch devices, video compression and speech recognition technologies. He has extensive experience developing software in C, C++, MATLAB, Python, Visual Basic and many other programming languages. He has been a Visiting Scholar at HP Labs developing computer vision algorithms and software for mobile devices. He has worked as a contractor at NASA Ames Research Center involved in the research and development of image and video processing algorithms and technology. He has published articles on the origin and evolution of life, the exploration of Mars (anticipating the discovery of methane on Mars), and cheap access to space. He has a Ph.D. in physics from the University of Illinois at Urbana-Champaign and a B.S. in physics from the California Institute of Technology (Caltech).