The following article is Open access

celmech: A Python Package for Celestial Mechanics

and

Published 2022 October 7 © 2022. The Author(s). Published by the American Astronomical Society.
, , Citation Sam Hadden and Daniel Tamayo 2022 AJ 164 179 DOI 10.3847/1538-3881/ac8d01

Download Article PDF
DownloadArticle ePub

You need an eReader or compatible software to experience the benefits of the ePub3 file format.

1538-3881/164/5/179

Abstract

We present celmech, an open-source Python package designed to facilitate a wide variety of celestial mechanics calculations. The package allows users to formulate and integrate equations of motion incorporating user-specified terms from the classical disturbing function expansion of the interaction potential between pairs of planets. The code can be applied, for example, to isolate the contribution of particular resonances to a system's dynamical evolution and develop simple analytical models with the minimum number of terms required to capture a particular dynamical phenomenon. Equations and expressions can be easily manipulated by leveraging the extensive symbolic mathematics capabilities of the sympy Python package. The celmech package is designed to interface seamlessly with the popular N-body code REBOUND to facilitate comparisons between calculation results and direct N-body integrations. The code is extensively documented, and numerous example Jupyter notebooks illustrating its use are available online.

Export citation and abstract BibTeX RIS

Original content from this work may be used under the terms of the Creative Commons Attribution 4.0 licence. Any further distribution of this work must maintain attribution to the author(s) and the title of the work, journal citation and DOI.

1. Introduction

Celestial mechanics is the oldest branch of physics, and increasingly sophisticated analytical techniques for predicting planetary motions have been developed over the course of the subject's long history. While precise orbital solutions are now typically found through direct numerical integrations of the equations of motion, analytic methods remain central to solving open problems in dynamics. We are often more interested in developing theoretical insight into the qualitative elements (e.g., mean-motion resonances, hereafter MMRs, and secular evolution) responsible for dynamical phenomena such as chaos, transit timing variations (TTVs), extreme orbital eccentricities, etc. This is especially true when studying exoplanetary systems, where precise mass and orbital determinations are often unavailable, and analytical intuition can guide the construction and interpretation of suites of N-body integrations across a relevant subset of the vast parameter space.

The fact that planetary masses are much smaller than the central stellar mass, and that orbital eccentricities and inclinations are typically small, often makes it possible to model planetary dynamics using only a small number of slowly varying terms in the disturbing function expansion of the gravitational interaction potential between planet pairs (a Fourier series in the angular orbital elements and a power series in eccentricities and inclinations). For example, numerous authors have derived analytic models for MMRs in this manner (e.g., Mustill & Wyatt 2011; Batygin & Morbidelli 2013; Batygin 2015; Delisle et al. 2015; Delisle 2017; Hadden 2019; Hadden & Payne 2020). These simplified models can be used to study the process of resonance capture and constrain migration histories of resonant exoplanetary systems since they predict how the resonance capture probabilities and equilibrium configurations reached by systems of migrating planets depend on migration timescales, which are otherwise poorly constrained. Using similar disturbing function expansions to estimate the locations and widths of multiple MMRs, various authors have applied the resonance overlap criterion (e.g., Chirikov 1979) to derive analytic criteria for the onset of chaos in multiplanet systems (e.g., Wisdom 1980; Quillen 2011; Deck et al. 2013; Hadden & Lithwick 2018; Petit et al. 2020; Tamayo et al. 2021; Rath et al. 2022). The classic Laplace–Lagrange solution for the evolution of planets' eccentricities and inclinations is derived by taking the lowest-order secular terms appearing in the disturbing function (e.g., Murray & Dermott 1999). This approximate solution has found myriad applications in the study of exoplanets, from assessing the influence of unseen companions on multitransiting orbital configurations (e.g., Becker & Adams 2017; Read et al. 2017) to analyzing the interplay between orbital precession and the evolution of planetary obliquities in multiplanet systems (e.g., Millholland & Laughlin 2019; Saillenfest et al. 2019; Su & Lai 2022). Disturbing function methods have also be applied to the dynamical modeling of exoplanet transit timing observations, where they can significantly reduce computational costs relative to a purely N-body approach while also elucidating important degeneracies that may not otherwise be evident (e.g., Nesvorný & Morbidelli 2008; Lithwick et al. 2012; Agol & Deck 2016; Deck & Agol 2016; Hadden & Lithwick 2016).

The nonexhaustive list of applications given above serves to highlight the importance of an analytic, perturbative approach to studying planetary dynamics. Nevertheless, this long-standing approach can be tedious when formulating even relatively simple models as it entails identifying the appropriate disturbing function terms, finding the expressions for their coefficients, and then evaluating them by means of a variety of special functions. Examining any of the various high-order disturbing function expansions published during the nineteenth century (e.g., Peirce 1849; Le Verrier 1855; Boquet 1889), one quickly appreciates that formulating any sophisticated, high-order analytic theories by hand represents a monumental undertaking.

Since the sixties, such detailed work has been performed using specialized codes dedicated to computing and manipulating disturbing function expansions (see references in Henrard 1989; Brumberg 1995). The state-of-the-art TRIP code (Gastineau & Laskar 2011, 2021), a dedicated computer algebra system for celestial mechanics, has proven especially valuable for studying the solar system's long-term dynamics (Hoang et al. 2021, 2022; Mogavero & Laskar 2022). However, such analyses have largely been limited to the specialized groups with the expertize to develop these highly technical routines. 4

By contrast, the last decade has clearly demonstrated the impact open-source scientific software can have on the field (Tollerud et al. 2019), both by opening up specialized calculations to a wide base of users, and by providing application programming interfaces (APIs) that enable the interconnection of separate codes in a broad range of new and creative ways. In particular, successful cases in the exoplanet field include, e.g., ttvfast (Deck et al. 2014), EXOFAST (Eastman et al. 2013), batman (Kreidberg 2015), radvel (Fulton et al. 2018), REBOUND (Rein & Liu 2012), REBOUNDx (Tamayo et al. 2020), exostriker (Trifonov 2019), NbodyGradient (Agol et al. 2021), and exoplanet (Foreman-Mackey et al. 2021).

Ellis & Murray (2000) provided an important early step toward making computer-assisted disturbing function expansions more accessible to the wider research community. They derived a method for calculating coefficients associated with specific Fourier terms in the disturbing function. This offers an efficient alternative to computing complete high-order disturbing function expansions by the means of dedicated computer algebra. Mathematica notebooks implementing their algorithm were made available as part of the online material accompanying the popular textbook Murray & Dermott (1999).

In this paper, we present celmech (Hadden & Tamayo 2022), an open-source Python package, which facilitates the manipulation of disturbing function expansions to any order in the eccentricities and inclinations, and enables a broad range of analytical investigations. celmech is built upon on the disturbing function expansion algorithm derived by Ellis & Murray (2000), although with important modifications described in Section 4 that allow the equations of motion to be formulated in a powerful Hamiltonian framework instead of in orbital elements. We have designed the code's API to easily interface with the REBOUND package, streamlining comparisons between semianalytic celmech models and direct N-body integrations. Additionally, celmech includes functionality for performing canonical transformations, which are useful for both extracting conserved quantities and reducing the dimensionality of various problems (Section 5.3). We also plan to incorporate additional modules in upcoming releases.

The plan of the paper is as follows: We present a simple example application in Section 2 with the goal of introducing readers to the code and illustrating a typical workflow before proceeding through more in-depth discussions of technical details in subsequent sections. Section 3 reviews the coordinate system and Hamiltonian framework that celmech uses to formulate the equations of motion. Section 4 describes celmech's capabilities for performing disturbing function expansions in terms of both classical Keplerian orbital elements (Section 4.1), as well as canonical variables (Section 4.2). Section 5 introduces celmech's object-oriented approach to modeling Hamiltonian systems in general (Section 5.1) as well as those specific to planetary systems (Section 5.2). It also describes celmech's ability to manipulate Hamiltonian models via the application canonical transformations (Section 5.3), including Lie series transformations, a class of transformations that arise in Hamiltonian perturbation theory (Section 5.4). To aid the reader, we provide a list with the main mathematical symbols appearing in the paper along with their definitions in Appendix A.

2. A Simple Example

We begin with a practical example to highlight some of the central machinery in celmech, demonstrate the code's API, and illustrate a possible workflow. We consider a system of three Earth-mass planets around a solar-mass star. The inner two are initialized at the 3:2 MMR with orbital periods of 1 and 1.5 yr respectively, while the third planet's orbital period is 3.2 yr and does not form any simple integer ratios with the inner two. The outermost orbit begins with zero eccentricity and inclination to the reference plane. The innermost orbit has both its eccentricity and inclination (in radians) set to 0.02, while the middle orbit has these quantities both set to 0.03. The longitudes of ascending node, and the pericenters of the inner two orbits lie along the positive x-axis, and both planets start at conjunction at their respective apocenters where their orbits are spaced farthest apart (Figure 1). The accompanying Jupyter notebook shows how celmech conveniently interfaces with the REBOUND N-body package, which provides extensive functionality for initializing orbital configurations that can then be converted to a celmech PoincareHamiltonian object. In the present example, we begin by creating a rebound.Simulation object comprised of a star and three planets in the orbital configuration described above, which we name sim. This Simulation instance is then used to initialize a new PoincareHamiltonian object, which we name Hp, as follows:

  • poincare_variables=Poincare.from_Simulation(sim)
  • Hp=PoincareHamiltonian(poincare_variables).

