The constant G, referred to as the gravitational constant, is the proportionality constant required to relate the weights, measured in kilograms, to the force, measured in newtons. In the unit SI system, G has a value $6.67x{10^{-11}}$$\frac{Nm^2}{kg^2}$. Knowing G, a determination of the size of the power of gravitation can be made. According to Newton's Law of Gravity, these two masses exert an attractive gravitational force of magnitude on each other. This is an incredibly small force, particularly when compared to the gravitational force of the entire earth on each mass which is 9.8 N. The reason that the gravitational force between two regular objects is so minimal is the factor that is not known. Individuals are drawn to any object around themselves but the forces are so weak in contrast to the natural forces and friction forces working on that they are totally impossible to detect. It is only when one or both of the masses is exceedingly large—planet-sized—that the force of gravity becomes significant.
Gravitational potential energy $U_G$ = mgy is analyzed as a line through the root of slope mg. The potential energy curve is called PE. TE is the complete energy line, E = K + $U_G$. It is horizontal since the mechanical energy is conserved, which ensures that the mechanical energy of the object E has the same value at each point. An object with this amount of total energy will require negative kinetic energy to be correct at the point where the total energy line crosses the potential-energy curve. Negative K is not theoretically feasible, so the particle cannot be in U > E positions. It’s possible to make the particle hit a higher value of y by throwing it faster. But it will raise E and make the overall energy line higher. It is necessary to remember that the TE line is under control. If an object is moved with a certain speed, or lower it from a different height, it will assign it a different total capacity. So, the object needs to be given various initial conditions and investigation on an energy diagram how it moves with that amount of total energy.
import numpy as np
import pylab as pl
import math
def evolve(M, m, r0, R, dt):
G=6.67e-11
v0=0
r=r0
t=0
times=[t]
velocity=[v0]
distances=[r]
while r>=R:
v=v0+(G*M/r**2)*dt
r=r-0.5*(v+v0)*dt
t=t+dt
v0=v
times.append(t)
velocity.append(v0)
distances.append(r)
return (times, velocity, distances)
## values for the planet
M = float(input("Enter mass of planet\n"))
m = float(input("Enter mass of object\n"))
R = float(input("Enter radius of planet\n"))
G= 6.67e-11
R0=R+20
T,V,r=evolve(M, m, R0, R, .001)
def gravity(M, m, R):
G=6.67e-11
gravity_int = ((G*M*m)/R**2);
return(gravity_int);
g = gravity(M, m, R);
t=(2*20/g)**0.5
t_n =[] #list to store values of numerical time
t_a =[] #list to store analytical time
heights= np.arange(10,1000)
for h in heights:
R0=R+h
T,V,r=evolve(M, m, R0, R, .001)
t_n.append(T[-1])
t_a.append((2*h/g)**0.5)
T[-1],t
(14.337999999997493, 2.028429355867981)
R = 6.4e6
t_numerical_1 = []
t_analytical_1 = []
t_numerical_2 = []
t_analytical_2 = []
heights = np.arange(10, 200)
for h in heights: # heights of 10 meter from the ground to 200 meter.
r0 = 6.4e6 + h
t, v, r = evolve(M, m, r0, R, 0.001)
t_numerical_1.append(t[-1])
t_analytical_1.append((2*(r0 - R)/g)**(0.5))
t, v, r = evolve(M, m, r0, R, 0.0001)
t_numerical_2.append(t[-1])
t_analytical_2.append((2*(r0 - R)/g)**(0.5))
t_numerical_1 = np.array(t_numerical_1)
t_analytical_1 = np.array(t_analytical_1)
t_numerical_2 = np.array(t_numerical_2)
t_analytical_2 = np.array(t_analytical_2)
pl.rcParams.update({'font.size': 18})
pl.figure(figsize=(12,10))
pl.plot(heights, (t_numerical_1 - t_analytical_1)*100/t_analytical_1, label="step-size = 0.001")
pl.plot(heights, (t_numerical_2 - t_analytical_2)*100/t_analytical_2, label="step-size = 0.0001")
pl.legend()
pl.xlabel("Height (meter)")
pl.ylabel("Fractional percentage error")
pl.title("Fractional Percent vs Height for Fractional and Numerical Values")
## pl.show()
Text(0.5, 1.0, 'Fractional Percent vs Height for Fractional and Numerical Values')
Now lets see how this result performs with the known result for varying gravity:
where $y_0$ is the initial distance of the object from the center of the Earth, and $\mu = G(m + M)$
def analytical_time(M, m, y0, y):
G=6.67e-11
mu=G*(m+M)
y_y0=y/y0
t = np.sqrt((y0**3)/(2*mu))
t = t*(np.sqrt(y_y0*(1-y_y0))+np.arccos(np.sqrt(y_y0)))
return t
T,V,r=evolve(M, m, 2*R, R, .001)
T=np.array(T)
V=np.array(V)
r=np.array(r)
t_a=analytical_time(M, m, 2*R, r)
pl.rcParams.update({'font.size': 18})
pl.figure(figsize=(12,10))
pl.plot(r, T, label="numerical solution")
pl.plot(r, t_a, "--", label="analytical solution")
pl.legend()
pl.xlabel("distance from the center of earth")
pl.ylabel("time of fall")
pl.title("Time vs Distance to Planet")
pl.show()
##funtion that calculates the veloctiy of object
T,V,r=evolve(M, m, 2*R, R, .001)
T=np.array(T)
V=np.array(V)
r=np.array(r)
t_a=analytical_time(M, m, 2*R, r)
pl.rcParams.update({'font.size': 18})
pl.figure(figsize=(12,10))
pl.plot(T, V, label="numerical solution")
pl.plot(t_a, V, "--", label="analytical solution")
pl.legend()
pl.xlabel("Velocity")
pl.ylabel("Time Of Fall")
pl.title("Velocity over Time")
pl.show()
## print result
G=6.67e-11
ke_result = (1/2)*m*V[-1]**2
v_analytical = math.sqrt((G*M)/R)
ke_analytical = (1/2)*m*(v_analytical**2)
print(ke_result, ke_analytical)
print((ke_result-ke_analytical)*100/ke_analytical)
31109299.416745696 31109296.874999996 8.170373345804243e-06
print("{:<10}".format("The Kinetic Energy is:"), "%.2f" % (ke_result/1000), "kJ")
print("{:<10}".format("The analytical Kinetic Energy is:"), "%.2f" % (ke_analytical/1000), "kJ")
print("{:<10}".format("The Percent Error between the two is:"), "%.6f" % ((ke_result-ke_analytical)*100/ke_analytical), "%")
print("{:<10}".format("The Gravity of the Planet is:"), "%.2f" % g, "m/s^2")
print("{:<10}".format("The Velocity of the Object is: "),"%.2f" % v_analytical, "m/s")
The Kinetic Energy is: 31109.30 kJ The analytical Kinetic Energy is: 31109.30 kJ The Percent Error between the two is: 0.000008 % The Gravity of the Planet is: 9.72 m/s^2 The Velocity of the Object is: 7887.88 m/s