You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/examples/outer_solar_system.md
+20-11Lines changed: 20 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,13 @@
4
4
5
5
The chosen units are masses relative to the sun, meaning the sun has mass $1$. We have taken $m_0 = 1.00000597682$ to take account of the inner planets. Distances are in astronomical units, times in earth days, and the gravitational constant is thus $G = 2.95912208286 \cdot 10^{-4}$.
6
6
7
-
| planet | mass | initial position | initial velocity|
where each ``p_i`` and ``q_i`` is a 3-dimensional vector describing the planet's position and momentum, respectively.
46
50
47
51
Here, we want to solve for the motion of the five outer planets relative to the sun, namely, Jupiter, Saturn, Uranus, Neptune, and Pluto.
48
52
@@ -61,11 +65,15 @@ potential = -G *
61
65
62
66
`NBodyProblem` constructs a second order ODE problem under the hood. We know that a Hamiltonian system has the form of
63
67
64
-
$$\dot{p} = -H_{q}(p,q)\quad \dot{q}=H_{p}(p,q)$$
68
+
```math
69
+
\dot{p} = -H_{q}(p,q), \quad \dot{q} = H_{p}(p,q)
70
+
```
65
71
66
-
For an N-body system, we can symplify this as:
72
+
For an N-body system, we can simplify this as:
67
73
68
-
$$\dot{p} = -\nabla{V}(q)\quad \dot{q}=M^{-1}p.$$
74
+
```math
75
+
\dot{p} = -\nabla V(q), \quad \dot{q} = M^{-1} p.
76
+
```
69
77
70
78
Thus, $\dot{q}$ is defined by the masses. We only need to define $\dot{p}$, and this is done internally by taking the gradient of $V$. Therefore, we only need to pass the potential function and the rest is taken care of.
71
79
@@ -84,3 +92,4 @@ for i in 1:N
84
92
end
85
93
Plots.plot!(plt; xlab = "x", ylab = "y", zlab = "z", title = "Outer solar system")
0 commit comments