The poincare_variables object is an instance of the Poincare class, which is used to store the masses and orbital configurations of particles in an N-body system. In this example, the poincare_variables instance inherits the masses and orbital configurations of the particles stored by the rebound.Simulation instance sim. The poincare_variables object is then used to create the PoincareHamiltonian object Hp. The PoincareHamiltonian class, detailed below in Section 5.2, will be used throughout the present example to build and manipulate a Hamiltonian model for the system's dynamics.

Figure 1.

Figure 1. Left panel: initial orbital configuration in the reference xy plane (inclinations to this plane are small ≲ 2°). Right panel: comparison of the evolution of the middle planet's orbital eccentricity between a celmech model including the leading-order 3:2 MMR terms in the disturbing function between the inner two planets (orange, Equation (1)) to an N-body integration (blue).

Standard image High-resolution image

2.1. First-order Approximation

The PoincareHamiltonian class has several functions for adding specific terms from the disturbing function between pairs of planets in a system that can be used build up a dynamical model. We expect that the 3:2 MMR between the inner two planets will be important, so we call the following method of our PoincareHamiltonian object, Hp:

  • Hp.add_MMR_terms(p=3, q=1, indexIn=1, indexOut=2).

This adds the lowest-order disturbing function terms in eccentricities and inclinations that are associated with a 3:2 MMR between planets 1 and 2 (the star has index 0) to the Hamiltonian represented by the PoincareHamiltonian object Hp. More generally, the arguments p and q are used to specify terms associated with any p:pq resonance, and the arguments indexIn and indexOut specify the pair of planets for which terms should be added.

We can check the terms added to the disturbing function terms by inspecting the Hp.df attribute, which prints them with their associated normalization in units of energy (this disambiguation is useful in systems with more than one pair of planets):

Equation (1)

with the gravitational constant G, masses mi , reference semimajor axes ai,0 (assumed constant), and αi,j = ai,0/aj,0. At first order in eccentricities (ei ) and inclinations (Ii ), there are only two disturbing function terms associated with the 3:2 MMR with the resonant angles 3λ2 − 2λ1ϖ1 and 3λ2 − 2λ1ϖ2, where the λi are the mean longitudes, and ϖi are the longitudes of pericenter. These terms would typically be found by hand, e.g., in the Appendix of Murray & Dermott (1999). In the notation 5 of Murray & Dermott (1999), the expression would read

Equation (2)

Our $\tilde{C}$ coefficients correspond to the f coefficients of Murray & Dermott (1999), where we choose to include some additional granularity in our $\tilde{C}$ indices for specifying higher-order terms. The index convention is explained in the following subsection (Section 2.2).

The PoincareHamiltonian object also allows us to integrate the equations of motion using only the terms one has added to the disturbing function. We show the evolution for the middle planet's orbital eccentricity in Figure 1, comparing an N-body integration using REBOUND to our simple celmech model incorporating only the leading-order resonant terms between the inner two planets.

We see that the oscillation amplitude and frequency is reproduced to within ≈10%, although this causes the two models to quickly lose phase coherence. For many applications, this level of agreement is sufficient, but we can improve the agreement by incorporating more terms at higher order in the eccentricities and inclinations.

2.2. Going to Second Order

Even going to just the next (second) order in the eccentricities and inclinations introduces a large number of additional terms. The disturbing function terms required to account for the 3:2 MMR interactions between the inner planet pair and the secular interactions between all planet pairs at second order in eccentricities and inclinations are given by

Equation (3)

where the inclinations are expressed through ${s}_{i}=\sin ({I}_{i}/2)$, and the Ωi are the longitudes of ascending node. We have gone from just 2 terms in Equation (1) to 26 terms in Equation (3). While the coefficients of such an expansion would be extremely tedious to look up by hand, these terms are easy to incorporate with celmech.

As can be verified in Equation (3), the $\tilde{C}$ subscript indices specify the coefficients of the cosine arguments

Equation (4)

where the "in" and "out" subscripts refer to the inner and outer body, respectively, and the ordering of the k coefficients has been chosen to match the ordering conventionally used in the cosine arguments (e.g., Murray & Dermott 1999). The amplitude of each cosine term is a power series in the eccentricities and inclinations. We choose to separate the terms in these expansions, and specify them by the $\tilde{C}$ superscript indices, as detailed in Section 4.2. Most terms in Equation (3) are the leading-order contributions with superscripts (0, 0, 0, 0), although we see examples of higher-order contributions in the secular terms without a cosine argument (all ki = 0 in Equation (4)).

The most important second-order terms for our setup are the second-order 3:2 MMR terms, i.e., the 6:4 cosine terms above, involving the combination 6λ2 − 4λ1. In celmech, we would incorporate MMR terms up to a specified maximum order by adding the max_order keyword to our call above:

  • Hp.add_MMR_terms(p=3, q=1, max_order=2, indexIn=1, indexOut=2).

The secular terms (terms above that do not depend on the mean longitudes λ, including those with no cosine factors) also make a small but noticeable impact. For each pair of planet indices (idx1, idx2), the secular terms can be added by

  • Hp.add_secular_terms(max_order=2, indexIn=idx1, indexOut=idx2).

Comparing Figure 1 with the left panel of Figure 2, we see that this second-order model (orange curve) does improve the agreement with N-body.

Figure 2.

Figure 2. Left panel: comparison of the evolution of the middle orbit's eccentricity in our example between N-body (blue) and increasingly sophisticated celmech models. The orange curve incorporates the most important terms to second order in the eccentricities and inclinations, while the green curve additionally incorporates a correction from osculating to mean variables (see text). Right panel: comparison of the evolution of the evolution of the middle orbit's inclination between N-body (blue) and a second-order (orange) and third-order (green) celmech model (both corrected to mean variables).

Standard image High-resolution image

2.3. Mean Variables

While it is tempting to simply continue adding higher-order terms, in this case it would not help. There is a separate issue causing a discrepancy with the N-body integrations, which can be fixed (at negligible computational cost) by converting from osculating to mean variables. Any time one takes only a subset of terms in the disturbing function, one is considering a (slightly) different problem from the full one. This distinction is particularly important, given our rather special initial conditions.

Each time an inner planet overtakes its outer neighbor at a conjunction, it gains orbital energy on approach as it is being pulled forward by its outer neighbor, only to lose that energy approximately symmetrically on the way out. These encounters cause short-period spikes in the orbits' semimajor axes, and the fact that we started our planets at a conjunction, means that we are starting at the peak of one of those spikes. In other words, our initial semimajor axes are, in a sense, spurious, and not reflective of the mean values they have over the vast majority of the orbit. This in turn impacts the period ratio between the inner two planets and their resonant dynamics.

Rather than incorporating even more terms in our disturbing function, the most elegant way of handling these (and other) ignored terms is through a near-identity canonical transformation from "osculating" to "mean" variables using the Lie series method (Morbidelli 2002; our Section 5.4). One can do this in celmech by creating a FirstOrderGeneratingFunction object, and specifying the terms one wants to average out. The terms in the disturbing function causing the semimajor axis spikes discussed above are of the form $\cos \left[k({\lambda }_{2}-{\lambda }_{1})\right]$, and can be analytically summed over (Malhotra 1993; our Section 5.4). These terms are independent of the eccentricities and inclinations, and thus of zeroth order, and can be added in celmech starting from a set of poincare_variables specifying the (osculating) initial conditions via

  • chi=FirstOrderGeneratingFunction(poincare_variables)
  • chi.add_zeroth_order_term().

The effects of unmodeled, nearby MMRs are much smaller for this problem than the zeroth-order terms above, but still make a noticeable difference, and are added by calls of the form

  • chi.add_MMR_terms(p=2,q=1,l_max=1, indexIn=1, indexOut=2)
  • chi.add_MMR_terms(p=4,q=1,l_max=1, indexIn=1, indexOut=2).

Once we have incorporated all the terms for which we want to correct, we transform to mean variables with chi.osculating_to_mean(), and the resulting integration (green curve in left panel of Figure 2) yields excellent agreement with N-body.

2.4. Going to Higher Order

In the right panel of Figure 2, we can see that, even at second order (orange), there is a significant discrepancy with N-body (blue) in the orbital inclination evolution of the middle planet. In order to approach the N-body evolution, we have to include terms up to third order in the eccentricities and inclinations. This is the order at which the terms directly coupling the inclinations to the quickly varying eccentricities first appear. These are easily obtained by setting max_order=3 in the calls above, although we spare the reader the details of the resulting 56 terms in the disturbing function. The add_secular_terms method accepts a similar max_order keyword argument, but the higher-order secular terms do not appear until fourth order in eccentricities and inclinations.

2.5. Limits

The degree of agreement between N-body and celmech models will depend on planet masses, with smaller masses generally giving better agreement. In particular, the conversion from osculating to mean variables is not perfect. The Lie series transformation (Section 5.4) corrects the unmodeled terms (e.g., conjunctions, nearby MMRs) to first order in the planetary masses. This generates second-order (and higher) mass terms that should be added to the equations of motion governing the evolution of the mean variables. For our low-mass planets, these corrections are negligible, but at higher mass ratios with the central star, these terms start to be significant (Sansottera & Libert 2019). Adding higher-order terms in the eccentricities and inclinations will help until one reaches the level at which these second-order mass terms become significant.

2.6. Applications

The consideration of only the leading-order terms is attractive for both analytical understanding and computational cost. As one incorporates more terms of progressively higher orders, celmech can become slower than direct N-body integrations. Nevertheless, there are several applications for high-order models. First, in many instances, it may be possible to deploy integration algorithms that are more efficient than celmech's default general-purpose integrator, and any such algorithms can potentially make use of the lower-level derivative and Jacobian information generated by the PoincareHamiltonian instance (i.e., Hp). This derivative and Jacobian information can also be valuable for locating equilibrium configurations such as periodic orbits via root-finding methods. High-order expansion can also be the starting point for developing accurate integrable approximations of the dynamics through canonical transformations (Hadden 2019). Finally, incremental comparisons of successively higher-order expansions with N-body integrations can also provide a quick guide to the degree of complexity required to model a particular dynamical phenomenon of interest.

