# How to calculate the velocity vector in the case of a hyperbolic orbit?

## The problem

I'm trying to get a formula to calculate the state vectors $$\vec{r}$$ and $$\vec{v} = \dot{\vec{r}}$$ on an orbit, given a true anomaly $$\nu$$. I'm following the process described here : https://downloads.rene-schwarz.com/download/M001-Keplerian_Orbit_Elements_to_Cartesian_State_Vectors.pdf . The first calculation step involves calculating the intermediate simple state vectors $$\vec{o}$$ and $$\dot{\vec{o}}$$ laying in the xy plane (which are then rotated in space to get $$\vec{r}$$ and $$\vec{v}$$ respectively) :

$$\vec{o} = r\left(\begin{array}{ c } \cos \nu\\ \sin \nu \\ 0 \end{array}\right), \ \ \dot{\vec{o}} = \frac{\sqrt{\mu a}}{r}\left(\begin{array}{ c } -\sin E\\ \sqrt{1-e^{2}}\cos E\\ 0 \end{array}\right)$$

with $$r = \dfrac{p}{1+e\cos\nu}$$.

This works well in the case of an elliptic orbit, but it is invalid for a hyperbolic one because of $$e > 1$$ and $$a < 0$$ resulting in $$\sqrt{1-e^2}$$ and $$\sqrt{\mu a}$$ being undefined.

## My current solution

In the case of an hyperbolic orbit, I adapted the second answer from this post : Calculating velocity state vector with orbital elements in 2D to calculate $$\dot{\vec{o}}$$ with the flight path angle $$\phi$$, knowing the angular momentum $$h = ||\vec{h}||$$. We first calculate the radial unit vector $$\hat{u_o}$$ of the intermediate position vector, and $$\hat{u_s}$$ the unit vector perpendicular to $$\hat{u_o}$$ in the xy plane :

$$\hat{u_o} = \frac{\vec{o}}{r} = \left(\begin{array}{ c } u_{o,\ x}\\ u_{o,\ y}\\ 0 \end{array}\right) , \ \ \hat{u_s} = \left(\begin{array}{ c } -u_{o,\ y}\\ u_{o,\ x}\\ 0 \end{array}\right)$$

We then calculate the sin and cos of the flight path angle : $$\cos \phi = \frac{h}{rv}, \ \ \sin \phi = \frac{e \sin \nu}{1 + e \cos \nu} \cos \phi$$

with $$v$$ being the magnitude of the velocity, calculated from the vis-viva equation. And finally, we get the intermediate velocity vector :

$$\dot{\vec{o}} = v(\sin(\phi)\hat{u_o} + \cos(\phi)\hat{u_s})$$

## A better solution ?

Is there a better, more straightforward way, to compute this intermediate velocity vector in the case of a hyperbolic orbit ? One that doesn't require knowing $$h$$. For example, is there a formula similar to the one given in the PDF that makes use of the hyperbolic eccentric anomaly $$H$$ ?

# Solution for hyperbolic velocity

After some mathematical manipulations I ended up finding an actual solution that makes use of the hyperbolic anomaly $$H$$.

In the following, $$e$$ is the eccentricity of the orbit, $$\nu$$ is the true anomaly and $$a$$ is the semi major axis.

## Prerequisite : proving that $$iH = E$$ in a hyperbolic orbit

This little proof is here just to show how one can retrieve the equality from the well known formulas of eccentric anomalies.

• For an elliptical orbit ($$e < 1$$), the eccentric anomaly $$E$$ is defined by: $$\tag{1} \tan\frac{E}{2} =\sqrt{\frac{1-e}{1+e}}\tan\frac{\nu }{2}$$

• For a hyperbolic orbit ($$e > 1$$), the hyperbolic anomaly $$H$$ (also written $$F$$) is defined by: $$\tag{2} \tanh\frac{H}{2} =\sqrt{\frac{e-1}{e+1}}\tan\frac{\nu }{2}$$

In the case of a hyperbolic orbit, $$1-e < 0$$ leads to an undefined definition of $$E$$ in (1) because of the square root term. Thus the need to use its hyperbolic equivalent (2). However, considering the relation (1) in $$\mathbb{C}$$ by involving $$i = \sqrt{-1}$$ allows for a complex definition of $$E$$ :

$$\tan\frac{E}{2} = i\sqrt{\frac{e-1}{e+1}}\tan\frac{\nu }{2}$$

in which we notice the right term of (2). This actually directly links $$E \in \mathbb{C}$$ and $$H \in \mathbb{R}$$ by:

$$\tag{3} \tan\frac{E}{2} = i\tanh\frac{H}{2}$$

The relations between hyperbolic and trigonometric functions give : $$\forall x \in \mathbb{R} \ \ \ i\tanh(x) = \tan(ix)$$

which when applied to (3) leads to:

$$\tan\frac{E}{2} = \tan\frac{iH}{2}$$

And since $$x \mapsto \tan(ix)$$ is bijective $$\forall x \in \mathbb{R}$$ because it is proportional to $$x \mapsto \tanh(x)$$, we deduce that :

$$\tag{4} iH = E$$

in the case of a hyperbolic orbit, with $$H \in \mathbb{R}$$ (and therefore $$E \in i\mathbb{R}$$).

## Adapting the intermediate velocity vector formula to hyperbolic orbits

The equation described by René Schwarz to calculate the intermediate velocity vector (ignoring the z-component with value 0) is:

$$\tag{5} \dot{\vec{o}} =\frac{\sqrt{\mu a}}{r}\left(\begin{array}{ c } -\sin E\\ \sqrt{1-e^{2}}\cos E \end{array}\right)$$

We suppose now a hyperbolic orbit, therefore $$e > 1$$ and $$a < 0$$. Thus (5) cannot be used directly because $$\sqrt{1-e^2}$$ and $$\sqrt{\mu a}$$ are undefined in $$\mathbb{R}$$. By using the fact that $$a = -|a|$$ and $$1 - e^2 = -(e^2 - 1)$$, considering the equation in $$\mathbb{C}$$ gives:

$$\begin{array}{ c c l } ( 5) \ \ \Leftrightarrow \ \ \dot{\vec{o}} & = & \dfrac{\sqrt{-\mu |a|}}{r}\left(\begin{array}{ c } -\sin E\\ \sqrt{-\left( e^{2} -1\right)}\cos E \end{array}\right)\\ & = & i\dfrac{\sqrt{\mu |a|}}{r}\left(\begin{array}{ c } -\sin E\\ i\sqrt{e^{2} -1}\cos E \end{array}\right)\\ & = & \dfrac{\sqrt{\mu |a|}}{r}\left(\begin{array}{ c } -i\sin E\\ -\sqrt{e^{2} -1}\cos E \end{array}\right)\\ & = & \dfrac{\sqrt{\mu |a|}}{r}\left(\begin{array}{ c } -\sinh iE\\ -\sqrt{e^{2} -1}\cosh iE \end{array}\right) \end{array}$$

because $$\forall x \in \mathbb{R} \ \ i\sin x = \sinh ix$$ and $$\cos x = \cosh ix$$.
Finally, involving $$iH = E \Leftrightarrow iE = -H$$, and the fact that $$\cosh$$ is even and $$\sinh$$ is odd, we get:

$$\tag{6} \dot{\vec{o}} =\frac{\sqrt{-\mu a}}{r}\left(\begin{array}{ c } \sinh H\\ -\sqrt{e^{2} -1}\cosh H \end{array}\right)$$

with $$|a|$$ written as $$-a$$ for clarity.

This formula seems to work in practical cases (orbit simulation and determination). Please don't hesitate to comment to correct eventual errors.