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. enter image description here Image source-Bing

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

  • 1
    $\begingroup$ Scott Manly has several videos using Universe Sandbox 1, 2 but that may not be what you're looking for. $\endgroup$
    – uhoh
    Commented Feb 24, 2020 at 3:11
  • 3
    $\begingroup$ 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. $\endgroup$
    – Infrisios
    Commented Feb 24, 2020 at 7:21
  • 1
    $\begingroup$ 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? $\endgroup$ Commented Feb 24, 2020 at 10:32
  • 1
    $\begingroup$ @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." $\endgroup$
    – uhoh
    Commented Feb 24, 2020 at 10:52
  • 2
    $\begingroup$ 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? $\endgroup$
    – uhoh
    Commented Feb 24, 2020 at 23:44

2 Answers 2


enter image description here

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' )

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: Stellarium screenshot showing info for Mars 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.

  • $\begingroup$ 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. $\endgroup$ Commented Feb 26, 2020 at 4:13
  • $\begingroup$ 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. $\endgroup$
    – Bob516
    Commented Feb 26, 2020 at 4:15
  • $\begingroup$ 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 ? $\endgroup$ Commented Feb 26, 2020 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.