Skip to content

Commit e77e0ba

Browse files
authored
Fix Hamiltonian form in Kepler problem example
The Hamiltonian at any point should not depend on the generalized velocity, but instead the momentum. For this problem it doesn't make as much difference, but users can get confused about the equations of motion if the Hamiltonian already includes the generalized velocities.
1 parent 72118ca commit e77e0ba

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

docs/src/examples/kepler_problem.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
# The Kepler Problem
22

3-
The Hamiltonian $\mathcal {H}$ and the angular momentum $L$ for the Kepler problem are
3+
The (non-dimensional) Hamiltonian $\mathcal {H}$ and the angular momentum $L$ for the Kepler problem are
44

5-
$$\mathcal {H} = \frac{1}{2}(\dot{q}^2_1+\dot{q}^2_2)-\frac{1}{\sqrt{q^2_1+q^2_2}},\quad
6-
L = q_1\dot{q_2} - \dot{q_1}q_2$$
5+
```math
6+
\begin{align*}
7+
\mathcal{H}(q_1, p_1, q_2, p_2) &= \frac{1}{2}(p^2_1+p^2_2)-\frac{1}{\sqrt{q^2_1+q^2_2}}, \\
8+
L &= q_1 p_2 - p_1 q_2
9+
\end{align*}
10+
```
711

812
Also, we know that
913

10-
$${\displaystyle {\frac {\mathrm {d} {\boldsymbol {p}}}{\mathrm {d} t}}=-{\frac {\partial {\mathcal {H}}}{\partial {\boldsymbol {q}}}}\quad ,\quad {\frac {\mathrm {d} {\boldsymbol {q}}}{\mathrm {d} t}}=+{\frac {\partial {\mathcal {H}}}{\partial {\boldsymbol {p}}}}}$$
14+
```math
15+
\begin{align*}
16+
\frac{\mathrm{d} \boldsymbol{p}}{\mathrm{d} t} &= - \frac {\partial \mathcal{H}}{\partial \boldsymbol{q}} , \\
17+
\frac{\mathrm{d} \boldsymbol{q}}{\mathrm{d} t} &= + \frac {\partial \mathcal{H}}{\partial \boldsymbol{p}}
18+
\end{align*}
19+
```
1120

1221
```@example kepler
1322
import OrdinaryDiffEq as ODE, LinearAlgebra, ForwardDiff, NonlinearSolve as NLS, Plots

0 commit comments

Comments
 (0)