What is a n-body system ?#
A n-body system is a set of \(n\) classical non-relativistic point masses undergoing binary interactions. These interactions are modelled by forces following the direction of the straight line joining the bodies positions, and whose magnitude only depends on the inter-body distance.
In choreo
, n-body systems are represented by the class choreo.NBodySyst
.
Note
Dimensionality of the system (geodim)
The following sections detail three different formulations of the evolution equations of n-body systems. While all three descriptions are equivalent in the sense that they predict the same evolution for the system, each description shines when exploring a particular aspect of the dynamics the n-body system.
The Newtonian point of view#
The mass of a body \(i = 0 \dots n-1\) is denoted \(m_i > 0\), its position \(x_i\), and the resultant of all forces applied \(f_i\). The Newtonian formulation of the equations of motion of a n-body system states that the mass times the acceleration of a body equals the forces applied to this body:
This equation alone specifies the evolution of the unknown variables, i.e. the positions \(\mathbf{q}(t) \eqdef (x_0(t), \dots, x_{n-1}(t))\) as soon as the forces can be written as a function of the positions.
Note
Although the usage of the letter \(\mathbf{q}\) here might seem confusing, it follows standard notation in the study of Hamiltonian and Lagrangian systems. It should not be mistaken for the charges that we denote \(q\) in this documentation.
The force \(f_i\) in the above equation is the resultant of binary interactions with all the other bodies in the system. In other terms, it is the sum of all the forces that all other bodies \(j \neq i\) apply to body \(i\). Moreover, the force that body \(i\) applies on body \(j\) is the opposite of the force that body \(j\) applies on body \(i\). This force points in the direction of the other body, and its magnitude is a function of the inter-body distance \(\|x_j = x_i\|\). These restrictions constraint the forces in the system to be conservative:
For both performance reasons and ease of input, choreo
additionally constraints the inter-body potential \(V_{i,j}\) to be proportional to a universal user-specified potential denoted \(V_{\mathrm{u}}\), with body-specific proportionality constants \(q_i\) and \(q_j\) called charges:
This convention is compatible with both the classical Newtonian gravitational potential (with \(m_i = q_i\)) and the electrostatic potential (in which case the body charges are the electric charges) if the potential is proportional to the inverse of the distance:
The classical Newtonian gravitational potential is the default in choreo
. This default behavior can be changed using choreo.NBodySyst.Set_inter_law()
.
Warning
TODO Independence wrt the proportionality constant for homogeneous potentials.
While equation (1) as it is could be directly plugged in a general purpose ODE solver to get an approximate solution, the next two sections highlight how variations on the problem formulation can be exploited for more performance, and to better deal with periodicity constraints.
The Hamiltonian point of view#
While Newton’s law of motion (1) completely determines the evolution of a n-body system, their Hamiltonian reformulation reveal hidden mathematical structure that can be exploited to find more precise approximate solutions at a lower computational cost.
The unknown independent variables in the Hamiltonian formulations are both the positions \(\mathbf{q}(t) = (x_0(t), \dots, x_{n-1}(t))\), and the momenta \(\mathbf{p}(t) \eqdef (p_0(t), \dots, p_{n-1}(t))\). Given a scalar function of the momenta and positions denoted \(H(\mathbf{q}, \mathbf{p})\) and called the Hamiltonian of the system, the equations of motion for the evolution of the inpendant variables read:
The Newton equations of motion (1) are retrieved for the following choice of Hamiltonian:
This particular Hamiltonian is called partionned since it decomposes into the sum of a kinetic energy \(T(\mathbf{p})\) that is a function of the momenta only, and a potential energy \(V(\mathbf{q})\) that is a function of the positions only. This partitioned structure is exploited in the ODE RK methods ref ???
Note
TODO : Lagrangian least action principle vs Hamiltonian least action principle. Stability ?