Lab 6: Extreme Values



You may have noticed over the years that Mars occasionally appears especially bright in the night sky. This is because the Earth and Mars become unusually close in their orbits around Sun. The following diagram allows you to visualize the relative positions of the Earth and Mars (time is measured in days since January 1, 2000 and distance is measured in AU: 1 AU ≈ 93 million miles).

Because Earth is closer to Sun than Mars, it orbits faster. As a result, the two planets are closest together when Earth passes between Mars and Sun.

Try to find (approximately) two different dates when Earth passes between Mars and Sun. (Hint. One of them is around day 533, what’s another?) About how many days pass between times when this happens?

The orbit of a planet around the Sun is approximately an ellipse, but this is only an approximation. Below are equations that give the approximate \( (x,y,z) \) coordinates of Earth and Mars in space over time (measured in days after January 1, 2000). The equations are messy, because orbits are complicated. The important takeaway from these formulas is that xearth(t), yearth(t), zearth(t) are the coordinates of Earth on day \(t\) and xmars(t), ymars(t), zmars(t) are the coordinates of Mars on the same day. The dist(t) function on the last line measures the distance between Earth and Mars on day \( t \).
MC=0.093405
MO(t)=0.0091458*t+0.3246
MG(t)=MO(t)+MC*sin(MO(t))*(1+MC*cos(MO(t)))
MH(t)=atan2((0.9956)*sin(MG(t)),(cos(MG(t))-MC))+5.0003
MF(t)=1.5236*sqrt(( cos(MG(t))-MC)^2+((0.9956)*sin(MG(t)))^2)
EC=0.016709
EO(t)=6.21419244 + 0.017202*t
EG(t)=EO(t)+EC*sin(EO(t))*(1+EC*cos(EO(t)))
EH(t)=atan2(0.99986*sin(EG(t)),cos(EG(t))-EC)+4.938241
EF(t)=-sqrt(1+EC^2*sin(EG(t))^2+(-2*cos(EG(t))*EC+EC^2))
xearth(t) = EF(t)*cos(EH(t))
yearth(t) = EF(t)*sin(EH(t))
zearth(t) = 0
xmars(t) = MF(t)*(0.648685933*cos(MH(t))-0.761056213*sin(MH(t))*0.999478937)
ymars(t) = MF(t)*(0.761056213*cos(MH(t))+0.648685933*sin(MH(t))*0.999478937)
zmars(t) = MF(t)*(sin(MH(t))*0.032277747)
dist(t) = sqrt((xmars(t)-xearth(t))^2+(ymars(t)-yearth(t))^2+(zmars(t)-zearth(t))^2)


3. Consider the five-year period given by your instructor.

(a) Copy the above code into the SageMath evaluation cell below. This defines dist(t), which is the distance between Earth and Mars on day \( t \) in AU. Using the plot() command, create a plot of the distance from Earth to Mars over the given five-year period. Attach a printout of this plot to your lab report.
(b) How many local extrema do you see on this graph? How many of them are local maxima and how many local minima?
(c) Use the diff() command to define ddist(t) to be the derivative of \( \mathrm{dist}(t) \). Then plot ddist(t) over the given five-year period. Attach a printout of this plot to your lab report.
(d) Use the find_root() command to identify each root of ddist(t) shown in the plot from part (c). (Hint: For each root, you will need to find a small interval around that root, which does not contain any other root.) Use this to write down the critical points of \( \mathrm{dist}(t) \) in the given five-year period in your lab report.
(e) When were the two planets closest during the given five-year period? How close were they? When were they furthest? How far apart were they? (Hint: Find the distance from Earth to Mars at each critical point and the end points of the given five-year period by evaluating dist(t) at that time.)

Name:
Skip to toolbar