Chapter 8: Problem 4
The acceleration due to the Earth's gravity at any height \(h\) above the surface of the Earth is given by the equation $$ g=-G \frac{M}{(R+h)^{2}} $$ where \(G\) is the gravitational constant \(\left(6.672 \times 10^{-11} \mathrm{~N} \mathrm{~m}^{2} / \mathrm{kg}^{2}\right), M\) is the mass of the Earth \(\left(5.98 \times 10^{24} \mathrm{~kg}\right), R\) is the mean radius of the Earth \((6371 \mathrm{~km})\), and \(h\) is the height above the Earth's surface. If \(M\) is measured in \(\mathrm{kg}\) and \(R\) and \(h\) in meters, then the resulting acceleration will be in units of meters per second squared. Write a program to calculate the acceleration due to the Earth's gravity in \(500-\mathrm{km}\) increments at heights from \(0 \mathrm{~km}\) to \(40,000 \mathrm{~km}\) above the surface of the Earth. Print out the results in a table of height versus acceleration with appropriate labels, including the units of the output values. Plot the data as well.