# What are common methods for calculating the time dependency of elliptical orbit?

After playing a game called "Kerbal Space Program" I got interested in orbital mechanics and started messing with simplified calculations to determine $\Delta v$ requirements. In which I compared two trajectories to get into orbit/land from orbit to see how much it would matter if you would burn vertical or horizontal (Hohmann) at the surface. Graphs of some results can be seen here.

However after this I also wanted to know how much time it would take to perform these maneuvers. I assumed that changes in velocity are instantaneous, so this would be equal to the time between the two changes in velocity. For the Hohmann-like-transfer it is simple, since you travel from periapsis tot apoapsis, which takes half of the orbital period (due to symmetry). But for the other transfer, which applies a vertical change in velocity at the surface, it is very difficult (if there is a sidereal rotational velocity). I tried solving it using Kepler's second law, given this formula: $$r=\frac{a(1-e^2)}{1+e\cos{\theta}}$$ Since the area underneath the path from $\theta_0$ to $\theta_1$ can be calculated like this: $$A_{\theta_0,\theta_1}=\int_{\theta_0}^{\theta_1}{\frac{1}{2}r^2d\theta}$$ Which can be used to determine the amount of time it would take, since the total area of the ellipse would take one orbital period $T=2\pi\sqrt{\frac{a^3}{\mu}}$: $$t_{\theta_0,\theta_1}=T\frac{\int_{\theta_0}^{\theta_1}{\frac{1}{2}r^2d\theta}}{\int_{0}^{2\pi}{\frac{1}{2}r^2d\theta}}=T\frac{\int_{\theta_0}^{\theta_1}{\frac{1}{2}r^2d\theta}}{\pi a^2\sqrt{1-e^2}}$$ I am not that good at solving integrals, so I both tried to solve it with MATLAB and WolframAlpha, which gave me this as the result: $$\int{\frac{1}{2}r^2d\theta}=a^2\sqrt{1-e^2}\left(\tan^{-1}\left(\frac{\sqrt{1-e^2}\tan{\frac{\theta}{2}}}{1+e}\right)-\frac{e\sqrt{1-e^2}\sin{\theta}}{2(1+e\cos{\theta})}\right)$$ So: $$t_{\theta_0,\theta_1}=\sqrt{\frac{a^3}{\mu}}\left[2\tan^{-1}\left(\frac{\sqrt{1-e^2}\tan{\frac{\theta}{2}}}{1+e}\right)-\frac{e\sqrt{1-e^2}\sin{\theta}}{1+e\cos{\theta}}\right]^{\theta_1}_{\theta_0}$$ However when I tried to determine the integral with symbolic parameters and bounderies, MATLAB returned "Warning: Explicit integral could not be found." probably because there is not a general solution for both closed and open orbits. But if I use this formula and filled in the boundaries myself, it seemed that I got wrong results. However when I let MATLAB calculate the integral for given values of $a$, $e$, $\theta_0$ and $\theta_1$ I do get results which seem correct.

So is this a good approach to find a time dependency of an (elliptical) orbit. If so is there an (continuous) equation derivable from this. And what might be a better approach?

EDIT: The unexpected results form this formula might be caused by the fact that $\tan^{-1}$ returns results from $-\frac{\pi}{2}$ to $\frac{\pi}{2}$. Since when I calculated the time from $\theta=0$ to $\theta=\pi$ I got results which agree with the conservation of energy and angular momentum. For this is used the following equations to determine the time derivatives: $$\omega=\frac{\delta\theta}{\delta t}=\frac{\delta \theta / \delta \theta}{\delta t / \delta \theta}=\sqrt{\frac{\mu}{a^3\left(1-e^2\right)^3}}\left(1+e\cos{\theta}\right)^2$$

$$\dot{r}=\frac{\delta r}{\delta t}=\frac{\delta r / \delta\theta}{\delta t / \delta\theta}=\omega\frac{\delta r}{\delta\theta}=\omega\frac{ae(1-e^2)\sin{\theta}}{\left(1+e\cos{\theta}\right)^2}$$ Which yields that the specific orbital energy $\epsilon$ and specific angular momentum $h$ are constant when substituting theses therms into there expressions:

$$\epsilon=\frac{v^2}{2}-\frac{\mu}{r}=\frac{\dot{r}^2+\omega^2r^2}{2}-\frac{\mu}{r}=-\frac{\mu}{2a}$$

$$h=\omega r^2=\sqrt{a\mu\left(1-e^2\right)}$$

-
–  Ben Crowell Jun 27 '13 at 19:47
@BenCrowell these Wikipedia pages suggest that there is no finite equation which describe an orbit (so an infinite sum of therms does not suffice). The equation I came up with is, however there does not seems to be an inverse function, so there is no equation for the position as a function of time, but there is an equation for the time as a function of the position. But I wonder if anyone else has come up with this? –  fibonatic Jun 30 '13 at 22:39

Your equation is equivalent to Kepler's equation, just in terms of true anomaly $\theta$ instead of eccentric anomaly $E$. Read more about it here.
$\tan \frac{\theta}{2} = \sqrt{\frac{1 + e}{1 - e}} \tan \frac{E}{2} \\ E = 2 \tan^{-1} \left( \sqrt{\frac{1 - e}{1 + e}} \tan \frac{\theta}{2} \right) = 2 \tan^{-1} \left( \frac{\sqrt{1 - e^2}}{1 + e} \tan \frac{\theta}{2} \right) \\ n t = M = E - e \sin E \\ t = \frac{P}{2 \pi} ( E - e \sin E )$
Having Wolfram Alpha or Mathematica do the trig simplification, we get (moving $i$ inside the square root)
$\sin E = \frac{\sqrt{1-e^2} \sin \theta}{1 + e \cos \theta}$