# Approximate distance from Earth to Mars at a given moment with reasonable (+/-100km) accuracy?

I've been scouring the internet for a straightforward way to approximate the distance between Earth and Mars at a given time. I hope to achieve an accuracy of about 100km.

• Try this: calsky.com/cs.cgi/Planets/5/1? – Dean Mar 18 '16 at 15:20
• If you're willing to do small computations then jpl horizons is a good source ssd.jpl.nasa.gov/?horizons – Astroynamicist Mar 19 '16 at 9:29
• If you're looking for a simple hand-calculable approximation and willing to assume circular orbits, I/we can provide one, but the accuracy will be nowhere near +- 100km. – user21 Mar 19 '16 at 13:45

## 2 Answers

Do not underestimate the astronomers! 100 km? That's absurd. Saturn('s center of mass) is located to within one mile's distance from the Sun. Mars is of course even much better located.

Here's a site I googled that seems to give current distance to Mars to within single kilometers. I don't know how that site makes up its numbers, but it is certainly possible to measure it like that. With mutual radio communication, there are really good opportunities for precis distance measuring. 135,834,832 km just now! Pretty close and that's why the ExoMars space probe was launched towards Mars a few days ago. And here is a table with the conunction distances just past and soon coming up.

• According to the fairly well-sourced space.stackexchange.com/a/5894/7073 we know the orbit of Mars to within hundreds of meters, and the orbit of Saturn to within a few tens of kilometers. – user21 Mar 19 '16 at 13:44
• +1 for Do not underestimate the astronomers! – uhoh Jan 12 '19 at 3:31

The python library, pyephem has this function.

import ephem
km = 149597871   # 1AU in km
m = ephem.Mars()
m.compute('2016/3/18')
print(m.earth_distance*km)

136729311.6250654

• Note that the implied accuracy is well beyond what is realistic. This doesn't actually give the distance accurate to 1/10 mm! – James K Mar 19 '16 at 6:33
• related: PyEphem under the hood - how does it calculate position of planets? As far as I can figure, starting in 2010 the VSOP models are fitted to ephemerides derived from numerical integration. Before that it may have been purely a perturbative model. The "new hotness" Python package Skyfield on the other hand will directly interpolate a JPL ephemeris of your choosing. Both are supported by the same person. – uhoh Jan 12 '19 at 3:42