3. Coordinate System

This section details the coordinate system and dynamical variables the celmech code uses for formulating Hamiltonian equations of motion. We begin by reviewing the Hamiltonian formulation of the planetary N-body problem, considering N − 1 planets of mass mi with i = 1,...,N − 1 orbiting a central star of mass ${M}_{\ast }$ . Let ${{\bf{u}}}_{\ast }$ and u i be the Cartesian position vectors of the star and the planets, respectively, in the inertial barycentric frame. We start by formulating the Hamiltonian in terms of canonical heliocentric coordinates, $({{\boldsymbol{r}}}_{i},{\tilde{{\boldsymbol{r}}}}_{i})$, where r i = u i u * is the ith planet's heliocentric position vector, and ${\tilde{{\boldsymbol{r}}}}_{i}={m}_{i}{\dot{{\boldsymbol{u}}}}_{i}$ is its canonically conjugate momentum (Laskar & Robutel 1995). In these coordinates, the Hamiltonian reads

Equation (5)

where

Equation (6)

Equation (7)

${\mu }_{i}=\tfrac{{m}_{i}{M}_{* }}{{M}_{* }+{m}_{i}}$, and Mi = M* + mi . 6

We will perform a canonical transformation from the canonical heliocentric coordinates $({{\boldsymbol{r}}}_{i},{\tilde{{\boldsymbol{r}}}}_{i})$ to the canonical modified Delaunay variables that constitute action-angle coordinates of the integrable two-body Hamilontians, HKep,i . In order to effect this transformation, we first define a set of canonical heliocentric Keplerian orbital elements, (ai , ei , Ii , λi , ϖi , Ωi ), which represent, respectively, the planetary orbit's semimajor axis, eccentricity, inclination, mean longitude, longitude of periapse, and longitude of ascending node. Standard orbital elements are computed from bodies' three-dimensional Cartesian positions and velocities as well as a "gravitational parameter" (e.g., Murray & Dermott 1999). For each planet, canonical heliocentric elements are computed from the Cartesian position vector r i , the velocity vector ${\tilde{{\boldsymbol{r}}}}_{i}/{\mu }_{i}$, and the gravitational parameter GMi . While ${\tilde{{\boldsymbol{r}}}}_{i}/{\mu }_{i}$ does not correspond to any physical velocity vector in the system, this definition of canonical heliocentric elements ensures that the modified Delaunay variables, defined below, form a canonical set of action-angle coordinates for the two-body Hamiltonian, HKep,i . The celmech module nbody_simulation_utilities provides the function reb_calculate_orbits to compute canonical heliocentric orbital elements from a REBOUND simulation and the function reb_add_from_elements to add particles to a REBOUND simulation by specifying these elements (Jupyter Notebook example).

The canonical modified Delaunay coordinates 7 are defined in terms of the canonical heliocentric orbital elements. The action variables are

Equation (8)

and they have units of angular momentum. The angle variables canonically conjugated to the action variables Λi , Γi , and Qi are λi , γi = − ϖi , and qi = − Ωi , respectively. In order to avoid coordinate system singularities that leave the canonical variables γi and qi undefined when ei = 0 and Ii = 0, celmech formulates equations of motion in terms canonical coordinate–momentum pairs

Equation (9)

rather than (Γi , γi ) and (Qi , qi ). In modified Delaunay variables, the two-body Hamiltonian, Equation (6), simply becomes

Equation (10)

By contrast, ${H}_{\mathrm{int}.}^{(i,j)}$ does not admit a simple expression in terms of the canonical variables. Rather, the benefit of expressing the Hamiltonian in terms of classical action-angle variables is that ${H}_{\mathrm{int}.}^{(i,j)}$ can be decomposed as a Fourier series in the canonical angle variables, enabling the application of methods from Hamiltonian perturbation theory.

4. Expansion of the Disturbing Function

The celmech.disturbing_function module provides tools for calculating coefficients appearing in the cosine series expansion of the interaction Hamiltonian, ${H}_{\mathrm{int}.}^{(i,j)}$, both in terms of both orbital elements as well as canonical variables. We begin by describing the expansion of the disturbing function in terms of orbital elements.

4.1. Expansion in Terms of Orbital Elements

In order to write the cosine series expansion, we will take aj > ai , define αi,j = ai /aj , ${s}_{i}=\sin ({I}_{i}/2)$, θ i,j = (λj , λi , − γi , − γj , − qi , − qj ), and write

Equation (11)

where k = (k1, k2,...,k6) and ν = (ν1,...,ν4) are integer multiindices. Rotation and reflection symmetries of the planets' gravitational interactions dictate that ${\tilde{C}}_{{\boldsymbol{k}}}^{{\boldsymbol{\nu }}}(\alpha )\ne 0$ only if ${\sum }_{l=1}^{6}{k}_{l}=0$ and k5 + k6 = 2n where n is an integer (e.g., Murray & Dermott 1999). For small eccentricities and inclinations, the coefficient of the cosine term $\cos ({\boldsymbol{k}}\cdot {{\boldsymbol{\theta }}}_{i,j})$ is of the order $\sim {s}_{i}^{| {k}_{5}| }{s}_{j}^{| {k}_{6}| }{e}_{i}^{| {k}_{3}| }{e}_{j}^{| {k}_{4}| }$, and the higher-order corrections are of degree 2 and greater in the planets' eccentricities and inclinations.

To compute the coefficients ${\tilde{C}}_{{\boldsymbol{k}}}^{{\boldsymbol{\nu }}}(\alpha )$ appearing in Equation (11), we first represent the interaction Hamiltonian as the sum of two parts, ${H}_{\mathrm{int}}^{(i,j)}=-\tfrac{{{Gm}}_{i}{m}_{j}}{{a}_{j}}({{ \mathcal R }}_{\mathrm{dir}.}^{(i,j)}+{{ \mathcal R }}_{\mathrm{ind}.}^{(i,j)})$ where we define the direct and indirect parts of the disturbing function as 8

Equation (12)

and we denote the contributions of ${{ \mathcal R }}_{\mathrm{dir}.}^{(i,j)}$ and ${{ \mathcal R }}_{\mathrm{ind}.}^{(i,j)}$ to the value of the coefficient ${\tilde{C}}_{{\boldsymbol{k}}}^{{\boldsymbol{\nu }}}(\alpha )$ as ${[{\tilde{C}}_{{\boldsymbol{k}}}^{{\boldsymbol{\nu }}}(\alpha )]}_{\mathrm{ind}.}$ and ${[{\tilde{C}}_{{\boldsymbol{k}}}^{{\boldsymbol{\nu }}}(\alpha )]}_{\mathrm{ind}.}$, respectively. Given the values of k and ν , the celmech code implements the algorithm described in Ellis & Murray (2000) to compute ${\left[{\tilde{C}}_{{\boldsymbol{k}}}^{{\boldsymbol{\nu }}}(\alpha )\right]}_{\mathrm{dir}.}$ in terms of Laplace coefficients and their derivatives while the calculation of ${[{\tilde{C}}_{{\boldsymbol{k}}}^{{\boldsymbol{\nu }}}(\alpha )]}_{\mathrm{ind}.}$ is detailed in Appendix B. The celmech.disturbing_function module's df_coefficient_Ctilde function can be used to compute the coefficients ${\tilde{C}}_{{\boldsymbol{k}}}^{{\boldsymbol{\nu }}}(\alpha )$. The function takes two integer tuples, k = (k1, k2,...,k6) and nu = (ν1,...,ν4), as arguments and returns a python dictionary representation of the coefficient with key-value pairs in the form $\{({p}_{1},({j}_{1},{s}_{1},{n}_{1})):{A}_{1},\ldots ,({p}_{N},({j}_{N},{s}_{N},{n}_{N})):{A}_{N},(^{\prime} {\mathtt{indirect}}^{\prime} ,{p}_{\mathrm{ind}}):{A}_{\mathrm{ind}}\}$ with

Equation (13)

where

and pl , nl , and jl are integers, and sl is a half-integer.

The function celmech.disturbing_function module's evaluate_df_coefficient_dict can be used to compute a numerical value of a coefficient, ${\tilde{C}}_{{\boldsymbol{k}}}^{{\boldsymbol{\nu }}}$, for a particular choice of α. The function deriv_df_coefficient computes derivatives of disturbing function coefficients with respect to α. This function takes a dictionary of the form returned by df_coefficient_Ctilde as an argument and returns a new dictionary of the same form representing the derivative of the coefficient with respect to α. Some basic calculations of disturbing function coefficients are demonstrated in the Jupyter example notebook DisturbingFunctionCoefficients.ipynb.

4.2. Expansion in Terms of Canonical Variables

While our ${\tilde{C}}_{{\boldsymbol{k}}}^{{\boldsymbol{\nu }}}$ coefficients for the direct part of the disturbing function match those of Ellis & Murray (2000) derived in terms of orbital elements, formulating Hamiltonian equations of motion requires a disturbing function expansion expressed in terms of canonical variables. To derive an expansion in terms of canonical variables, we first introduce some auxiliary variables: we introduce the reference semimajor axes ai,0 about which the expansion of coefficients will be centered along with αij,0 = ai,0/aj,0, ${{\rm{\Lambda }}}_{i,0}={{\rm{\Lambda }}}_{i}\sqrt{{a}_{i,0}/{a}_{i}}$, and δi = (Λi − Λi,0)/Λi,0. Next, we define ${X}_{i}=\sqrt{\tfrac{1}{{{\rm{\Lambda }}}_{i,0}}}({\kappa }_{i}-i{\eta }_{i})$ and ${Y}_{i}=\tfrac{1}{2}\sqrt{\tfrac{1}{{{\rm{\Lambda }}}_{i,0}}}({\sigma }_{i}-i{\rho }_{i})$, where we use a Roman " ${\rm{i}}$ "to denote the imaginary unit, i.e., ${\rm{i}}\equiv \sqrt{-1}$. The complex variables ${z}_{i}={e}_{i}{e}^{i{\varpi }_{i}}$ and ${{\zeta }}_{i}={s}_{i}{e}^{{\rm{i}}{{\rm{\Omega }}}_{i}}$ can then be expressed explicitly in terms of the variables Xi , Yi , and δi according to

