Next: , Previous: , Up: Internal Routines   [Contents][Index]

#### 15.5.341 kepler

```out = kepler(in, e [, /meananomaly, /perifocalanomaly] [, /trueanomaly, /eccentricanomaly, /reducedeccentricanomaly, /tau, /itercount]```

Solves Kepler’s equation (`M = E - e sin(E)`) for the motion of a planet (or other object) around the Sun (or another central object) when subject to only their mutual force of gravity. See https://www.aa.quae.nl/en/reken/kepler.html for the algorithm.

`e` is the eccentricity of the orbit (`e` in the equation), which may have any value. Negative values are treated as the corresponding positive values.

`in` is the input quantity, of which the meaning depends on the mode switches from the following list. If none of these switches are specified, then `/meananomaly` is implied. The quantity may have any value.

`/meananomaly`

The input quantity is the mean anomaly (`M` in the equation). The mean anomaly is the angle between a fictional planet and the perifocus as seen from the Sun, if that fictional planet had the same period as the true planet but followed a circular orbit at fixed speed. The mean anomaly is zero when the planet is in the perifocus (closest to the Sun). The mean anomaly increases with time at a fixed rate.

`/perifocalanomaly`

The input quantity is the perifocal anomaly, which is like the mean anomaly except that its rate of increase is based on the perifocus distance instead of the semimajor axis. For near-parabolic orbits (eccentricity near 1), the perifocal anomaly depends much less strongly on the eccentricity than the mean anomaly does.

The perifocal anomaly `M_q` and the mean anomaly `M` are linked through `M = M_q*(abs(e - 1))^1.5`.

The meaning of the returned value depends on the mode switches from the following list. If none of the switches are specified, then `/trueanomaly` is implied.

`/eccentricanomaly`

The return value is the eccentric anomaly (`E` in the equation).

`/trueanomaly`

The return value is the true anomaly. The true anomaly is the angle between the planet and the perifocus as seen from the Sun. The true anomaly `Î½` is calculated from the eccentric anomaly through `Î½ = 2*atan(sqrt((e + 1)/(e - 1))*tan(E/2))`.

`/reducedeccentricanomaly`

The return value is the reduced eccentric anomaly. The reduced eccentric anomaly `E_q` and regular eccentric anomaly `E` are related through `E = E_q*sqrt(abs(e - 1))`.

`/tau`

The return value is the tangent of half of the true anomaly, `tan(Î½/2)`. The cartesian coordinates can be calculated from this directly, without going through the true anomaly.

`/itercount`

The return value is the count of iterations that were needed to find the solution.

Next: , Previous: , Up: Internal Routines   [Contents][Index]