39.1: LSF Example - Tracking the Planets
- Page ID
- 70537
The following table lists the average distance from the sun to each of the first seven planets, using Earth’s distance as a unit of measure (AUs).
Mercury | Venus | Earth | Mars | Jupiter | Saturn | Uranus |
---|---|---|---|---|---|---|
0.39 | 0.72 | 1.00 | 1.52 | 5.20 | 9.54 | 19.2 |
The following is a plot of the data:
That the above plot does not look like a line, and so finding the line of best fit is not fruitful. It does, however look like an exponential curve (maybe a polynomial?). The following step transforms the distances using the numpy log
function and generates a plot that looks much more linear.
For this question we are going to find the coefficients (\(c\)) for the best fit line of the form \(c_1 + c_2 i = \log d\), where \(i\) is the index of the planet and \(d\) is the distance.
The following code constructs this problem in the form \(Ax=b\) and define the \(A\) matrix and the \(b\) matrix as numpy
matrices
Solve for the best fit of \(Ax=b\) and define a new variable \(c\) which consists of the of the two coefficients used to define the line (\(\log d = c_1 + c_2 i\))
Modify the following code (as needed) to plot your best estimates of \(c_1\) and \(c_2\) against the provided data.
We can determine the quality of this line fit by calculating the root mean squared error between the estimate and the actual data:
Finally, we can also make the plot on the original axis using the inverse of the log (i.e. the exp function):
The asteroid belt between Mars and Jupiter is what is left of a planet that broke apart. Let’s the above calculation again but renumber so that the index of Jupyter is 6, Saturn is 7 and Uranus is 8 as follows:
Repeat the calculations from above with the updated model. Plot the results and compare the RMSE.
This model of planet location was used to help discover Neptune and prompted people to look for the “missing planet” in position 5 which resulted in the discovery of the asteroid belt. Based on the above model, what is the estimated distance of the asteroid belt and Neptune (index 9) from the sun in AUs?
You can check your answer by searching for the answer on-line.