top of page
learn_data_science.jpg

Data Scientist Program

 

Free Online Data Science Training for Complete Beginners.
 


No prior coding knowledge required!

Writer's pictureJames Owusu-Appiah

Universal Gravitation Calculator

Newton's Law Of Universal Gravitation Calculator

The law entails that objects with mass feel an attractive force that is proportional to their masses and inversely proportional to the square of the distance. Mathematically given as;

F = GMm/(r^2)

where F represents the force in Newtons, M and m represent the two masses in kilograms, and r represents the separation in meters. G represents the gravitational constant, which has a value of 6.674x10^-11N(m/kg)^2. Because of the magnitude of G, the gravitational force is very small unless large masses are involved.

G = 6.674e-11
#Taking the values of the masses involved
M = float(input('Enter the mass of the first object in kilograms: '))
m = float(input('Enter the mass of the second object in kilograms: '))

#Taking the input of the distance of separation between the two masses
r = float(input('Enter the distance of separation between the two masses in meters: '))

#Calculating the force
F = (G*M*m)/r**2

#Printing the force in newtons
print(