Equation (14)

and

Equation (15)

where overlines denote complex conjugates. To express the amplitude of a single disturbing function cosine term, $\cos ({\boldsymbol{k}}\cdot {{\boldsymbol{\theta }}}_{i,j})$, in terms of the canonical variables introduced in Section 3, we seek an expression for coefficients ${C}_{{\boldsymbol{k}}}^{{\boldsymbol{\nu }},{\boldsymbol{l}}}$ such that, when k3, k4, k5, and k6 > 0, the following relationship holds:

Equation (16)

When k3 < 0, ${z}_{i}^{{k}_{3}}$ and ${X}_{i}^{{k}_{3}}$ in Equation (16) are replaced with ${\bar{z}}_{i}^{-{k}_{3}}$ and ${\bar{X}}_{i}^{-{k}_{3}}$, respectively; and analogous substitutions for variables (zj , ζi , ζj ) and (Xj , Yi , Yj ) are made when any of k4, k5, or k6 < 0. In Appendix C, we work out explicit expressions for the coefficients ${C}_{{\boldsymbol{k}}}^{{\boldsymbol{\nu }},{\boldsymbol{l}}}$ in terms of terms of the ${\tilde{C}}_{{\boldsymbol{k}}}^{{\boldsymbol{\nu }}}$ coefficients and their derivatives. While these expressions are, in general, complicated, note that ${C}_{{\boldsymbol{k}}}^{(0,0,0,0),(0,0)}={\tilde{C}}_{{\boldsymbol{k}}}^{(0,0,0,0)}$. The disturbing_function module's df_coefficient_C function can be used to obtain disturbing function coefficients ${C}_{{\boldsymbol{k}}}^{{\boldsymbol{\nu }},{\boldsymbol{l}}}$.

4.3. Generating Disturbing Function Arguments of a Given Order

In many applications, one is interested in gathering a series of particular disturbing function terms, such as those associated with a particular resonance, up to a maximum order, Nmax, in eccentricities and inclinations. The disturbing_function module provides the function df_arguments_dictionary that allows the user to enumerate all cosine arguments, k · θ ij , appearing in the disturbing function expansion up to a given order Nmax in inclinations and eccentricities. In order to do so, the function enumerates tuples (k3, k4, k5, k6) that satisfy $| {k}_{3}| +| {k}_{4}| +| {k}_{5}| +| {k}_{6}| \leqslant {N}_{\max }$, along with the condition k5 + k6 = 2n for integer n. The latter condition ensures ${C}_{{\boldsymbol{k}}}^{{\boldsymbol{n}},{\boldsymbol{l}}}\ne 0$ (see Section 4.1). These terms are further grouped by their value of ${\sum }_{i=3}^{6}{k}_{i}$, which must be equal to − (k1 + k2) to ensure ${C}_{{\boldsymbol{k}}}^{{\boldsymbol{n}},{\boldsymbol{l}}}\ne 0$. The Jupyter notebook example DisturbingFunctionArguments.ipynb illustrates how the results returned by df_arguments_dictionary are structured.

The disturbing_function module also provides the convenience function list_resonance_terms to create a list of all k and ν combinations associated with a particular MMR that appear in the expansion of the disturbing function up to a user-specified order. In particular, given the input p and q specifying the p:pq MMR along with a maximum order, list_resonance_terms returns a python list of tuples in the form ((k1, k2,...,k6), (ν1,...,ν4)) that includes all terms that satisfy

Equation (17)

in addition to the usual rules of ${\sum }_{i=1}^{6}{k}_{i}=0$ and k5 + k6 = 2n for integer n. Similarly, the function list_secular_terms can be used to create a list of all k and ν combinations that appear as secular terms with k1 = k2 = 0 in the disturbing function expansion up to a user-specified order. Both the list_resonance_terms and list_secular_terms functions are illustrated in a Jupyter notebook example.

4.4. Oblateness and General Relativity

The effects of primary oblateness and general relativistic precession can be important for the dynamical evolution of planetary systems. Here we give expressions for the orbit-averaged potentials of these effects in terms of the canonical variables used by celmech. The gravitational potential due to the quadrupole moment of an oblate central primary at a heliocentric position r is given by

Equation (18)

where r = ∣ r ∣, $\hat{{\boldsymbol{r}}}={\boldsymbol{r}}/r$, and $\hat{{\boldsymbol{z}}}$ is the direction perpendicular to the primary's equatorial plane. In terms of orbital elements, $\hat{{\boldsymbol{r}}}\cdot \hat{{\boldsymbol{z}}}=\sin (I)\sin (f\,+\,\varpi -{\rm{\Omega }})$ $=\,2s\sqrt{1-{s}^{2}}\sin (f\,+\,\varpi -{\rm{\Omega }})$ where f is the true anomaly, and the inclination, I, is measured relative to the primary's equatorial plane. Denoting orbit-averaged values by < · > , we use $\lt {r}^{-3}\gt =\,{a}^{-3}{\left(1-{e}^{2}\right)}^{-3/2}$ and $\lt {r}^{-3}{\sin }^{2}(f+\varpi -{\rm{\Omega }})\gt =\,\tfrac{1}{2}\lt {r}^{-3}\gt $ to find that the orbit-averaged value of the quadrupole potential is given by $\lt {\phi }_{{J}_{2}}\gt =\,-{J}_{2}\tfrac{{{GM}}_{* }}{a}{\left(\tfrac{{R}_{* }}{a}\right)}^{2}{\left(1-{e}^{2}\right)}^{-3/2}\left(1/2+3({s}^{4}-{s}^{2})\right)$. The corresponding contribution to the Hamiltonian can be written in terms of canonical variables as

Equation (19)

Nobili & Roxburgh (1986) describe how the apsidal precession caused by general relativity (GR) can be approximated by including a potential term equal to

Equation (20)

Primary oblateness and GR effects can be modeled by adding terms in the form of Equations (19) and (20) to the Hamiltonian represented by a PoincareHamiltonian object, described below in Section 5.2, using the add_orbit_average_J2_terms and add_gr_potential_terms methods.

5. Hamiltonian and Poincare Modules

This section begins in Section 5.1 with a description of how the celmech code represents general Hamiltonian systems. In Section 5.2, we describe the PoincareHamiltonian class, which is capable of representing the Hamiltonian of a planetary system by the inclusion of a collection of disturbing function terms capturing interplanet gravitational interactions. Section 5.3 describes how canonical transformations, which can be applied to modify any Hamiltonian represented by celmech, are implemented. Section 5.4 describes the implementation of the FirstOrderGeneratingFunction class that can be used to apply techniques from canonical perturbation theory to average away fast oscillations in the instantaneous, osculating orbital elements and transform to mean elements that better track the system's long-term evolution.

5.1. Representing Hamiltonian Systems

The celmech.hamiltonian module defines the PhaseSpaceState and Hamiltonian classes, which serve as the basic objects used by celmech to represent Hamiltonian dynamical systems. The Jupyter example notebook SimplePendulum.ipynb provides a basic example that applies these classes to model the motion of a simple pendulum. PhaseSpaceState instances represent points in the phase space of a Hamiltonian dynamical system and store symbolic variables along with numerical values for canonical variables as key-value pairs of an ordered dictionary under the qp attribute. The Hamiltonian class can be used to define a Hamiltonian function of the phase space coordinates and momenta of a particular PhaseSpaceState instance. A Hamiltonian instance is initialized by passing a symbolic expression for the Hamiltonian along with a PhaseSpaceState instance. The PhaseSpaceState will then be stored by the new Hamiltonian object as its state attribute. The symbolic expression for the Hamiltonian should depend on the same canonical variables stored by the PhaseSpaceState instance. The Hamiltonian represented by a Hamiltonian class can also depend on any number of symbolic parameters whose numerical values should be set at initialization by passing a dictionary that pairs parameter symbols with their numerical values. The numerical parameter values are stored as the H_params attribute and can be updated at any point after initializing a Hamiltonian instance to explore how a system's dynamics depends on parameter values.

In addition to storing a symbolic representation of the Hamiltonian function and its associated flow, a Hamiltonian object can be used to integrate the equations of motion and evolve a phase space trajectory in time. In order to do so, a Hamiltonian instance implements the functions flow_func and jacobian_func that take numerical values of the canonical variables as input and return the numerical value of the flow given by Hamilton's equations, and its Jacobian with respect to the canonical variables. These functions are used in conjunction with the scipy package's (Virtanen et al. 2020) integrate.ode class 9 to evolve the phase space state of the system.

5.2. Constructing Hamiltonians for Planetary Systems

