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











up vote
3
down vote

favorite












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!










share|cite|improve this question






















  • If the speeds are rational fractions of the circumferences, then you are looking for the Chinese Remainder Theorem. If any of the speeds is an irrational fraction, then they may never perfectly align, but they will still occasionally come very close.
    – Paul Sinclair
    Nov 21 at 4:43












  • @Paul Sinclair Could you elaborate on this please?
    – Eli
    Nov 21 at 23:49















up vote
3
down vote

favorite












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!










share|cite|improve this question






















  • If the speeds are rational fractions of the circumferences, then you are looking for the Chinese Remainder Theorem. If any of the speeds is an irrational fraction, then they may never perfectly align, but they will still occasionally come very close.
    – Paul Sinclair
    Nov 21 at 4:43












  • @Paul Sinclair Could you elaborate on this please?
    – Eli
    Nov 21 at 23:49













up vote
3
down vote

favorite









up vote
3
down vote

favorite











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!










share|cite|improve this question













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!







circle rotations






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Nov 20 at 20:10









Eli

1534




1534












  • If the speeds are rational fractions of the circumferences, then you are looking for the Chinese Remainder Theorem. If any of the speeds is an irrational fraction, then they may never perfectly align, but they will still occasionally come very close.
    – Paul Sinclair
    Nov 21 at 4:43












  • @Paul Sinclair Could you elaborate on this please?
    – Eli
    Nov 21 at 23:49


















  • If the speeds are rational fractions of the circumferences, then you are looking for the Chinese Remainder Theorem. If any of the speeds is an irrational fraction, then they may never perfectly align, but they will still occasionally come very close.
    – Paul Sinclair
    Nov 21 at 4:43












  • @Paul Sinclair Could you elaborate on this please?
    – Eli
    Nov 21 at 23:49
















If the speeds are rational fractions of the circumferences, then you are looking for the Chinese Remainder Theorem. If any of the speeds is an irrational fraction, then they may never perfectly align, but they will still occasionally come very close.
– Paul Sinclair
Nov 21 at 4:43






If the speeds are rational fractions of the circumferences, then you are looking for the Chinese Remainder Theorem. If any of the speeds is an irrational fraction, then they may never perfectly align, but they will still occasionally come very close.
– Paul Sinclair
Nov 21 at 4:43














@Paul Sinclair Could you elaborate on this please?
– Eli
Nov 21 at 23:49




@Paul Sinclair Could you elaborate on this please?
– Eli
Nov 21 at 23:49










1 Answer
1






active

oldest

votes

















up vote
1
down vote













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.






share|cite|improve this answer





















  • Even in the case where the values are all rational numbers, the possibility of alignment will depend on the starting positions. In general, we can never expect precise alignment of three or more points, unless the starting positions are special.
    – TonyK
    Nov 22 at 1:41










  • @TonyK - yes, I left the conditions for solutions to exist to the wikipedia article. However, if you were to choose the rational values uniformly from a large sample of rational values, the odds of picking choices with no solution are low. (However, from a small sample, such as we usually use when making examples, it is quite easy to find one with no solutions.)
    – Paul Sinclair
    Nov 22 at 1:48












  • Hmm interesting, and how exactly would it work using the chinese remainder theorem?
    – Eli
    Nov 22 at 6:16










  • @Eli - I started out by noting that the chinese remainder theorem is only useful in a limited number of cases. If $m_i$ is relatively prime to $n_i$, then it has a modular inverse - that is, an integer $m_i'$ such that $m_i'm_i equiv 1 mod n_i$, which allows you to rewrite the $i$-th condition as $t equiv m_i'a_i mod n_i$. If this is true for all $i < k$, then you can use the chinese remainder theorem to find the solution. If not, then you will need the more general techniques discussed in the link.
    – Paul Sinclair
    Nov 22 at 14:07











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3006823%2fis-there-an-algorithm-or-formula-to-find-the-alignment-of-multiple-points%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote













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.






