Explore Library
Code QuizIntermediate

Gaussian (Normal) PDF Evaluation

Find the error in the denominator of a Gaussian probability density formula.

Codepython
import numpy as np

def normal_pdf(x, mu, sigma):
    coeff = 1.0 / (sigma * np.sqrt(2 * np.pi))
    exponent = -((x - mu) ** 2) / (2 * sigma)
    return coeff * np.exp(exponent)

print(normal_pdf(0, 0, 2))

What is the bug in this Gaussian PDF implementation?