The celmech.poincare module provides tools to model planetary systems' dynamics by building a Hamiltonian from the disturbing function expansion described in Section 4. To build these Hamiltonian models, the module defines the Poincare class, a special subclass of the PhaseSpaceState class, and PoincareHamiltonian, a special subclass of the Hamiltonian class. The Poincare class represents the phase space state of an N-body planetary system in terms of the canonically conjugate coordinates q = (λ1, η1, ρ1,...,λN−1, ηN−1, ρN−1) and momenta p = (Λ1, κ1, σ1,...,ΛN−1, κN−1, σN−1). In addition to storing these canonical variables, a Poincare instance owns a collection of PoincareParticle objects through the Poincare.particles attribute. The individual members of this collection represent the individual bodies of the N-body system, i.e., the star and planets. Each planet PoincareParticle object records the values of its mass and six canonical variables as well as various quantities, including orbital elements, derived from these values. The API for accessing the mass and orbital-element values of individual PoincareParticle instances is designed to closely mirror that of the REBOUND particle class.

A PoincareHamiltonian is initialized by passing a Poincare object instance, which is then stored as the PoincareHamiltonian's state attribute. Upon initialization, the symbolic Hamiltonian stored by a PoincareHamiltonian object for an N-body planetary system is simply the sum of N − 1 individual Keplerian Hamiltonians. In other words, the Hamiltonian is given by $H={\sum }_{i=1}^{N-1}{H}_{\mathrm{Kep},i}$ where HKep,i is given by Equation (10). The user can then add specific interaction terms between the pairs of planets from the disturbing function expansion described in Section 4 using a variety of methods of the PoincareHamiltonian class. The most basic method for adding disturbing function terms is PoincareHamiltonian.add_cosine_term. This method takes the integers k = (k1,...,k6) along with the inner and outer planet indices, i and j, as input and adds the terms

Equation (21)

to the Hamiltonian. 10 The combinations of l and ν occurring in the sum are controlled by the user through a variety of optional keyword arguments. If no keyword arguments are passed, the default behavior is to include only the lowest-order contribution from the disturbing function, i.e., a single term with l = (0, 0) and ν = (0, 0, 0, 0). The PoincareHamiltonian methods add_MMR_terms and add_secular_terms combine this basic add_cosine_term method with the functions for enumerating the particular disturbing function arguments described in Section 4.3 to add collections of resonant or secular terms to the Hamiltonian up to a user-specified order in inclinations and eccentricities.

5.3. Canonical Transformations

The study of Hamiltonian systems is often greatly simplified by canonical transformations from one set of canonical variables to another that leave Hamilton's equations unchanged. This allows for the algorithmic determination of constants of motion that can sometimes be used to greatly reduce the dimensionality of the problem (e.g., Hadden 2019). The celmech CanonicalTransformation class provides a general framework for implementing canonical transformations. Instances of this class allow the user to apply canonical transformations to expressions by applying substitution rules that replace any occurrences of old canonical variables with new ones and vice versa. A CanonicalTransformation instance can also be used to generate new Hamiltonian objects by applying its transformation to an existing Hamiltonian instance's expression for the Hamiltonian, stored as the H attribute. The resulting Hamiltonian object's state attribute will be a new PhaseSpaceState object representing the new canonical variables, and its H attribute will be the transformed Hamiltonian.

Users can create canonical transformation objects by supplying sets of old and new canonical variables along with substitution rules. 11 Users can also use one the following class methods for initializing some frequently used canonical transformations:

  • 1.  
    from_type2_generating_function allows the user to specify a generating function F2( q , P ) producing a canonical transformation that satisfies the equations
    Equation (22)
    Provided with an expression for the generating function, F2, this method will attempt to automatically determine the corresponding transformation rules by applying sympy's solve function to express the new variables ( Q , P ) in terms of the old variables ( q , p ) and vice versa.
  • 2.  
    cartesian_to_polar produces a canonical transformation that transforms user-specified conjugate coordinate–momentum pairs of old variables (qi , pi ) to new conjugate pairs $({Q}_{i},{P}_{i})=\left(\mathrm{atan}2({q}_{i},{p}_{i}),\tfrac{1}{2}({q}_{i}^{2}+{p}_{i}^{2})\right)$, where atan2 denotes the two-argument arctangent function that returns a value in the range ( − π, π]). All other conjugate pairs will remain unchanged.
  • 3.  
    polar_to_cartesian produces a canonical transformation that transforms user-specified conjugate pairs, (qi , pi ), to new conjugate coordinate–momentum pairs $({Q}_{i},{P}_{i})\,=\left(\sqrt{2{p}_{i}}\sin {q}_{i},\sqrt{2{p}_{i}}\cos {q}_{i}\right)$. All other conjugate pairs will remain unchanged.
  • 4.  
    from_linear_angle_transformation produces the canonical transformation ( q , p ) → ( Q , P ) given by
    Equation (23)
    where T is a user-supplied, invertible matrix.
  • 5.  
    from_poincare_angles_matrix takes a Poincare instance as input, along with an invertible matrix T, and produces a transformation where the new canonical coordinates are linear combinations of the planets' angular orbital elements given by Q = T · (λ1,...,λN , − ϖ1,..., − ϖN, − Ω1,..., − ΩN ), and the corresponding new conjugate momenta are given in terms of the canonical modified Delaunay variables described in Section 3 by ${\boldsymbol{P}}={\left({T}^{-1}\right)}^{{\rm{T}}}\,\cdot ({{\rm{\Lambda }}}_{1},\ldots ,{{\rm{\Lambda }}}_{N},{{\rm{\Gamma }}}_{1},\ldots ,{{\rm{\Gamma }}}_{N},{Q}_{1},\ldots ,{Q}_{N})$.
  • 6.  
    Lambdas_to_delta_Lambdas takes a Poincare instance as input and implements the canonical transformation replacing the Λi variables with δΛi = Λi − Λi,0 as the momenta canonically conjugate to the planets' mean longitudes, λi .
  • 7.  
    rescale_transformation produces a canonical transformation that simultaneously rescales the Hamiltonian and all canonical momentum variables by a common factor, f. In other words, if H is the old Hamiltonian and pi are the old momentum variables, the new Hamiltonian will be $H^{\prime} ={fH}$, and ${p}_{i}^{\prime} ={{fp}}_{i}$ will replace pi as momentum variables conjugate to the old coordinates qi . The user can optionally specify a subset of canonical variable pairs (yi , xi ) as Cartesian pairs, which will be transformed so that the new, rescaled variables are instead $(y{{\prime} }_{i},x{{\prime} }_{i})=(\sqrt{f}{y}_{i},\sqrt{f}{x}_{i})$.
  • 8.  
    composite combines a series of canonical transformations.

While time-dependent canonical transformations are not currently supported, they can always be implemented by reformulating the Hamiltonian under consideration in the extended phase space that includes time and the negative of the system's energy as an additional conjugate variable pair.

Often canonical transformations are applied to eliminate the explicit dependence of the transformed Hamiltonian on one or more canonical variable. This is because, when the transformed Hamiltonian does not depend on one of the angle variables, the corresponding conjugate momentum variable is conserved, and Hamilton's equations for the remaining degrees of freedom are simplified. To make the discussion more concrete, suppose we have a canonical transformation of the canonical variables of an N degree of freedom system (qi , pi ) → (ϕ1,...,ϕM , Q1, ....,QNM , I1,...,IM , P1,...,PNM ) where the transformed Hamiltonian, $H^{\prime} ({Q}_{i},{P}_{i};{I}_{j})$, is independent of the coordinate variables ϕj . so that the quantities I1,...,IM are constant. When such an elimination can be accomplished, it is frequently convenient to consider a system's dynamics in the reduced phase space comprised of the remaining NM degrees of freedom with canonical variables (Qi , Pi ) and treat the M conserved quantities, Ij , as parameters of the Hamiltonian. When transforming a Hamiltonian by applying the old_to_new_hamiltonian method of a CanonicalTransformation object, the user has the option to automatically detect whether the resulting transformed Hamiltonian is independent of any of the new canonical variables and, if so, produce a Hamiltonian object with a state attribute representing a point in the reduced phase space with canonical variables (Qi , Pi ) and with the quantities Ij stored as parameters under the Hamiltonian object's H_params attribute. To enable the application of the inverse transformation from the new canonical variables back to old ones in this situation, the new Hamiltonian object possesses a full_qp attribute that stores the full set of variables, (ϕ1,...,ϕM , Q1, ....,QNM , I1,...,IM , P1,...,PNM ), while the qp attribute 12 only stores the variables of the reduced phase space, (Qi , Pi ). The reduced Hamiltonian object's full_qp attribute will only store the initial values of the ignorable coordinates, ϕj , determined at the time that the transformation was applied. It is important to recognize that the actual time evolution of these coordinates, given by $\tfrac{d}{{dt}}{\phi }_{j}=\tfrac{\partial }{\partial {I}_{j}}H^{\prime} ({Q}_{i},{P}_{i};{I}_{j})$, is generally nontrivial and depends on the specific trajectory, (Qi (t), Pi (t)), of the system in the reduced phase space. Consequently, it will usually not be possible to reconstruct the full phase space state of the system in the old canonical variables (qi , pi ) if only the reduced equations of motion governing the (Qi , Pi ) are integrated. Nonetheless, in many applications, the values of these ignorable coordinates are unimportant for the aspects of the dynamics one wishes to study, and the application of the inverse transformation to the data stored in the full_qp attribute can provide useful information about how the system evolves in the original canonical variables. A basic illustration of these principles is provided in an example Jupyter notebook 13 .

5.4. Lie Series Transformations

