# How to identify binary stars in $N$-body simulation?

Binary stars constitute a significant portion of the stars of a globular cluster.

I would like to verify that this is true in my $N$-body simulation, but I don't know how to decide whether a star in the system is a binary.

Visually this is easy to do, as binaries are identified as two stars at very close distance orbiting about their center of mass, but I need a mathematical condition which I can then translate to code.

## 1 Answer

You'd need to calculate the binding energy of pairs of particles in your simulation. If for a pair this energy is negative then the pair is bound forming a binary system.

I assume you already have an effective way of calculating the potential, so this should not add much more execution time, since you just need to check for points that are close enough

• Is this condition strict enough? What if there are two stars not very close to each other but each moving slowly, so their gravitational potential energy is small (and negative) but the sum of their kinetic energies could be even smaller in absoute value. Secondly, how do I threshold distance between stars below which I should check for binaries. Oct 12, 2017 at 19:39
• @JoshuaBenabou They are bound even in your example. I guess you could start with a fraction of the number $\Sigma^{-1/2}$, where $\Sigma$ is the mass surface density and see how that works out. Measure the number, increase the threshold, measure the number again, increase the threshold again until you reach convergence Oct 12, 2017 at 20:52
• upon second thought: the energy condition is neccessary and sufficient, i.e I don't need to care about the distance between the too points. Morever, from an programming standpoint, I don't see how checking first if the distance between the two stars is close enough would improve computation time: I have a list of n particles, and to check if two particles P and Q are bound, if I check if they are first close enough that is still an operation. In otherwords it will still be O(n^2) to calculate the number of binaries, right? Oct 12, 2017 at 21:42
• @JoshuaBenabou You're right about the first part. But you can search for neighbors in $O(\log n)$, so the execution time will be reduced by a lot if you take care of distant particles first (which are likely not bound). But again, if your $n$ is small, probably you can just do a $O(n^2)$ search and that's it Oct 12, 2017 at 21:50
• My n is 1000 up to 10'000. What o(log n ) search are you referring to? Oct 12, 2017 at 22:27