use core::f64::consts::LN_2;
pub const CURIE: f64 = 3.7e10;
pub fn activity(n: f64, half_life: f64) -> f64 {
n * LN_2 / half_life
}
pub fn activity_step_after_suppression(half_life: f64, duration: f64) -> f64 {
(LN_2 * duration / half_life).exp_m1()
}
pub fn ec_half_life_shift(t1: f64, t2: f64) -> f64 {
(t1 - t2) / t1
}
#[cfg(test)]
mod tests {
use super::*;
use crate::{AMU, N_A, YEAR};
#[test]
fn radium_is_about_one_curie_per_gram() {
let n = 1e-3 / (226.025_410 * AMU);
let a = activity(n, 1600.0 * YEAR);
assert!((a / 3.657e10 - 1.0).abs() < 1e-3 && (a / CURIE - 0.988).abs() < 1e-3);
assert!((n / (N_A / 226.025_410) - 1.0).abs() < 1e-6);
}
#[test]
fn a_two_day_stop_of_cobalt_60_leaves_a_permanent_step() {
let step = activity_step_after_suppression(1925.28, 2.0);
assert!((step / 7.2e-4 - 1.0).abs() < 1e-2 && step / 8e-5 > 9.0 && step / 6e-6 < 121.0);
assert!((activity_step_after_suppression(5.0, 5.0) - 1.0).abs() < 1e-15); }
#[test]
fn beryllium_7_inside_c60() {
assert!((ec_half_life_shift(53.12, 52.68) - 0.0083).abs() < 1e-4);
}
}