Is there an algorithm or formula to find the alignment of multiple points?

928 Views Asked by At

Dear math stackexchange community,

Is there a way to calculate the alignment of multiple points? If this is a broad question, think of planets, it is the same principle.

Example:

Given three points {B,C,D} with each the same circumference. (in the picture below they all have different diameters, but it is just for visual purposes)

Let's use the universe as inspiration and assume that the closer the point is to the center (or sun), in this example {A}. The closer it is, the faster it goes:

B increments with 3 (degrees, steps, you name it...)

C increments with 2

D increments with 1

How many steps/rotations/etc. will it take for {B,C,D} to be aligned (to have the same value)?

enter image description here

So wanted result:

enter image description here

I have programmed this in Python, but I'm looking for a formula or way to predict it, without having the program iterate (looping) forever so to speak...

Any ideas or suggestions are welcome, thanks!

1

There are 1 best solutions below

4
On

It was late when I left that comment and I was heading to bed, so I hadn't thought beyond the general idea. The chinese remainder theorem is only applicable to a limited number of cases. More generally, one has to solve a system of linear Diophantine equations.

Label the points $1$ to $k$, and let $x_i(t)$ be the position of the $i$-th point at time $t$, in revolutions. Thus as the point moves around the circle, $x_i$ raises from $0$ to $1$, except that after a full revolution where it would be $1$, instead it drops back to $0$.

Now at $t = 0$, each of the points is in some known starting position $r_i := x_i(0)$. And each point is moving at its own constant speed $s_i$. Therefore, $$x_i(t) \equiv r_i + s_it \mod 1$$

$x_i(t)$ will be the same for all $i$ when the points are aligned. By subtracting the $k$-th equivalence from the others, we have at the alignment

$$(s_i - s_k)t \equiv r_k - r_i \mod 1$$ for all $i < k$.

Now suppose that all the values are rational numbers. If we multiply each of these equivalences by its least common denominator $n_i$, we have: $$m_it \equiv a_i \mod n_i$$for all $i < k$, where $m_i = n_i(s_i - s_k)$ and $a_i = n_i(r_k - r_i)$.

By solving this system of linear Diophantine equations, you can find the times $t$ where your points are aligned.


This also works when all of the $s_i, r_i$ are rational multiples of the same irrational number $\xi$. But if there at least 3 points and the ratios of the various speeds and initial positions are not rational, then it is quite possible that the points will never exactly align. But since you can find rational approximations to irrational numbers to any desired precision, you can still use the rational method above to find near-alignments.