Skip to main content

work

Function work 

Source
pub fn work(force: f64, displacement: f64) -> Option<f64>
Expand description

Computes mechanical work from a constant force and displacement.

Formula: W = F * d

Returns None when either input is not finite or when the computed result is not finite. Negative force and displacement values are allowed.

ยงExamples

use use_work::work;

assert_eq!(work(10.0, 2.0), Some(20.0));
assert_eq!(work(-10.0, 2.0), Some(-20.0));