# Simulate celestial body motion on hyperbolic trajectory (2D)

So, what do I need, is to have an ability to calculate body position and velocity at given time. At first I have body position and velocity What do I can calculate:

Angular momentum $$\textbf{h} = \textbf{r}\times\textbf{v}$$ Eccentricity: $$\textbf{e} = \frac{\textbf{v}\times\textbf{h}}\mu - \frac{\textbf{r}}{r}$$ Also I have found that I can calculate position: $$x=a\left(e-\cosh\tau\right)$$ $$y=a\sqrt{e^2-1}\sinh\tau$$ And also there some relation between eccentricity anomaly and time: $$t=\sqrt{a^3\over\mu}\left(e\sinh\tau-\tau\right)$$ But I don't understand, how to calculate that eccentricity anomaly? How to calculate velocity? Is there something like mean anomaly and "mean velocity" (like in ecliptic trajectories)? And is there some formula to calculate it?

# Solution

Okay, guys, thank you all, finally I got it. So what conclusion I came to:

If we have some body with velocity and position relative to the body around which first one is going to rotate and time, then we should:

Define orbit

Angular momentum: $$\bar{h} = \bar{r}\times \bar{v}$$ Eccentricity vector: $$\bar{e} = \frac{\bar{v}\times \bar{h}}\mu - \frac{\bar{r}}{r}$$ Perigee inclination angle: $$i=\textrm{atan2}(-\bar{e}_y,-\bar{e}_x)$$ Semi major axis: $$a=(\frac{2}{r}-\frac{v^2}{\mu})^{-1}$$ If we will rotate position vector by -i, then we will have raw position vector(which not affected by trajectory inclination), this is just inverted 2D vector rotation formula: $$\bar{p}=\binom{\bar{r}_x\textrm{cos}i+\bar{r}_y\textrm{sin}i}{\bar{r}_y\textrm{cos}i-\bar{r}_x\textrm{sin}i}$$ Then by having raw position and by calculating sinh and cosh we can find creation hyperbolic anomaly: $$H_0=\textrm{atanh}(\frac{\frac{\bar{p}_y}{a\sqrt{e^2-1}}}{e-\frac{\bar{p}_x}{a}})$$ And then simply find creation mean anomaly: $$M_0=\textrm{sinh}(H_0)e-H_0$$ Also there is a need of mean velocity: $$n=\sqrt{\frac{\mu}{|a^3|}}\textrm{sign}(h)$$ And for future we need some creation time, which should be gotten from simulation time, when orbit is created: $$t_0 = T\textrm{, where T is currect simulation time.}$$

Any time get orbit status by time

Calculate current mean anomaly: $$M=M_0 + (T-t_0)n$$ Find current hyperbolic anomaly via newton's method: $$H_{j+1}=H_j+\frac{M-e\textrm{sinh}(H_j)+H_j}{e\textrm{cosh}(H_j)-1}$$ And get current raw position vector: $$\bar{p}=\binom{a(e-\textrm{cosh}H)}{a\sqrt{e^2-1}\textrm{sinh}H}$$ And finally to get body relative position at time T we should rotate raw position vector by inclination angle: $$\bar{r}=\binom{\bar{p}_x\textrm{cos}i-\bar{p}_y\textrm{sin}i}{\bar{p}_x\textrm{sin}i+\bar{p}_y\textrm{cos}i}$$ Have fun!

• If you know a, r and $\mu$, you can use the vis viva equation for speed. $v=\sqrt{\mu * (2/r - 1/a)}$ . As for average velocity, that would approach $V_{infinity}$ as you take more of the trajectory into account. – HopDavid Jun 17 '17 at 17:31
• @HopDavid I'm not sure the OP is asking for average velocity. I've never known what is so mean about mean anomaly, but I think that's the intended usage of mean in the hypothetical term "mean velocity". I'll edit the question and add quotes. – uhoh Jun 18 '17 at 2:46
• @HopDavid thinking further, if the mean anomaly is an angle whose rate of increase is constant, then would the "mean velocity" just be $n$, the mean angular motion? – uhoh Jun 18 '17 at 2:53

$\tau$ is your independent variable that runs from some negative value to some positive positive value around the closest approach. Then you can plot the trajectory on an $x$-$y$ plot, and if you like mark times on it using the $t$ formula. $\tau$ and $t$ are both zero at closest approach.
You can find the $\tau$ values corresponding to particular times by solving the $t$ equation using numerical root finding.
Formulas for $v_x$ and $v_y$ are easily derived by taking the derivatives of the $x$ and $y$ formulas with respect to $\tau$, and dividing those by the derivative of the $t$ formula with respect to $\tau$.
• Can you please solve formulas for $v_x$ and $v_y$? Seems like I'm doing it wrong... – Victor F Jul 13 '17 at 11:59
• I have tried what did you say, take derivative from position and divide it by derivative from time. $\dot{t}=\dfrac{\mathrm{e}\cosh\left(H\right)-1}{n}$; $\dot{x}=-a\sinh\left(H\right)$; $\dot{y}=\sqrt{\mathrm{e}^2-1}a\cosh\left(x\right)$; $\bar{v}=\binom{\dot{x}/\dot{t}}{\dot{y}/\dot{t}}$; and then rotate by inclanation. Oh wait... It's working, there just was mistake in implementation, thanks a lot! – Victor F Jul 14 '17 at 6:31