pub fn gravitational_force(
mass_a: f64,
mass_b: f64,
distance: f64,
) -> Option<f64>Expand description
Computes the gravitational attraction between two point masses.
Formula: F = G * m1 * m2 / r^2
Returns None when either mass is negative, when distance is less than or equal to zero,
or when the computed result is not finite.
ยงExamples
use use_gravity::{GRAVITATIONAL_CONSTANT, gravitational_force};
assert_eq!(gravitational_force(1.0, 1.0, 1.0), Some(GRAVITATIONAL_CONSTANT));