Function elastic_energy_from_spring_constant
pub fn elastic_energy_from_spring_constant(
spring_constant: f64,
deformation: f64,
) -> Option<f64>Expand description
Computes elastic energy stored in a linear spring from stiffness and deformation.
Formula: U = 0.5 * k * x².
Returns None when spring_constant is negative or when any input or result is not finite.