pub struct Exponential { /* private fields */ }Expand description
Exponential distribution with rate parameter λ.
Models the time between events in a Poisson process. The rate λ > 0 determines the expected frequency; the mean is 1/λ.
§Examples
use u_numflow::distributions::Exponential;
let exp = Exponential::new(0.5).unwrap();
assert!((exp.mean() - 2.0).abs() < 1e-10);
assert!((exp.cdf(2.0) - (1.0 - (-1.0_f64).exp())).abs() < 1e-10);Implementations§
Source§impl Exponential
impl Exponential
Sourcepub fn new(rate: f64) -> Result<Self, DistributionError>
pub fn new(rate: f64) -> Result<Self, DistributionError>
Creates a new Exponential distribution with the given rate λ.
Returns an error if λ ≤ 0 or λ is not finite.
Sourcepub fn quantile(&self, p: f64) -> Option<f64>
pub fn quantile(&self, p: f64) -> Option<f64>
Quantile (inverse CDF): x = −ln(1−p)/λ.
Returns None if p is not in [0, 1].
Sourcepub fn hazard_rate(&self) -> f64
pub fn hazard_rate(&self) -> f64
Hazard rate (failure rate): h(x) = λ (constant).
Trait Implementations§
Source§impl Clone for Exponential
impl Clone for Exponential
Source§fn clone(&self) -> Exponential
fn clone(&self) -> Exponential
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Exponential
impl Debug for Exponential
impl Copy for Exponential
Auto Trait Implementations§
impl Freeze for Exponential
impl RefUnwindSafe for Exponential
impl Send for Exponential
impl Sync for Exponential
impl Unpin for Exponential
impl UnsafeUnpin for Exponential
impl UnwindSafe for Exponential
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