
Distance to Mars - bumbledraven
http://www.johndcook.com/blog/2015/10/24/distance-to-mars/
======
throwaway_yy2Di
If you go a bit further, you can build surprisingly interesting curves from
this math. Try calculating Mars' apparent motion, as observed on earth (i.e.,
projecting the difference of their positions onto a unit sphere). Its path is
a loopy [0] curve, and looks like this:

[https://imgur.com/a/I43kG](https://imgur.com/a/I43kG)

Note that you don't need to implement elliptical orbits to see this effect --
circular inclined orbits can exhibit it.

[0]
[https://en.wikipedia.org/wiki/Apparent_retrograde_motion](https://en.wikipedia.org/wiki/Apparent_retrograde_motion)

~~~
smcl
Brian Cox did a simple demonstration of why this was using some stones (link
below). It makes a nice bit of sense but it must have messed with early
astronomers heads when it was first observed

[https://www.youtube.com/watch?v=kbynKfNfHk4](https://www.youtube.com/watch?v=kbynKfNfHk4)

~~~
dsr_
It certainly did mess with early astronomers. They were also hindered by their
supposition that orbits are circles:

[http://c2.com/cgi/wiki?AddingEpicycles](http://c2.com/cgi/wiki?AddingEpicycles)

------
bottled_poe
Cool! This could be taken a step further, adding in the oscillation of the
moons rotation for slingshot and accounting for the travel time between earth-
moon-mars to come up with a good list of launch dates. I'm sure there are
other factors, I'm not a rocket scientist.

------
adaml_623
From Wiki[1] the aphelion and perihelion for Mars are 1.381 and 1.666 so I
think assuming that Mars orbit is circular is just wrong. The eccentricity is
9%. The inclination of Mar's orbit is also 1.8 degrees which makes a
difference as well.

Wiki also lists a closest approach to Earth of 0.372 AU and a furthest
distance of 2.675. The graphs on that link do not come close to those figures.
They are off by 25%.

Basically I do not understand why someone would take an orbital problem,
simplify all the interesting bits out of it and then put it up on a blog.
Maybe he was more interested in the maths than the physics.

(1) -
[https://en.wikipedia.org/wiki/Orbit_of_Mars#Table_of_orbital...](https://en.wikipedia.org/wiki/Orbit_of_Mars#Table_of_orbital_parameters)

~~~
johndcook
The results in the blog post wouldn't do to launch a probe, but they do give
you a good idea of how the distance varies over time. It's a little surprising
that such a simple calculation works as well as it does. More accurate
calculations would be interesting, much more complicated.

------
pmontra
This computes the exact distances of Earth to any planet in the solar system

apt-get install aa [https://packages.debian.org/source/sid/astronomical-
almanac](https://packages.debian.org/source/sid/astronomical-almanac)

~~~
Tepix
Thanks! The current distance is 2.24AU and it's decreasing (2.192 AU in one
week).

------
exDM69
Whoa! I didn't know of the Python syntax for complex numbers (1j). I was
confusing the number 1 with lower case l and wondering where the "lj" symbol
is coming from. Apparently you also need to use exp() from scipy, Python's
standard math.exp() can't handle complex numbers (at least in python2).

The model in the blog post was obviously a simplified model. It assumes
circular and coplanar trajectories, both of which are good approximations for
back-of-a-napkin calculations such as this one but not super accurate for real
life analysis.

In the hopes that there are some programmers interested in astrodynamics or
celestial mechanics, I'll shamelessly take this opportunity to promote a
related programming project of mine:
[https://github.com/rikusalminen/twobody](https://github.com/rikusalminen/twobody)

It's a simple C library that solves some fundamental problems in celestial
mechanics, including state of the art solvers for time of flight (ie. solving
Kepler's equation using the Laguerre-Conway method) and can work in 3D and
with elliptic (and hyperbolic and parabolic) trajectories. It may seem a bit
cryptic (I wish I had the time to write docs), but if you're familiar with the
field, you should be able to understand most of it.

------
userbinator
Note: 1AU = 149597870700m. It takes _light_ around 8m20s to travel that
distance.

~~~
bumbledraven
500 seconds is a sightly easier way to remember the time.

------
barking
So earth and mars are circling the sun in the same direction, anticlockwise.

Earth has a shorter orbit and is also going nearly 25% faster.

If earth's at 12 o'clock, where is mars and what direction (N,S,E,W etc) do we
aim a rocket for the shortest journey?

~~~
Tepix
The most efficient way to get to Mars is nicely explained in Chapter 21 of
"From Stargazers to Starships":
[http://www.phy6.org/stargaze/Smars1.htm](http://www.phy6.org/stargaze/Smars1.htm)

You are asking for the "shortest journey" however. Well, the shortest journey
would be to accelerate to the speed of light when they are pretty much closest
to each other and arrive a couple of minutes later. Not very feasible as of
2015.

~~~
barking
very helpful link thanks

------
jlebrech
so does NASA time it's launches to when it get's to 0.5 AU? you'd think we'd
have expeditions to mars every 2 years by now.

~~~
JoeAltmaier
Its never a direct ballistic route - its a dance of orbital slingshots. You
launch from here, so when you get over there, that's where Mars is. And
sometimes you do a carom off Venus or whatever, to add some energy that you
couldn't afford to get by rocket fuel.

So no, the fact that Mars is sometimes very close to the Earth is not really
helpful. What'd be helpful is, if the max distance were not so great. But
we're stuck with what nature gave us.

It can help to try Kerbal Space Program, to get a feel for orbital mechanics.
In fact, it may be the best way to get that feel.

~~~
dzdt
Slingshots have never been used for Earth-Mars launches where Mars is the
final destination. I am having trouble finding a reference as to whether a
Venus flyby could even reduce the energy budget for a Mars mission, but in
practice no one has ever decided to do that.

~~~
JoeAltmaier
Earth-Venus-Jupiter has been proposed; I assumed that Earth-Venus-Mars would
have some benefit. I stand corrected.

------
snvzz
I'd love a section of my i3 statusbar showing the current distance in light
seconds, at all times.

I'm surprised this isn't a thing yet.

~~~
Tepix
Use "aa" from the astronomical-almanac package to calculate the value, then
feed it into i3status.

Here's the current distance to Mars in AU:

    
    
      date  +"%Y%n%m%n%d%n%H%n%M%n%S%n1%n1%n4" |\
      aa|\
      sed -n '/distance/s/.*\([0-9]\.[0-9]* au\).*/\1/p'
    

And here it is in light minutes (useful for Skype!)

    
    
      date  +"%Y%n%m%n%d%n%H%n%M%n%S%n1%n1%n4" |\
      aa |\
      sed -n '/light time/s/,.*//p'

~~~
snvzz
Much appreciated. Didn't know about aa.

------
StephenSmith
Nasa has an open source tool for this that handles light time.
[http://naif.jpl.nasa.gov/naif/toolkit.html](http://naif.jpl.nasa.gov/naif/toolkit.html)

Sadly, language options are c, FORTRAN, or poorly maintained MATLAB.

~~~
maaku
> Sadly, language options are c, FORTRAN, or poorly maintained MATLAB.

It's sad that that makes you sad.

