Skip to main content

contracted_length

Function contracted_length 

Source
pub fn contracted_length(proper_length: f64, speed: f64) -> Option<f64>
Expand description

Computes contracted length L = L0 / γ from proper length L0.

Returns None when proper_length is negative or not finite, when speed is invalid, or when the computed contracted length is not finite.

§Examples

use use_relativity::{SPEED_OF_LIGHT, contracted_length};

assert!((contracted_length(10.0, SPEED_OF_LIGHT * 0.6).unwrap() - 8.0).abs() < 1.0e-12);