share|cite|improve this answer





















  • Even in the case where the values are all rational numbers, the possibility of alignment will depend on the starting positions. In general, we can never expect precise alignment of three or more points, unless the starting positions are special.
    – TonyK
    Nov 22 at 1:41










  • @TonyK - yes, I left the conditions for solutions to exist to the wikipedia article. However, if you were to choose the rational values uniformly from a large sample of rational values, the odds of picking choices with no solution are low. (However, from a small sample, such as we usually use when making examples, it is quite easy to find one with no solutions.)
    – Paul Sinclair
    Nov 22 at 1:48












  • Hmm interesting, and how exactly would it work using the chinese remainder theorem?
    – Eli
    Nov 22 at 6:16










  • @Eli - I started out by noting that the chinese remainder theorem is only useful in a limited number of cases. If $m_i$ is relatively prime to $n_i$, then it has a modular inverse - that is, an integer $m_i'$ such that $m_i'm_i equiv 1 mod n_i$, which allows you to rewrite the $i$-th condition as $t equiv m_i'a_i mod n_i$. If this is true for all $i < k$, then you can use the chinese remainder theorem to find the solution. If not, then you will need the more general techniques discussed in the link.
    – Paul Sinclair
    Nov 22 at 14:07















up vote
1
down vote













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.






share|cite|improve this answer





















  • Even in the case where the values are all rational numbers, the possibility of alignment will depend on the starting positions. In general, we can never expect precise alignment of three or more points, unless the starting positions are special.
    – TonyK
    Nov 22 at 1:41










  • @TonyK - yes, I left the conditions for solutions to exist to the wikipedia article. However, if you were to choose the rational values uniformly from a large sample of rational values, the odds of picking choices with no solution are low. (However, from a small sample, such as we usually use when making examples, it is quite easy to find one with no solutions.)
    – Paul Sinclair
    Nov 22 at 1:48












  • Hmm interesting, and how exactly would it work using the chinese remainder theorem?
    – Eli
    Nov 22 at 6:16










  • @Eli - I started out by noting that the chinese remainder theorem is only useful in a limited number of cases. If $m_i$ is relatively prime to $n_i$, then it has a modular inverse - that is, an integer $m_i'$ such that $m_i'm_i equiv 1 mod n_i$, which allows you to rewrite the $i$-th condition as $t equiv m_i'a_i mod n_i$. If this is true for all $i < k$, then you can use the chinese remainder theorem to find the solution. If not, then you will need the more general techniques discussed in the link.
    – Paul Sinclair
    Nov 22 at 14:07













up vote
1
down vote










up vote
1
down vote









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.






share|cite|improve this answer












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.







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered Nov 22 at 1:32









Paul Sinclair

19.1k21440




