1 Introduction
Brutus
, we test the reliability of N-body simulations by a controlled numerical experiment which we describe in Section 4. In this experiment we perform a series of resonant 3-body simulations, where the term resonant implies a phase or multiple phases during the interaction where the stars are more or less equidistant (Hut and Bahcall 1983). These phases are intermingled by ejections, where a binary and single star are clearly separated. We perform the simulations with conventional double-precision, and with arbitrary-precision to reach the converged solution. In Section 5, the solutions are compared individually to investigate the distribution of the errors. We also compare the global statistical distributions using two-sample Kolmogorov-Smirnov tests (Kolmogorov 1933; Smirnov 1948).2 Methods
2.1 The benchmark integrator
Hermite
predictor-corrector scheme (Makino and Aarseth 1992), using double-precision arithmetic. The experiments we discuss in Section 4 will use this integrator as a benchmark test. We adopt a shared, adaptive time-stepping scheme with the following criterion:
2.2 The Brutus
N-body code
Brutus
, which uses an arbitrary-precision library.1 With this library we can specify the number of bits, \(L_{\mathrm{w}}\), used to store the mantissa, while the exponent has a fixed word-length. The length of the mantissa can be specified and increased, with the aim of controlling the round-off error.Brutus
.2.3 Method of convergence
Hermite
integrator. After this simulation, we increase \(L_{\mathrm{w}}\), for example to 72 bits (∼22 decimal places), redo the simulation and calculate \(\delta^{2}\). We repeat this procedure until \(\delta< 10^{-p}\). When this is achieved, we have obtained a solution in which the round-off error is below a specified number of decimal places for this particular value of ϵ.3 Validation and performance
3.1 The Pythagorean problem
Hermite
integrator to the converged solution. The different curves belong to different time-step parameters; η = 2−3, 2−5, 2−7 up to 2−13. Note that for a time-step parameter \(\eta< 2^{-9}\), the curve is not shifted to lower values of δ, but even increases again. At this point round-off error becomes important, making the solution less accurate. The final close encounter in the Pythagorean problem occurs around 60 time units, after which a permanent binary and an escaper are formed. The Hermite
integrator is able to accurately reproduce the evolution up to this point, but not subsequently, because δ has increased to values of order unity or higher. This can be explained by a small error in the final close encounter between all three stars, such that the direction of the escaper is slightly different.Hermite
simulation with \(\eta=2^{-9}\). The Hermite
simulation, however, had a slightly different solution and a final, relative energy conservation of 10−8. Decreasing the value of η will improve the level of energy conservation, but due to round-off error δ will not decrease.3.2 The equilateral triangle
Hermite
, which are compared with the most precise Brutus
simulation (with \(\epsilon=10^{-80}\), \(L_{\mathrm{w}}=352\mbox{ bits}\)). The time-step parameter η = 10−1, 10−2, 10−3 and 10−4 for subsequent curves. The Hermite
integrations show a similar behaviour as the Brutus
results, which could imply that the rate of divergence is a physical property of the configuration, rather than a property of the integrator.3.3 A Plummer distribution with \(N=16\)
Brutus
simulation in this example (\(\epsilon=10^{-50}\), \(L_{\mathrm{w}}=232\mbox{ bits}\)), took about a day of wall-clock time, which is about 7,000 times slower than a simulation with Hermite
using \(\eta=2^{-9}\).3.4 Scaling of the wall-clock time
4 Precision of statistical results: experimental setup
Hermite
diverges from the converged solution, even up to the point that the microscopic solution given by Hermite
is beyond recognition. We now perform a statistical study, to examine the hypothesis that double-precision N-body simulations produce statistically indistinguishable results, from those obtained from an ensemble of converged solutions with the same set of initial conditions. Because it is computationally expensive to reach convergence, we start investigating the hypothesis above by exploring the accuracy of 3-body statistics.Hermite
code, using standard double-precision, and with Brutus
, using arbitrary-precision until a converged solution is obtained. At the end of each simulation, we investigate the nature of the binary and the escaper. In addition to the BS tolerance, word-length, CPU time and dissolution time, we record the mass, speed and escape direction of the escaping single star, and the semimajor axis, binding energy and eccentricity of the binary. In this way, we obtain statistics for \(N=3\) generated by a conventional N-body solver and by Brutus
.5 Results
Hermite
and Brutus
, we first compare the Brutus
results with analytical distributions from the literature in order to relate to previous studies. We compare Hermite
and Brutus
on a global level by performing two-sample Kolmogorov-Smirnov tests (Kolmogorov 1933; Smirnov 1948) to see whether global distributions are statistically indistinguishable. We also compare the distribution of lifetimes of triples to see whether precision influences the stability and we measure the typical CPU time and BS tolerance needed to obtain a converged solution. After this, we compare Hermite
and Brutus
per individual system, with the aim of investigating the nature of the differences of every individual outcome. Finally, we define categories which classify a conventional simulation as a preservation or exchange, depending on whether the identity of the escaping star is consistent between Hermite
and Brutus
.5.1 Brutus
versus analytical distributions
α
|
β
| |
---|---|---|
Velocity | ||
Plummer equal mass | 2.5 ± 0.09 | 6.7 ± 1.02 |
Plummer mass ratio | 3.8 ± 0.16 | 4.4 ± 0.43 |
Cold Plummer equal mass | 2.6 ± 0.19 | 3.8 ± 0.28 |
Cold Plummer mass ratio | 3.4 ± 0.45 | 3.4 ± 0.19 |
Kinetic energy | ||
Plummer equal mass | 0.9 ± 0.02 | 1.8 ± 0.04 |
Plummer mass ratio | 0.8 ± 0.02 | 1.6 ± 0.04 |
Cold Plummer equal mass | 0.99 ± 0.02 | 1.3 ± 0.03 |
Cold Plummer mass ratio | 0.98 ± 0.03 | 1.2 ± 0.02 |
Binding energy | ||
Plummer equal mass | 4.31 ± 0.13 | |
Plummer mass ratio | 5.12 ± 0.32 | |
Cold Plummer equal mass | 2.37 ± 0.11 | |
Cold Plummer mass ratio | 2.38 ± 0.12 |
Brutus
are in qualitative agreement with the analytical estimates present in the literature (Heggie 1975; Monaghan 1976; Valtonen and Karttunen 2006). Slight variations are present due to the dependence on total angular momentum, a limited statistical sampling and assumptions made in the derivation of the analytical distributions. Nevertheless, a similar qualitative agreement has been obtained between the analytical distributions discussed above and empirical distributions from an ensemble of conventional numerical solutions, e.g. not converged (Valtonen and Karttunen 2006, Chapters 7-8 and references therein). The question remains to what extend conventional and converged solutions agree quantitatively.5.2 Brutus
versus Hermite
: global comparison
Brutus
distribution with the Hermite
distribution versus time-step parameter η used for Hermite
. In the panel showing the data for the binary semimajor axis, the distributions of the cold systems become significantly different for \(\eta> 2^{-6}\). The distributions from the initially virialised systems start to differ for \(\eta> 2^{-4}\). The cold systems are harder to model accurately, because of the close encounters that occur shortly after the start. The reason the distributions start to become significantly different at large time-steps is because at these large time-steps most simulations violate energy conservation by \(\vert \Delta E/E \vert > 0.1\). When this occurs, solutions might reach regions in 6N-dimensional phase-space, which theoretically are forbidden. The distribution then becomes biased by these outlier solutions.
5.3 Lifetime of triple systems
Brutus
are represented by the data points: equal-mass Plummer (black bullets), Plummer with different masses (red triangles), equal-mass cold Plummer (blue squares) and cold Plummer with different masses (green stars). The results by Hermite
for a time-step parameter \(\eta= 2^{-5}\) are represented by the curves appearing to go through the data points.
Hermite
results. Even though Hermite
and Brutus
use different algorithms and precisions to solve the equations of motion, we find that the lifetime of an unstable triple is statistically indistinguishable between converged Brutus
and non-converged Hermite
solutions (but see also Section 6.3).Brutus
simulations, for the four different initial conditions. The longer it takes for a system to dissolve, the longer the CPU time and the higher the precision needed to reach a converged solution. To reach ∼180 crossing times, there are systems which require a BS tolerance of the order 10−100, with the final converged run taking of the order a few days. The average CPU time as a function of time is about an order of magnitude smaller than the maximum CPU time. The average BS tolerance ranges from ∼10−20 to 10−30. For systems which dissolve within 100 crossing times, Brutus
is on average about a factor 120 slower than Hermite
.
Hermite
and Brutus
are consistent. For our purpose of comparing results from conventional integrators with the converged solution, integrating up to ∼180 crossing times is sufficient, in the sense that there is enough time for conventional solutions to diverge from the true solution (see Section 5.4.1). Including the long-lived triple systems may however influence the statistical distributions and biases on the long term.5.4 Brutus
versus Hermite
: individual comparison
Hermite
and Brutus
. In Figure 9 we show scatter plots of the Hermite
solution (with time-step parameter \(\eta=2^{-5}\)) versus the converged Brutus
solution for the equal-mass Plummer data set.
Hermite
solutions. The diagonal is present in each panel and extends throughout the range of possible outcomes. The width of the diagonal is very narrow. When the normalized phase-space distance between the Hermite
and Brutus
solution \(\delta< 10^{-1}\), then the coordinates are accurate enough to produce derived quantities accurate to at least one decimal place and Hermite
and Brutus
will give similar results. Once \(\delta> 10^{-1}\), the solution has diverged to a different trajectory in phase-space leading to a different outcome. This outcome could in principle be any of the possible outcomes as can be derived from the amount of scatter in the Hermite
solutions at a fixed Brutus
solution.Hermite
and Brutus
agree on the solution in the sense that the data points lie on the diagonal. Systems which dissolve after a short time don’t have sufficient time to accumulate enough error to diverge to another trajectory in phase-space. Once however this level of divergence is reached, the scatter immediately covers the entire, available outcome space. This randomisation is also observed in the other panels.5.4.1 The fraction of accurate solutions
Hermite
time-step parameter, η. We only include the data points for which the normalized phase-space distance \(\delta< 10^{-1}\). For the largest time-step parameters used (\(\eta> 10^{-1}\)) the fraction on the diagonal, or the accurate fraction, varies from zero to about 0.2. By reducing the time-step parameter, the accurate fraction increases until it saturates at about 0.4 to 0.7 depending on the initial conditions. Even though by reducing η, the discretisation error decreases, the number of integration steps increases, which then increases the round-off error. For the data sets with zero angular momentum, the maximum accurate fraction is obtained for \(\eta\sim2^{-9}\). For the initially virialised systems this seems to occur between \(\eta\sim 10^{-3}\mbox{-}10^{-4}\), although the actual saturation point is not visible yet. This dependence on angular momentum is due to the initial cold collapse and subsequent close encounters, which increases the round-off error.
5.4.2 The error distribution
Hermite
makes fewer tight binaries.
Brutus
and Hermite
as random variables drawn from the same distribution, then we can write the variance in a certain statistic, in this example the eccentricity, as:
Brutus
and Hermite
. For a thermal eccentricity distribution (equation (7)), we obtain a standard deviation of \(1/3\). However, this only applies to inaccurate Hermite
results, which had enough time to diverge through outcome space. If we multiply the theoretical standard deviation calculated above by the inaccurate fraction, we obtain a range in the standard deviation from 0.17 to 0.27, as η ranges from the most precise value to \(\eta= 10^{-1}\).5.4.3 Symmetry of the error distribution
Brutus
solution to be converged when at least 3 decimal places of every coordinate have converged. To investigate the symmetry up to higher precision, we repeated a subset of 1,000 simulations. We did this only for the initial conditions with equal-mass stars picked randomly from a virialised Plummer distribution and this time we obtain solutions converged up to the first 15 decimal places.
5.5 Escaper identity
Hermite
and Brutus
individually, by looking at which star eventually becomes the escaper and which form the binary. We define preservation if the Hermite
and the Brutus
solution both have the same star as the escaper. We define it as exchange if the escaping star is different. A further distinction can be made in the preservation category, if the Hermite
simulation is also accurate. We can typify each Hermite
simulation as follows: -
Accurate: The coordinates are accurate, up to at least two digits.
-
Preservation: The coordinates are inaccurate, but same star escapes.
-
Exchange: Different star escapes.
6 Discussion
6.1 Energy conservation
Hermite
solutions there are some that grossly violate conservation of energy \(\vert \Delta E/E \vert > 0.1\). This deformation of the energy hyper-surface in phase-space can allow solutions to reach parts of phase-space which are theoretically forbidden. This affects the global statistical distributions. In Figure 14, we replot the average error in the binary semimajor axis as a function of the time-step parameter. We produce similar diagrams as presented in Figure 11, but this time we introduce a maximum allowed error in the energy. If we filter out simulations with a relative energy conservation \(\vert \Delta E/E \vert > 1\), or \(\vert \Delta E/E \vert > 0.1\), we observe that the bias in the average error of the semimajor axis of the binaries vanishes. We conclude that this bias is caused by a few simulations which grossly violate energy conservation. A similar bias in the velocity of the escaping star is less pronounced.
Brutus
or beyond.6.2 Asymmetry at small errors
Hermite
integrator and a Hermite
integrator which uses the \(P(EC)^{n}\) method (we adopted \(n=3\)) (Kokubo et al. 1998). This last method adds an iterative procedure to the algorithm to improve the predictions and corrections, which improves the time-symmetry. For each method we implement a shared, adaptive time-step criterion as in equation (1), with a time-step parameter \(\eta= 2^{-7}\). As a consequence they will not be time-symmetric nor symplectic.Hermite
loses energy. The Hermite
with the \(P(EC)^{n}\) method produces both positive and negative errors in the energy, but not in a symmetric manner.Brutus
, δE the energy error and δv the error in the velocity due to this energy error. For the binary semimajor axis we obtain:
Brutus
solution. For the eccentricity we obtain:
Brutus
. The error in the eccentricity δe has contributions from errors in the energy δϵ and angular momentum δl.Hermite
results. When we measure which fraction of the energy error is reserved for the binary and which fraction for the escaper, we find that in most cases the error propagates to the binary. For the Leapfrog however, the asymmetry is still present.6.3 Preservation of the macroscopic properties
Brutus
, any other value in the allowed outcome space is reachable for the Hermite
integrator. For example, if the converged solution gives an eccentricity for the binary of 0.6, a diverged solution can produce any eccentricity between 0 and 1. Once the solution has diverged from the true solution, it will start a random walk through or near the allowed phase-space until the 3-body system has dissolved. We observed that this randomisation happens in such a way that the available outcome space is still completely sampled and that it preserves global statistical distributions.Hermite
results in Figure 1). If instead we continue to decrease the precision, there will be a point where biases start to appear. Urminsky (Urminsky 2008) analysed the 3-body Sitnikov problem and showed that the precision of the integration influences the average lifetime of triple systems, contrary to our results. The integration times in our experiment however, are much shorter. Obtaining a converged solution for a resonant 3-body system for longer than 200 crossing times, is still computationally challenging. Therefore any statistical difference on the long term will not be visible in our experiment.7 Conclusion
Brutus
is an N-body code that uses the Bulirsch-Stoer method to control discretisation errors, and arbitrary-precision arithmetic to control round-off errors. By using the method of convergence, where we systematically vary the Bulirsch-Stoer tolerance parameter and the word-length, we can obtain a solution for a particular N-body problem, for which the first p digits in the mantissa are independent of the time-step size and word-length. We call this solution converged to p decimal places.Hermite
integrator and using Brutus
.Hermite
and Brutus
are consistent on the average lifetime of an unstable triple system. However, possible differences on the long term are not visible in this experiment.Hermite
solutions give accurate results, i.e. at most a 1% relative difference compared to Brutus
. For the inaccurate results, the error distribution becomes unbiased and symmetric for a time-step parameter \(\eta\le2^{-5}\) and implementing a maximum level of relative energy conservation of \(\vert \Delta E/E\vert < 0.1\).Hermite
and Brutus
. No significant differences were detected when using the criteria mentioned above for the time-step parameter η and relative energy conservation. This research for the 3-body problem supports the assumption that results from conventional N-body simulations are valid in a statistical sense. We observed however that a bias is introduced for the smallest errors, if the algorithm used to solve the equations of motion, is biased in the conservation of energy and angular momentum. In this research however, this bias did not have an appreciable effect. It is important to see whether this remains true for statistics of higher-N systems or systems with a dominant mass. An example of a higher-N system where precision might play a role is a young star cluster (without gas) going through the process of cold collapse (Caputo et al. 2014). At the moment of deepest collapse, a fraction of stars will obtain large accelerations, so that a small error in the acceleration can cause large errors in the position and velocity. The rate of divergence can increase up to about 5 digits per Hénon time unit for 128 particles and it increases with N.Acknowledgements
Competing interests
Authors’ contributions
Brutus
N-body code, participated in designing the experiments, performed the N-body simulations, gathered the results from the simulations, interpreted the results and wrote the major part of the manuscript. SPZ thought of the concept of the Brutus
code, participated in designing the experiments, interpreted the results and helped to draft the manuscript. All authors read and approved the final manuscript.