/*
###########################################################################
This function computes the gravitational acceleration at the surface of a
sphere with mass (M kg) and radius (R meters).
ARGUMENTS:
Mstr = Mass of sphere in kilograms as a numeric string.
Rstr = Radius of sphere in meters as a numeric string.
ERRORS:
FALSE is returned if either argument is non-numeric.
###########################################################################
*/
function BC_Grav_Accel ($MassKgStr, $RadiusMetersStr, $Decimals=16)
{
// Read mass and radius arguments.
$M = trim($MassKgStr);
$R = trim($RadiusMetersStr);
// ----------------------------------------
// Error if either argument is non-numeric.
if (!Is_Numeric($M) or !Is_Numeric($R)) {return FALSE;}
$G_UNI = '0.0000000000667430';
$Q = 50;
$q = trim($Decimals);
// -------------------------------
// Done. Return force in Newtons.
return bcDiv(bcMul($G_UNI, $M, $Q), bcMul($R,$R, $Q), $q);
} // End of BC_Grav_Accel (...)