# How to determine the distance between where Earth and Mars are two specific dates?

How would I find the solar-system-relative distance between where Earth would be on 2106/8/16 and where Mars would be on 2106/10/16, or any combination of dates. Image source-Bing

Is there software that is accessible, and understandable, by the general public that would allow for this calculation?

• Scott Manly has several videos using Universe Sandbox 1, 2 but that may not be what you're looking for.
– uhoh
Commented Feb 24, 2020 at 3:11
• This question doesn't make a lot of sense. With flexible position of Mars, distance travelled depends on the excentricity of the orbit. Just saying it is "retrograde" doesn't give enough information to make calculations. Commented Feb 24, 2020 at 7:21
• If your spacecraft is so powerful that it can inject itself into an arbitrary retrograde hyperbolic orbit, then you more or less get to choose how far you're going to travel, surely? Commented Feb 24, 2020 at 10:32
• @StarfishPrime I think the question is asking for how to calculate the transit time for a given trajectory. The ship has a lot of power but it's not equipped with voice control "Siriexa, go to Mars as fast as you can."
– uhoh
Commented Feb 24, 2020 at 10:52
• I can post a helpful answer using python but it won't help if you don't have access to python. Can you use it a little, or are willing to learn, or can you find someone who can help you run it?
– uhoh
Commented Feb 24, 2020 at 23:44

You can use SPICE and JPL data. https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/

JPL publishes SPICE kernels of planetery ephemerides for these types of calculations. This plot is just for years 2040-2050, but their DE441 kernel has data all the way to year 17191. You can calculate the position and velocity vectors of Earth and Mars at any date.

Here is the Python script used to create this plot:

'''
Plot Earth-Mars relative distance for years 2040-2050
'''

# AWP libraries
import spice_data  as sd
import spice_tools as st

# 3rd party libraries
import spiceypy as spice
import numpy as np
import matplotlib.pyplot as plt
plt.style.use( 'dark_background' )

if __name__ == '__main__':
spice.furnsh( sd.leapseconds_kernel )
spice.furnsh( sd.de432s_kernel  )

et0   = spice.str2et( '2040-01-01' )
et1   = spice.str2et( '2050-01-01' )
ets   = np.arange( et0, et1, 50000 )
rs    = st.calc_ephemeris( 399, ets, 'J2000', 4 )[ :, :3 ]
dists = np.linalg.norm( rs, axis = 1 ) / 149.6e6
ts    = ( ets - et0 ) / ( 3600 * 24 * 365.0 ) + 2040.0

plt.figure( figsize = ( 12, 8 ) )
plt.plot( ts, dists, 'm' )
plt.xlabel( 'Time (years)' )
plt.ylabel( 'Earth-Mars Relative Distance (AU)' )
plt.title( 'Earth-Mars Relative Distance 2040-2050' )
plt.grid()
plt.show()


And the AWP Python library can be found here: https://github.com/alfonsogonzalez/AWP

Stellarium is a general planetarium program which is available for Linux, MacOS X and Windows and is pretty easy to use. Moving the mouse to the left side of the screen pops out options to change the date/time and to search for an object. I set the time to 2106-10-16 and searched for 'Mars' and got the following screenshot: Included in the admittedly large set of numbers is Distance: 2.111 AU (315.797 M km) so Mars was 2.111 astronomical units (1 au is the average Earth-Sun distance, approx. 150 million km) or 315.8 million km or 196 million miles from the Earth on that date and time.

• The OP wants the distance between the position of one planet on date A, and the position of the other planet on date B. Not on the same date. Commented Feb 26, 2020 at 4:13
• That gives me the distance between the two planets on on particular date. Not the distance between where Earth was on 2106-8-16 and where Mars would be on 2106-10-16. Commented Feb 26, 2020 at 4:15
• In that case, set Stellarium to 2106-8-16, record Earth's distance from the Sun, set to 2106-10-16, record Mars's distance from the Sun and subtract ? Commented Feb 26, 2020 at 21:40