Skip to main content

work_from_force_samples

Function work_from_force_samples 

Source
pub fn work_from_force_samples(
    displacements: &[f64],
    forces: &[f64],
) -> Option<f64>
Expand description

Approximates work from aligned force and displacement samples.

Formula: W = Σ(F_i * d_i)

Returns None when the slice lengths differ, when any value is not finite, or when the computed result is not finite. Returns Some(0.0) for two empty slices.