The Purpose of this project is to determine how Gravitational Forces react on an object falling from outer space onto a planet. The purpose of the experiment was to determine the exact velocity, time and kinetic energy of the object when it was in free fall for six different planets (Earth, Mercury, Venus, Mars, Jupiter, and The Sun) by writing a code that will find the values that we are looking for. Also this experiment aims to integrate experience and expertise with existing experience and to make proper use of it.
Newton claimed that any object in the universe attracts every other element with a force that is inversely proportional to the distance square between the objects and directly proportional to the mass production of the two objects. Each mass imposes an appealing force on the other, a force that calls gravitational force. These two forces form a pair of actions. $F_{\rm 1~on~2}$ is equal and opposite to $F_{\rm 2~n~1}$. The magnitude of the forces is given by Newton’s law of gravity. Two objects with masses $m_1$ and $m_2$ are a distance $r$ apart, the objects exert attractive forces on each other of magnitude.
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 of all needed libraries
import numpy as np
import pylab as pl
import math
## function that takes input and returns time/velocity/distance
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
## calculations for distance between planet and object
R0=R+20
T,V,r=evolve(M, m, R0, R, .001)
## funtion that calculates gravity
def gravity(M, m, R):
G=6.67e-11
gravity_int = ((G*M*m)/R**2);
return(gravity_int);
g = gravity(M, m, R);
## calculations and creation of arrays for both analytical and numerical time values
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)
##creates graph for fractional error
T[-1],t
t_n = np.array(t_n)
t_a = np.array(t_a)
pl.plot(heights, (t_n-t_a)*100/t_a)
pl.xlabel("Height")
pl.ylabel("Fractional % Error")
##pl.show()
pl.title("Fractional Percent Error in relation to Height")
pl.show()
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 = R + 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))
##arrays for the following graph
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)
##creates graph that compares numerical and analytical errrors
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()
## function to calculate analytical time
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
##creation of arrays and values need for following graph
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)
##creates a graph that compares time vs distance
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 Planet")
pl.ylabel("Time Of Fall")
pl.title("Time vs Distance to Planet")
pl.show()
##creation of arrays and values need for following graph
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)
##creates a graph that compares velocity vs time
pl.rcParams.update({'font.size': 18})
pl.figure(figsize=(12,10))
pl.plot(t_a, V, label="numerical solution")
pl.plot(T, V, "--", label="analytical solution")
pl.legend()
pl.ylabel("Velocity")
pl.xlabel("Time Of Fall")
pl.title("Velocity over Time")
pl.show()
##calculations for the kinetic energy
ke_result = (1/2)*m*V[-1]**2
v_analytical = math.sqrt((G*M)/R)
ke_analytical = (1/2)*m*(v_analytical**2)
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")
Enter mass of planet 5.97e24 Enter mass of object 1 Enter radius of planet 6.4e6
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
To conclude, the previous knowledge applied successfully and the codes we made have given us the necessary values we needed. Since we know that the acceleration of a free falling object near Earth’s surface is 9.80m/s2 and that the force causing the acceleration is the weight of the object, (from Newton’s second law), this is how we find mg.Using these givens and the equations above as mentioned in the theory, we found the equations for velocity and kinetic energy for the other planets where the gravitational force values are different than Earth’s, along with different mass and radius. Therefore we were able to determine the time, velocity, and kinetic energy it would take for an object to hit a planet such as Earth, Mercury, Venus, Jupiter, Mars and the sun. After plugging in our values of the different planets into the different equations that we used, we found our values. With using the codes above, we found our percentage error for each of the following and found that it was very low which indicates the reliability of the experiment.