pub fn spring_potential_energy(
spring_constant: f64,
displacement: f64,
) -> Option<f64>Expand description
Computes the spring potential energy stored at a displacement.
Formula: U = 0.5 * k * x^2
Returns None when spring_constant is negative, when any input is not finite, or when the
computed result is not finite.