Modeling the dynamics of a planetary system with a Hamiltonian that includes only a finite number of terms from a disturbing function can be justified because the infinite number of ignored terms are rapidly oscillating and have negligible average influence on the motion, at least over sufficiently short timescales. Nevertheless, these fast oscillations in the full problem can make it challenging to match the initial conditions in an averaged formulation, and such discrepancies can make comparisons between analytical and N-body models challenging, especially near regions of phase space where the dynamical behavior changes sharply, e.g., near resonance boundaries. Additionally, while typically we are interested in methods for removing these nuisance terms in the disturbing function, there are also cases where these fast oscillations are of primary interest. An important example is for transiting pairs of planets near (but not in) MMR, where the "fast" oscillations due to the resonant terms are observable as TTVs (for a Lie series approach to TTVs, see Nesvorný & Morbidelli 2008).

A powerful approach for transforming back and forth between the instantaneous, or osculating, canonical variables (which are subject to a multitude of fast oscillations) and the mean variables that remove these fast modes is through the Lie series method. This technique introduces a near-identity canonical transformation (ensuring that the mean variables remain canonical) that, by construction, can cancel any set of rapidly oscillating terms in the Hamiltonian to first order in the planet–star mass ratio. This transformation is often referred to as averaging since, at this leading order in the masses, the technique is equivalent to averaging the problem over the rapidly oscillating angles. An advantage of the Lie series method is that it explicitly constructs the resultant terms at higher orders in the masses, which are not available through an averaging approach. A thorough discussion of canonical perturbation theory using the Lie series method, including important issues related to chaos, nonintegrability, and the (non)convergence of these series, is beyond the scope of this paper and can be found in references such as Morbidelli (2002) or Lichtenberg & Lieberman (2013). We will limit our discussion to the construction of canonical transformations to first order in the planet–star mass ratios, which are equivalent to transformations back and forth between osculating and mean variables, and are implemented in celmech.

To introduce Lie-series generating functions, consider splitting the Hamiltonian of a N-body system into three pieces: a Keplerian piece given by ${H}_{\mathrm{Kep}}={\sum }_{i=1}^{N-1}{H}_{\mathrm{Kep},i}$, a term Hslow containing slowly varying disturbing function terms such as those with (near) resonant cosine arguments or secular terms, and a term Hosc that contains rapidly oscillating terms with negligible influence on the dynamics. We seek a canonical transformation that eliminates Hosc to first order in planet masses. In other words, we seek a canonical transformation $T:(q,{\boldsymbol{p}})\to ({\boldsymbol{q}}^{\prime} ,{\boldsymbol{p}}^{\prime} )$ such that the transformed Hamiltonian is $H^{\prime} \equiv H\circ {T}^{-1}={H}_{\mathrm{Kep}}+{H}_{\mathrm{slow}}+{ \mathcal O }({\left(m/{M}_{* }\right)}^{2})$. We use the Lie series method to construct such a transformation. The Lie transformation, $\exp [{{ \mathcal L }}_{\chi }]$, of a function of phase space coordinates, f, is defined in terms of the Lie derivative operator, ${{ \mathcal L }}_{\chi }\equiv [\cdot ,\chi ]$, as

Equation (24)

Since a Lie transformation evolves f under the flow induced by Hamilton's equations for the "Hamiltonian" χ, it is canonical by construction. The Lie series method seeks to find a generating function χ such that the Lie transformation $\exp [{{ \mathcal L }}_{\chi }]$ produces the desired transformation, T, that eliminates the unwanted terms. If the generating function, χ, is itself of order ${ \mathcal O }(m/{M}_{* })$, then the transformed Hamiltonian is $H^{\prime} \,=\exp [{{ \mathcal L }}_{\chi }]H\approx {H}_{\mathrm{Kep}}+{H}_{\mathrm{slow}}+{H}_{\mathrm{osc}}+[{H}_{\mathrm{Kep}},\chi ]$ after dropping terms ${ \mathcal O }({\left(m/{M}_{* }\right)}^{2})$, and the generating function χ should satisfy [HKep, χ] = − Hosc. Noting that the Poisson bracket of HKep with all canonical variables except the mean longitudes vanishes and that

Equation (25)

where ni = ∂HKep/∂Λi is the ith planet's mean motion, we immediately see that any disturbing function terms in Hosc involving planets i and j written in the form of Equation (21) will be eliminated to first order in the planet masses by simply including a corresponding term in χ that replaces $\cos ({\boldsymbol{k}}\cdot {{\boldsymbol{\theta }}}_{i,j})$ with $\sin ({\boldsymbol{k}}\cdot {{\boldsymbol{\theta }}}_{i,j})/({k}_{1}{n}_{j}+{k}_{2}{n}_{i})$ provided k1 nj + k2 ni ≠ 0. The condition that k1 nj + k2 ni ≠ 0 should always be satisfied since Hosc is presumed to be comprised only of rapidly oscillating terms.

The celmech class FirstOrderGeneratingFunction allows users to construct a generating function χ that eliminates a user-specified collection of disturbing function terms in the transformed Hamiltonian to first order in planet masses following the approach just described above. Terms are added to the generating function in much the same way that terms are added to a PoincareHamiltonian instance. In fact, FirstOrderGeneratingFunction is a subclass of the PoincareHamiltonian class that overwrites the parent class's routines for adding cosine terms so that the trigonometric terms $\cos ({\boldsymbol{k}}\cdot {{\boldsymbol{\theta }}}_{i,j})$ are instead replaced with $\sin ({\boldsymbol{k}}\cdot {{\boldsymbol{\theta }}}_{i,j})/({k}_{1}{n}_{j}+{k}_{2}{n}_{i})$. The class provides a symbolic representations of the generating function under the chi and N_chi attributes, similar to the PoincareHamiltonian class's H and N_H attributes. The class also provides an array of methods for transforming canonical variables and deriving perturbative solutions to the equations of motion. The Jupyter example notebook FirstOrderGeneratingFunction.ipynb illustrates the basic application of the FirstOrderGeneratingFunction to more accurately predict the secular evolution of the mean eccentricities of a pair of planets near a 3:2 MMR. The Jupyter example notebook TransitTimingVariations.ipynb demonstrates the application of Lie series transformations to analytically predicting TTVs.

In addition to the term-wise elimination of individual rapidly oscillating disturbing function terms described above, it is possible to remove all harmonics depending solely on the angular combination ψ = λi λj to zeroth order in eccentricities and inclinations with a single transformation. A number of authors have previously exploited the fact that perturbative solutions for planets' mutual perturbation at zeroth order in eccentricities and inclinations can be expressed in a closed form without needing to resort to an expansion in Fourier harmonics (e.g., Malhotra 1993; Agol et al. 2005; Nesvorný & Vokrouhlický 2014; Hadden et al. 2019), although not all these studies deploy a Lie series formalism. To zeroth order in inclinations and eccentricities, the disturbing function, ${{ \mathcal R }}_{\mathrm{dir}.}^{(i,j)}+{{ \mathcal R }}_{\mathrm{ind}.}^{(i,j)}$, given in Equation (12) can be written as

Equation (26)

where $P(\psi ;\alpha )={\left(1+{\alpha }^{2}-2\alpha \cos ({\lambda }_{j}-{\lambda }_{i})\right)}^{-1/2}$. Therefore, a Lie series transformation with generating function

Equation (27)

where $\bar{P}(\alpha )=\tfrac{1}{2\pi }{\int }_{-\pi }^{\pi }P(\psi ,\alpha )d\psi $ is the mean value of P(ψ, α), will eliminate the disturbing function terms in Equation (26). The integral in Equation (27) can be written explicitly in terms of elliptic integrals as

Equation (28)

where ${\mathbb{K}}$ is the complete elliptic integral of the first kind, and F( · ∣m) is an incomplete elliptic integral of the first kind with modulus m. A term of the form given in Equation (27) can be added to the symbolic generating function stored by a FirstOrderGeneratingFunction object with the add_zeroth_order_term method.

6. Summary

In this paper, we presented celmech, an open-source python package for conducting celestial mechanics calculations. The code combines a disturbing function expansion algorithm based on a method originally devised by Ellis & Murray (2000) with the symbolic mathematics capabilities provided by the sympy library (Meurer et al. 2017) to enable users to efficiently create and integrate Hamiltonian models for planetary systems. The celmech API is designed so that users can easily compare these Hamiltonian models to direct N-body integrations with the REBOUND code (Rein & Liu 2012).

The code is available through the Python Package Index as well as on GitHub at github.com/shadden/celmech. The code can can be freely redistributed under the GPL-3.0 license. Online documentation can be found at celmech.readthedocs.io. A library of Jupyter notebook examples illustrating various features and applications of the code is available at github.com/shadden/celmech/tree/master/jupyter_examples.

The celmech code's modular design will allow ongoing development. Some features currently implemented in celmech, in addition to the modules and capabilities detailed in this paper, include tools for formulating and integrating the equations of motion governing MMRs that are derived from numerically averaged disturbing functions (rather than truncated power series expansions in eccentricity and inclination) and tools for formulating and integrating secular equations of motion. We plan to detail the additional features in forthcoming papers. Community contributions to the celmech code are also welcome and can be submitted using the GitHub pull request feature online at github.com/shadden/celmech/pulls.

We thank the anonymous referee whose comments helped improve this manuscript. We thank David Hernandez for helpful discussions during the development of the celmech code. Implementations of some celmech routines are based on the Mathematica package by Fabio Zugno available at library.wolfram.com/infocenter/MathSource/4256/. S.H. acknowledges support by the Natural Sciences and Engineering Research Council of Canada (NSERC), funding reference CITA 490888-16. D.T. is grateful for support from the Lyman Spitzer Jr. fellowship.

Software: matplotlib (Hunter 2007), NumPy (Oliphant 2006), REBOUND (Rein & Liu 2012), REBOUNDx (Tamayo et al. 2020), scipy (Jones et al. 2001), sympy (Meurer et al. 2017).

Appendix A: Table of Symbols

Table A1 lists the main mathematical symbols used in the text along with brief descriptions as appropriate.

