Skip to main content

de_broglie_wavelength_from_mass_velocity

Function de_broglie_wavelength_from_mass_velocity 

Source
pub fn de_broglie_wavelength_from_mass_velocity(
    mass: f64,
    velocity: f64,
) -> Option<f64>
Expand description

Computes de Broglie wavelength from mass and velocity using lambda = h / (m * |v|).

Returns None when mass is not positive and finite, when velocity is zero or not finite, or when the computed result is not finite.

ยงExamples

use use_quantum::{PLANCK_CONSTANT, de_broglie_wavelength_from_mass_velocity};

let wavelength =
    de_broglie_wavelength_from_mass_velocity(2.0, 3.0).ok_or("expected valid inputs")?;

assert!((wavelength - (PLANCK_CONSTANT / 6.0)).abs() < 1.0e-12);