Skip to main content

activity

Function activity 

Source
pub fn activity(decay_constant: f64, number_of_nuclei: f64) -> Option<f64>
Expand description

Computes activity from a decay constant and number of nuclei.

Formula: A = lambda * N.

Activity is returned in becquerels when decay_constant is expressed per second.

ยงExamples

use use_nuclear::activity;

assert_eq!(activity(2.0, 10.0), Some(20.0));
Examples found in repository?
examples/basic_usage.rs (line 16)
8fn main() -> Result<(), &'static str> {
9    let decay_law = DecayLaw::from_half_life(10.0).ok_or("expected valid half-life")?;
10    let remaining = decay_law
11        .remaining_quantity(100.0, 10.0)
12        .ok_or("expected valid remaining quantity")?;
13    let helium = NuclideNumbers::new(4, 2).ok_or("expected valid nuclide numbers")?;
14
15    assert!((remaining - 50.0).abs() < 1.0e-12);
16    assert_eq!(activity(2.0, 10.0), Some(20.0));
17    assert_eq!(helium.proton_count(), 2);
18    assert_eq!(helium.neutron_count(), 2);
19    assert_eq!(
20        binding_energy_mev_from_mass_defect_u(1.0),
21        Some(ATOMIC_MASS_UNIT_MEV_C2),
22    );
23
24    Ok(())
25}