Function velocity_addition
pub fn velocity_addition(velocity_a: f64, velocity_b: f64) -> Option<f64>Expand description
Computes relativistic velocity addition u = (v + w) / (1 + vw / c²).
Returns None when either velocity is not finite or has a magnitude greater than or equal to
the speed of light, when the denominator is zero, when the computed result is not finite, or
when the result has a magnitude greater than or equal to the speed of light.
§Examples
use use_relativity::{SPEED_OF_LIGHT, velocity_addition};
let expected = SPEED_OF_LIGHT * 0.8;
assert!((velocity_addition(SPEED_OF_LIGHT * 0.5, SPEED_OF_LIGHT * 0.5).unwrap() - expected).abs() < 1.0e-3);