normal

final class boring_math.probability_distributions.distributions.normal.Normal

Bases: ContDist

Class for visualizing Normal distributions

The Normal, also called Gaussian, distribution is a continuous probability distribution with probability density function

f(x) = (1/√(2πσ²))exp(-(x-μ)²/2σ²)

where

  • μ is the mean value

  • σ is the standard deviation

__init__(mu: float = 0.0, sigma: float = 1.0)

init

param mu:

The mean of the normal distribution.

param sigma:

The std deviation of the normal distribution.

__repr__() → str

repr string

returns:

The string ‘Normal(μ, σ)’ where μ is the mean and σ is the std deviation of the distribution.

__str__() → str

user string

returns:

The string ‘Normal(mu=μ, sigma=σ)’ where μ is the mean and σ is the std deviation of the distribution.

pdf(x: float) → float

Normal PDF

Normal probability distribution function.

param x:

x ∈ [-∞, ∞]

returns:

Value of the PDF at x.

cdf(x: float) → float

Normal cumulative probability distribution function.

__add__(other: Self | float) → Self

add

Add together two Normal distributions.

Normal distributions are stable, thus if two independent random variables X₁ and X₂ are normally distributed then aX₁ + bX₂ is also a normally distributed with μ = μ₁ + μ₂ and σ² = a²σ₁² + b²σ₂².

__mul__(factor: float) → Self

mul

Scale Normal distribution by a non-zero factor.

__rmul__(factor: float) → Self

rmul

Scale Normal distribution by a non-zero factor.