19.1k21440












  • Even in the case where the values are all rational numbers, the possibility of alignment will depend on the starting positions. In general, we can never expect precise alignment of three or more points, unless the starting positions are special.
    – TonyK
    Nov 22 at 1:41










  • @TonyK - yes, I left the conditions for solutions to exist to the wikipedia article. However, if you were to choose the rational values uniformly from a large sample of rational values, the odds of picking choices with no solution are low. (However, from a small sample, such as we usually use when making examples, it is quite easy to find one with no solutions.)
    – Paul Sinclair
    Nov 22 at 1:48












  • Hmm interesting, and how exactly would it work using the chinese remainder theorem?
    – Eli
    Nov 22 at 6:16










  • @Eli - I started out by noting that the chinese remainder theorem is only useful in a limited number of cases. If $m_i$ is relatively prime to $n_i$, then it has a modular inverse - that is, an integer $m_i'$ such that $m_i'm_i equiv 1 mod n_i$, which allows you to rewrite the $i$-th condition as $t equiv m_i'a_i mod n_i$. If this is true for all $i < k$, then you can use the chinese remainder theorem to find the solution. If not, then you will need the more general techniques discussed in the link.
    – Paul Sinclair
    Nov 22 at 14:07


















  • Even in the case where the values are all rational numbers, the possibility of alignment will depend on the starting positions. In general, we can never expect precise alignment of three or more points, unless the starting positions are special.
    – TonyK
    Nov 22 at 1:41










  • @TonyK - yes, I left the conditions for solutions to exist to the wikipedia article. However, if you were to choose the rational values uniformly from a large sample of rational values, the odds of picking choices with no solution are low. (However, from a small sample, such as we usually use when making examples, it is quite easy to find one with no solutions.)
    – Paul Sinclair
    Nov 22 at 1:48












  • Hmm interesting, and how exactly would it work using the chinese remainder theorem?
    – Eli
    Nov 22 at 6:16










  • @Eli - I started out by noting that the chinese remainder theorem is only useful in a limited number of cases. If $m_i$ is relatively prime to $n_i$, then it has a modular inverse - that is, an integer $m_i'$ such that $m_i'm_i equiv 1 mod n_i$, which allows you to rewrite the $i$-th condition as $t equiv m_i'a_i mod n_i$. If this is true for all $i < k$, then you can use the chinese remainder theorem to find the solution. If not, then you will need the more general techniques discussed in the link.
    – Paul Sinclair
    Nov 22 at 14:07
















Even in the case where the values are all rational numbers, the possibility of alignment will depend on the starting positions. In general, we can never expect precise alignment of three or more points, unless the starting positions are special.
– TonyK
Nov 22 at 1:41




Even in the case where the values are all rational numbers, the possibility of alignment will depend on the starting positions. In general, we can never expect precise alignment of three or more points, unless the starting positions are special.
– TonyK
Nov 22 at 1:41












@TonyK - yes, I left the conditions for solutions to exist to the wikipedia article. However, if you were to choose the rational values uniformly from a large sample of rational values, the odds of picking choices with no solution are low. (However, from a small sample, such as we usually use when making examples, it is quite easy to find one with no solutions.)
– Paul Sinclair
Nov 22 at 1:48






@TonyK - yes, I left the conditions for solutions to exist to the wikipedia article. However, if you were to choose the rational values uniformly from a large sample of rational values, the odds of picking choices with no solution are low. (However, from a small sample, such as we usually use when making examples, it is quite easy to find one with no solutions.)
– Paul Sinclair
Nov 22 at 1:48














Hmm interesting, and how exactly would it work using the chinese remainder theorem?
– Eli
Nov 22 at 6:16




Hmm interesting, and how exactly would it work using the chinese remainder theorem?
– Eli
Nov 22 at 6:16












@Eli - I started out by noting that the chinese remainder theorem is only useful in a limited number of cases. If $m_i$ is relatively prime to $n_i$, then it has a modular inverse - that is, an integer $m_i'$ such that $m_i'm_i equiv 1 mod n_i$, which allows you to rewrite the $i$-th condition as $t equiv m_i'a_i mod n_i$. If this is true for all $i < k$, then you can use the chinese remainder theorem to find the solution. If not, then you will need the more general techniques discussed in the link.
– Paul Sinclair
Nov 22 at 14:07




@Eli - I started out by noting that the chinese remainder theorem is only useful in a limited number of cases. If $m_i$ is relatively prime to $n_i$, then it has a modular inverse - that is, an integer $m_i'$ such that $m_i'm_i equiv 1 mod n_i$, which allows you to rewrite the $i$-th condition as $t equiv m_i'a_i mod n_i$. If this is true for all $i < k$, then you can use the chinese remainder theorem to find the solution. If not, then you will need the more general techniques discussed in the link.
– Paul Sinclair
Nov 22 at 14:07


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3006823%2fis-there-an-algorithm-or-formula-to-find-the-alignment-of-multiple-points%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Wiesbaden

Marschland

Dieringhausen