Skip to main content

relativistic_momentum

Function relativistic_momentum 

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

Computes relativistic momentum p = γmv.

Returns None when mass is negative or not finite, when velocity is not finite or has a magnitude greater than or equal to the speed of light, or when the computed momentum is not finite.

§Examples

use use_relativity::{SPEED_OF_LIGHT, relativistic_momentum};

let expected = 1.25 * SPEED_OF_LIGHT * 0.6;

assert!((relativistic_momentum(1.0, SPEED_OF_LIGHT * 0.6).unwrap() - expected).abs() < 1.0e-3);