Skip to main content

momentum

Function momentum 

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

Computes linear momentum using p = m * v.

Returns None when mass is negative, when either input is not finite, or when the computed momentum is not finite.

ยงExamples

use use_momentum::momentum;

assert_eq!(momentum(2.0, 3.0), Some(6.0));
assert_eq!(momentum(2.0, -3.0), Some(-6.0));