Skip to main content

work_by_gravity

Function work_by_gravity 

Source
pub fn work_by_gravity(
    mass: f64,
    gravitational_acceleration: f64,
    height_change: f64,
) -> Option<f64>
Expand description

Computes work done by gravity near a surface.

Formula: W = -m * g * Δh

Returns None when mass is negative, when any input is not finite, or when the computed result is not finite. Negative height changes are allowed.