Skip to main content

remaining_fraction_from_half_life

Function remaining_fraction_from_half_life 

pub fn remaining_fraction_from_half_life(
    half_life: f64,
    time: f64,
) -> Option<f64>
Expand description

Computes the remaining fraction from a half-life and elapsed time.

Formula: N / N0 = 2^(-t / t_half).

ยงExamples

use use_nuclear::remaining_fraction_from_half_life;

let remaining_fraction = remaining_fraction_from_half_life(10.0, 10.0)
    .ok_or("expected valid remaining fraction")?;

assert!((remaining_fraction - 0.5).abs() < 1.0e-12);