# How to express the Earth's orbital speed as a function of time?

I would like to create a function that tells me the orbital speed of Earth at any given day. The vis-viva equation says that v=√(GM(2/r-1/a) ), expressing speed as a function of distance from the Sun.

My question is, is it somehow possible to extend this equation so it will represent the orbital speed as a function of time (for example days from aphelion or so), rather than distance?

• If you want to do this from scratch, you can solve Kepler's equation. Or you can make your life easier by using an existing astronomy package, eg astropy. – PM 2Ring Mar 26 at 11:29
• There are some very useful equations here: en.wikipedia.org/wiki/Position_of_the_Sun – PM 2Ring Mar 26 at 11:37
• Like PM 2Ring already said, Kepler is the way to go if you are looking for an analytical solution if you reduce the problem to 2 bodies. If you want to calculate the real velocity and position to a higher degree of accuracy you also have to factor in the interaction with the other planets, which can be done only numerically, for an example code see notizblock.yukterez.net/viewtopic.php?p=170#plot you can also doublecheck your calculations with the ephemeris from ssd.jpl.nasa.gov/horizons.cgi – Yukterez Mar 26 at 14:20