normpdf(x: number,mu?: number,sigma?: number,): number
Computes the probability density function (PDF) of a normal distribution.
Returns the PDF of the normal distribution with mean mu and standard deviation sigma, evaluated at x.
If mu and sigma are not provided, it defaults to the standard normal distribution (mu = 0, sigma = 1).
Compute the standard normal PDF at x = 1
Compute the standard normal PDF at x = 1
import { assertEquals } from "jsr:@std/assert"; assertEquals(normpdf(1), 0.24197072451914337);
Compute normal PDF with custom mean and standard deviation
Compute normal PDF with custom mean and standard deviation
import { assertEquals } from "jsr:@std/assert"; assertEquals(normpdf(0, 10, 2), 7.433597573671488e-7);
Compute normal PDF at the mean (should be maximum)
Compute normal PDF at the mean (should be maximum)
import { assertEquals } from "jsr:@std/assert"; assertEquals(normpdf(5, 5, 1), 0.3989422804014327);