# 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.

• @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 – caverac Oct 12 '17 at 20:52
• @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 – caverac Oct 12 '17 at 21:50