Table A1. Summary of Mathematical Notation Used Throughout the Paper: We Include Short Definitions When Appropriate

NameExpressionDescription
G  Newton's gravitational constant
M*  Mass of central star
mi  Mass of ith planet
r i  Heliocentric position of ith planet
${\tilde{{\boldsymbol{r}}}}_{i}$  Barycentric momentum of ith planet
ai  Semimajor axis of ith planet
ei  Eccentricity of ith planet
Ii  Inclination of ith planet
λi  Mean longitude of ith planet
ϖi  Longitude of periapse ith planet
Ωi  Longitude of ascending node ith planet
si $\sin ({I}_{i}/2)$ Inclination variable appearing in many classic disturbing function expansions
μi mi M*/(M* + mi )Reduced mass of ith planet
Mi M* + mi Effective central mass for ith planet's orbit
Λi ${\mu }_{i}\sqrt{{{GM}}_{i}{a}_{i}}$ Canonical momentum conjugate to λi
Γi ${{\rm{\Lambda }}}_{i}(1-\sqrt{1-{e}_{i}^{2}})$ Canonical momentum conjugate to γi = − ϖi
Qi $=2{{\rm{\Lambda }}}_{i}\sqrt{1-{e}_{i}^{2}}{\sin }^{2}({I}_{i}/2)$ Canonical momentum conjugate to qi = − Ωi
κi $=\sqrt{2{{\rm{\Gamma }}}_{i}}\cos {\varpi }_{i}$  
ηi $=-\sqrt{2{{\rm{\Gamma }}}_{i}}\sin {\varpi }_{i}$  
σi $=\sqrt{2{Q}_{i}}\cos {{\rm{\Omega }}}_{i}$  
ρi $=-\sqrt{2{Q}_{i}}\sin {{\rm{\Omega }}}_{i}$  
${{ \mathcal R }}_{\mathrm{dir}.}^{(i,j)}$ $=\tfrac{{a}_{j}}{| {{\boldsymbol{r}}}_{j}-{{\boldsymbol{r}}}_{i}| }$ Direct component of disturbing function
${{ \mathcal R }}_{\mathrm{ind}.}^{(i,j)}$ $=-\tfrac{{a}_{j}}{{GM}_{\ast }{m}_{j}{m}_{i}}{\tilde{{\boldsymbol{r}}}}_{j}\cdot {\tilde{{\boldsymbol{r}}}}_{i}$ Indirect component of disturbing function
αi,j = ai /aj Semimajor axis ratio
θ i,j = (λj , λi , ϖi , ϖj , Ωi , Ωj )Vector of angle variables
${\tilde{C}}_{{\boldsymbol{k}}}^{{\boldsymbol{\nu }}}(\alpha )$  Disturbing function coefficient of $\cos ({\boldsymbol{k}}\cdot {{\boldsymbol{\theta }}}_{i,j})$ for expansion in ei and si
${b}_{s}^{(s)}(\alpha )$ $\tfrac{1}{\pi }{\int }_{-\pi }^{\pi }\tfrac{\cos (j\theta )}{{\left(1+{\alpha }^{2}-2\alpha \cos \theta \right)}^{s}}$ Laplace coefficient
zi $={e}_{i}\exp ({\rm{i}}{\varpi }_{i})$ Complex eccentricity
ζi $={s}_{i}\exp ({\rm{i}}{{\rm{\Omega }}}_{i})$ Complex inclination variable
Λi,0  Reference value for Λi
δi Λi i,0 − 1Fractional deviation of Λi from reference value Λi,0
Xi $=\sqrt{\tfrac{1}{{{\rm{\Lambda }}}_{i,0}}}({\kappa }_{i}-{\rm{i}}{\eta }_{i})$ $\approx {e}_{i}\exp ({\rm{i}}{\varpi }_{i})+{ \mathcal O }({e}_{i}^{3})$
Yi $=\sqrt{\tfrac{1}{4{{\rm{\Lambda }}}_{i,0}}}({\sigma }_{i}-{\rm{i}}{\rho }_{i})$ $\approx \sin ({I}_{i}/2)\exp ({\rm{i}}{{\rm{\Omega }}}_{i})+{ \mathcal O }({I}_{i}{e}_{i}^{2})$
${C}_{{\boldsymbol{k}},{\boldsymbol{l}}}^{{\boldsymbol{\nu }}}(\alpha )$  Disturbing function coefficient of $\cos ({\boldsymbol{k}}\cdot {{\boldsymbol{\theta }}}_{i,j})$ for expansion in Xi ,Yi , and δi

Download table as:  ASCIITypeset image

Appendix B: Expansion of the Indirect Disturbing Function

In this appendix, we detail the expansion of the indirect component of the disturbing function,

closely following Laskar & Robutel (1995), who present a method for deriving a complete expansion of the indirect disturbing function, best accomplished with the aid of computer algebra. We extend their derivation in order to provide the explicit formulas for disturbing function coefficients associated with specific cosine arguments. Writing ${\tilde{{\boldsymbol{r}}}}_{i}={\mu }_{i}{n}_{i}{a}_{i}{{\boldsymbol{v}}}_{i}$, the indirect disturbing function can be written as

Equation (B1)

where the ${ \mathcal O }({\left(m/{M}_{* }\right)}^{2})$ error terms arise from approximating μi mi . The vectors v i may be expressed in terms of orbital elements as

Equation (B2)

Equation (B3)

where fi is the planet's true anomaly, and ${\mathfrak{R}}[\cdot ]$ and ${\mathfrak{I}}[\cdot ]$ denote the real and imaginary parts of the enclosed expression, respectively. Using the identity ${\mathfrak{R}}[A]{\mathfrak{R}}[B]=\tfrac{1}{2}{\mathfrak{R}}\left({AB}+A\bar{B}\right)$ and denoting ${{ \mathcal Z }}_{i}={\rm{i}}({e}^{{\rm{i}}(f+{\varpi })}+{e}_{i}{e}^{{\rm{i}}{\varpi }}){\left(1-{e}_{i}\right)}^{-1/2}$, we have

Equation (B4)

Below we will treat the disturbing function terms arising from the expressions labeled "Term 1" and "Term 2" in Equation (B4) separately. But before doing so, we express ${{ \mathcal Z }}_{i}$ explicitly in terms of the mean longitude, λi , rather than the true anomaly, fi , using Hansen coefficients (e.g., Hughes 1981) to write

Equation (B5)

where the coefficients, ${N}_{k,\sigma }^{0,1}$, appearing in the series expansion of ${X}_{k}^{0,1}(e)$ can be calculated with the aid of the recursion relations described in Hughes (1981) and Murray & Dermott (1999). 14 We define the related set of coefficients ${{ \mathcal X }}_{k}^{0,1}(e)={\left(1-{e}^{2}\right)}^{-1/2}{X}_{k}^{0,1}(e)$ so that we may write

Equation (B6)

after noting that no k = 0 term appears in the sum because ${X}_{0}^{0,1}(e)=-e$. We also define coefficients ${{ \mathcal N }}_{k,p}^{0,1}={\sum }_{n=0}^{p}\left(\displaystyle \genfrac{}{}{0em}{}{-1/2}{n}\right){\left(-1\right)}^{n}{N}_{k,p-n}^{0,1}$, so that we may write

Equation (B7)

We now turn to deriving expressions for the terms labeled "Term 1" and "Term 2" in Equation (B4) in terms of orbital elements.

Term 1. Expressing Term 1 in terms of orbital elements, we have

Equation (B8)

We see from Equation (B8) that Term 1 contributes to the cosine amplitudes of Equation (11) for terms with cosine arguments satisfying

Equation (B9)

with m = 0, 1, 2, and $k,k^{\prime} \ne 0$. The indirect contributions to the amplitudes will be

Equation (B10)

for the terms with ${\boldsymbol{k}}=\pm (k^{\prime} ,-k,k-1,1-k^{\prime} ,m,-m)$ with m=0, 1, or 2. In particular, indirect contributions to terms associated with p:pq MMRs will occur for coefficients ${\tilde{C}}_{(p,q-p,p-q-1,1-p,m,-m)}^{{\boldsymbol{\nu }}}$ and ${\tilde{C}}_{(p,q-p,p-q+1,-1-p,-m,m)}^{{\boldsymbol{\nu }}}$ when $(k^{\prime} ,k)=(p,p-q)$ and $(k^{\prime} ,k)=(-p,q-p)$, respectively.

Term 2. Writing Term 2 from Equation (B4) in terms of orbital elements, we obtain

Equation (B11)

Indirect terms arising from Term 2 will contribute to the amplitudes of Equation (11) for cosine arguments satisfying

Equation (B12)

where m = 0, 1, 2, and $k,k^{\prime} \ne 0$. The corresponding indirect amplitudes are given by

Equation (B13)

Term 2 contributes indirect terms to the cosine amplitudes ${\tilde{C}}_{(p,q-p,p-q+1,1-p,m-2,-m)}^{{\boldsymbol{\nu }}}$ associated with p:pq resonances for $(k^{\prime} ,k)=(p,q-p)$ and the amplitudes ${\tilde{C}}_{(p,q-p,p-q-1,-1-p,2-m,m)}^{{\boldsymbol{\nu }}}$ for $(k^{\prime} ,k)=(-p,p-q)$.

Appendix C: Relating Orbital-element and Canonical-variable Expansions

