> For the complete documentation index, see [llms.txt](https://space-axolotls.gitbook.io/space-axolotls-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://space-axolotls.gitbook.io/space-axolotls-docs/math/trajectory-and-orbital-calculation.md).

# Trajectory and Orbital Calculation

### Orbital Mechanics Formulas

The following formulas are the basis for calculating the position and trajectory of a celestial body under the gravitational influence of a central body like the Sun.

#### Equation of an Ellipse in Polar Coordinates

Describes the shape of the orbit, where $$r$$ is the distance to the Sun, $$a$$ is the semi-major axis, $$e$$ is the eccentricity, and $$ν$$ is the true anomaly.

<figure><img src="/files/CZMvCeyvY3Uys6s10Lve" alt=""><figcaption></figcaption></figure>

#### Mean Anomaly Calculation

Calculates the averaged angular position ($$M$$) as a function of time, starting from an initial mean anomaly ($$M0​$$) at a given epoch, the mean motion ($$n$$), and the elapsed time ($$Δt$$).

<figure><img src="/files/qCMMKeJMpZow9j5oy3Vz" alt=""><figcaption></figcaption></figure>

#### Kepler's Equation

Relates the mean anomaly ($$M$$) to the eccentric anomaly ($$E$$). This equation is transcendental and is solved numerically.

<figure><img src="/files/fWyScqIaQnayQnUYHtP7" alt=""><figcaption></figcaption></figure>

#### Relation between Eccentric and True Anomaly

Converts the auxiliary geometric angle ($$E$$) to the actual physical angle in the orbit ($$ν$$). An alternative and more numerically stable form is used in the code.

<figure><img src="/files/h3kWpw5082RpNjrj0DMM" alt=""><figcaption></figcaption></figure>

#### Radial Distance Calculation

Calculates the distance to the Sun at a specific instant using the eccentric anomaly ($$E$$).

<figure><img src="/files/4RPPBwOTcLQqPl8Y4wZF" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://space-axolotls.gitbook.io/space-axolotls-docs/math/trajectory-and-orbital-calculation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
