pub struct GaussianDistribution {
pub mu: f64,
pub sigma: f64,
}Expand description
Normal (Gaussian) distribution with mean μ and standard deviation σ.
Fields§
§mu: f64Mean.
sigma: f64Standard deviation (must be > 0).
Implementations§
Source§impl GaussianDistribution
impl GaussianDistribution
Sourcepub fn cdf(&self, x: f64) -> f64
pub fn cdf(&self, x: f64) -> f64
Approximates the CDF Φ((x-μ)/σ) using the Abramowitz & Stegun rational approximation (maximum error 7.5 × 10⁻⁸).
Sourcepub fn sample_box_muller(&self, u1: f64, u2: f64) -> f64
pub fn sample_box_muller(&self, u1: f64, u2: f64) -> f64
Draws a sample using the Box–Muller transform given two uniform inputs.
Sourcepub fn mgf(&self, t: f64) -> f64
pub fn mgf(&self, t: f64) -> f64
Returns the moment generating function M_X(t) = exp(μt + σ²t²/2).
Sourcepub fn standard_moment(k: u32) -> f64
pub fn standard_moment(k: u32) -> f64
Returns the k-th central moment of the standard normal distribution (μ=0, σ=1). Even moments: (k-1)!! = 1·3·5·…·(k-1). Odd moments: 0.
Auto Trait Implementations§
impl Freeze for GaussianDistribution
impl RefUnwindSafe for GaussianDistribution
impl Send for GaussianDistribution
impl Sync for GaussianDistribution
impl Unpin for GaussianDistribution
impl UnsafeUnpin for GaussianDistribution
impl UnwindSafe for GaussianDistribution
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more