In this appendix, we derive expressions for the coefficients ${C}_{{\boldsymbol{k}}}^{{\boldsymbol{\nu }},{\boldsymbol{l}}}(\alpha )$, expressing the expansion of the disturbing function in terms of canonical variables, in terms of the coefficients ${\tilde{C}}_{{\boldsymbol{k}}}^{{\boldsymbol{\nu }}}(\alpha )$ that express the disturbing function's expansion in orbital elements. In order to do so, we proceed in two steps: First, in Section C.1, we express the disturbing function expansion in terms of the complex variables Xi , Xj , Yi , and Yj , which are related to celmech's default set of canonical variables according to ${X}_{i}=\sqrt{\tfrac{1}{{{\rm{\Lambda }}}_{i,0}}}({\kappa }_{i}-i{\eta }_{i})$ and ${Y}_{i}=\tfrac{1}{2}\sqrt{\tfrac{1}{{{\rm{\Lambda }}}_{i,0}}}({\sigma }_{i}-i{\rho }_{i})$. Then, in Section C.2, we expand the resulting expressions from Section C.1 in terms of δi = (Λi − Λi,0)/Λi,0 and δj .

C.1. Relating z and ζ Expansion to X and Y Expansion

Let us define the new variables ${\hat{X}}_{i}\equiv {\left(1+{\delta }_{i}\right)}^{1/2}{X}_{i}$ and ${\hat{Y}}_{i}\equiv {\left(1+{\delta }_{i}\right)}^{1/2}{Y}_{i}$ so that ${z}_{i}={\hat{X}}_{i}{\left(1-\tfrac{1}{4}| {\hat{X}}_{i}{| }^{2}\right)}^{1/2}$ and ${\zeta }_{i}={\hat{Y}}_{i}{\left(1-\tfrac{1}{2}| {\hat{X}}_{i}{| }^{2}\right)}^{-1/2}$ (see Equations (14) and (15)) along with the new disturbing function expansion coefficients ${\hat{C}}_{{\boldsymbol{k}}}^{{\boldsymbol{\nu }}}({\alpha }_{{ij}})$ that satisfy

Equation (C1)

where we assume here and throughout this appendix that km ≥ 0 for m = 3,...,6. 15 In order to obtain explicit expressions for the coefficients ${\hat{C}}_{{\boldsymbol{k}}}^{{\boldsymbol{\nu }}}({\alpha }_{{ij}})$, we write the monomial ${z}_{i}^{{k}_{3}}{\zeta }_{i}^{{k}_{5}}| {\zeta }_{i}{| }^{2{\nu }_{1}}| {z}_{i}{| }^{2{\nu }_{3}}$ in terms of variables ${\hat{X}}_{i}$ and ${\hat{Y}}_{i}$ as

Equation (C2)

where the coefficients

are obtained by expanding the factors ${\left(1-\tfrac{1}{4}| {\hat{X}}_{i}{| }^{2}\right)}^{| {k}_{3}| /2+{\nu }_{1}}$ and ${\left(1-\tfrac{1}{2}| {\hat{X}}_{i}{| }^{2}\right)}^{-| {k}_{5}| /2-{\nu }_{3}}$ in the first line of Equation (C2) and collecting terms $\propto | {\hat{X}}_{i}{| }^{2n}$. Using Equation (C2), we can write the individual terms appearing in the sum on the left-hand side of Equation (C1) in terms of the variables ${\hat{X}}_{i},{\hat{Y}}_{i},{\hat{X}}_{j}$, and ${\hat{Y}}_{j}$ as

Equation (C3)

Collecting terms in Equation (C3) with N3 = ν3 + n and N4 = ν4 + n, we arrive at the following expression relating ${\hat{C}}_{{\boldsymbol{k}}}^{{\boldsymbol{\nu }}}({\alpha }_{{ij}})$ to the coefficients ${\tilde{C}}_{{\boldsymbol{k}}}^{{\boldsymbol{\nu }}}({\alpha }_{{ij}})$:

Equation (C4)

C.2. Expansion in δi and δj

To derive explicit expressions for the coefficients ${C}_{{\boldsymbol{k}}}^{{\boldsymbol{\nu }},({l}_{1},{l}_{2})}$ in terms of ${\hat{C}}_{{\boldsymbol{k}}}^{{\boldsymbol{\nu }}}$, we write out the δi and δj dependence of the terms appearing in the sum on the right-hand side of Equation (C4) explicitly as

Equation (C5)

Accordingly, we may write

Equation (C6)

where pi = ∣k3∣ + ∣k5∣ + 2ν1 + 2ν3 and pj = 4 + ∣k4∣ + ∣k6∣ + 2ν2 + 2ν4. For the case l1 = l2 = 0, from Equation (C6), we simply have ${C}_{{\boldsymbol{k}}}^{{\boldsymbol{\nu }},(0,0)}({\alpha }_{{ij},0})={\hat{C}}_{{\boldsymbol{k}}}^{{\boldsymbol{\nu }}}({\alpha }_{{ij},0})$. More generally, an explicit expression of ${C}_{{\boldsymbol{k}}}^{{\boldsymbol{\nu }},({l}_{1},{l}_{2})}({\alpha }_{{ij},0})$ in terms of ${\hat{C}}_{{\boldsymbol{k}}}^{{\boldsymbol{\nu }}}$ and its derivatives can be derived by applying the product rule for derivatives along with di Bruno's formula (e.g., Johnson 2002) generalizing the chain rule to higher derivatives to Equation (C6). A tedious but straightforward calculation yields

where

(x)k x(x − 1)...(xk + 1), and

with Bn,k denoting partial Bell polynomials.

Footnotes

  • 4  

    A limited version of TRIP is available as a binary at www.imcce.fr/Equipes/ASD/trip.

  • 5  

    We modify the notation of Murray & Dermott (1999) slightly by subscripting the inner and outer planet's variables by their indices, and labeling their fi as ${f}_{i}^{(j)}(\alpha )$ to make explicit the coefficients' dependence on the semimajor axis ratio α1,2 = a1/a2 and the coefficient, j, multiplying the outer planet's mean longitude, λ2, in the cosine argument.

  • 6  

    Strictly speaking, Hamiltonian (Equation (6)) should also include the term $-\tfrac{{\tilde{{\boldsymbol{r}}}}_{0}}{{M}_{* }}\cdot {\sum }_{i\ne 0}{\tilde{{\boldsymbol{r}}}}_{i}$ where ${\tilde{{\boldsymbol{r}}}}_{0}$ is the total momentum of the system and is conjugate to the canonical coordinate r 0 = u * (see, e.g., Equation (27) of Hernandez & Dehnen (2017)). This term is necessary to derive the correct canonical equation of motion for r 0 but is not needed to get the correct canonical equations for r i with i > 0 because ${\tilde{{\boldsymbol{r}}}}_{0}\equiv 0$. The time evolution of r 0 can be calculated without explicitly integrating its equation of motion by noting that ${{\boldsymbol{r}}}_{0}=-{\sum }_{i=1}^{N-1}{m}_{i}{{\boldsymbol{r}}}_{i}/({M}_{* }+{\sum }_{i=1}^{N-1}{m}_{i})$.

  • 7  

    Different literature sources use different names for these canonical variables. Murray & Dermott (1999) refer to these variables as "Poincaré" variables whereas Morbidelli (2002) refers to these variables as modified Delaunay variables and reserves the name "Poincaré" variables for the set of canonical variables introduced in Equation (9).

  • 8  

    Note that our definition of the indirect disturbing function, ${{ \mathcal R }}_{\mathrm{ind}.}$, differs from Murray & Dermott (1999) because we formulate our equations of motion in terms of canonical heliocentric variables. Murray & Dermott (1999) formulate equations in terms of heliocentric position and velocity vectors that do not constitute canonically conjugate variable pairs. Consequently, their formulation of the equations of motion requires different indirect terms to be computed depending on whether a planet is subject to an interior or exterior perturber.

  • 9  
  • 10  

    The reference semimajor axes ai0 occurring in Equation (21), both explicitly as well as implicitly via the variables αij and δi , are stored as parameters of the PoincareHamiltonian object as parameters in the H_params attribute. The reference semimajor axis values are set to the instantaneous semimajor axes of the particles at the time when the PoincareHamiltonian is initialized. Users should be aware that altering the values of the ai0 parameters stored by a PoincareHamiltonian object will not automatically update the values of the Λi,0 or the disturbing function coefficient parameters stored by a PoincareHamiltonian object. The simplest way to update all parameters depending on the reference semimajor axes in a self-consistent fashion is initialize a new PoincareHamiltonian object from a set of particles possessing instantaneous semimajor axes equal to the desired reference values.

  • 11  

    It is the user's responsibility to ensure that the supplied rules actually constitute a canonical change of variables, but the method test_canonical() can be used to test whether the supplied rules constitute a canonical transformation.

  • 12  

    The qp attribute of a Hamiltonian object is actually just a shortcut for Hamiltonian.state.qp where Hamiltonian.state is the PhaseSpaceState object representing the state of the system. See Section 5.1.

  • 13  
  • 14  

    Note that the coefficients ${N}_{k,\sigma }^{0,1}$ are not equivalent to the "Newcomb operators" defined in Hughes (1981) and Murray & Dermott (1999) and denoted as ${X}_{c,d}^{a,b}$. Rather, the coefficients ${N}_{k,\sigma }^{0,1}$ are related to the Newcomb operators according to ${N}_{k,\sigma }^{0,1}={X}_{k-1+\sigma ,\sigma }^{0,1}$ for k ≥ 1 and ${N}_{k,\sigma }^{0,1}={X}_{\sigma ,1-k+\sigma }^{0,1}$ for k < 1.

  • 15  

    Whenever any km < 0, the appropriate replacements ${Z}^{{k}_{m}}\to {\bar{Z}}^{-{k}_{m}}$ should be made, where Z stands for one of Xi , Xj , Yi , or Yj .

Please wait… references are loading.
10.3847/1538-3881/ac8d01