0

I have two points A & B rotating around some pivot P.

They start at 12 o'clock and start rotating clockwise around P simultaneously with different constant velocities ($s_A$ and $s_B$). The speed of $1$ is exactly 1 circle per second.

I'm treating their angles as two functions of time:

$$ \left\{ \begin{array}{c} f_A(t) = t \cdot s_A \mod{1} \\ f_B(t) = t \cdot s_B \mod{1} \end{array} \right. $$

Desmos image https://www.desmos.com/calculator/23tuf1qmhw

Given some time $t_{input}$, how to calculate how many times did the two points overlap ($f_A = f_B$) in range $t \in [0;t_{input}]$?

Additional meta-question: what is the correct mathematical notation to describe the function (that I'm looking for) in above sentence in one formula?

I've been staring at those functions and cannot come up with a solution.

Sorry if there are any oversights in my formulas or statements - I'm new to TeX, so please let me know if I should change anything.

Thanks in advance.

  • Since you asked about notation--generally we only speak of modular arithmetic when dealing with integers. (I know Desmose lets you do it anyway.) This would be more suited to using sine waves. Then you calculate the number of full wavelengths that have passed for each one and subtract; there will be some rounding that will need to be done at the end though. – Eric Snyder Dec 09 '22 at 22:30

1 Answers1

1

Assume $s_A < s_B$. (The order doesn't really matter, and if $s_A = s_B$ then the functions obviously intersect for all $t$.)

Define new functions $g_A(t) = s_A t$ and $g_B(t) = s_B t$. (These are the same as $f_A$ and $f_B$ but without the reduction mod 1.) Then for any given $t$, we have $f_A(t) = f_B(t)$ if and only if $g_B(t) - g_A(t) \in \mathbb{Z}$.

Let $h(t) = g_B(t) - g_A(t) = (s_B - s_A) t$, which is a linear function. We care about the behaviour for $t \in [0, T]$. At the endpoints we find $h(0) = 0$ and $h(T) = (s_B - s_A) T$. Since $h$ is a line, we'll hit every value from $0$ to $(s_B - s_A) T$ exactly once. The number of integers in that range is $\mathbf{\big \lfloor (s_B - s_A) T \big \rfloor}$ if we skip counting $t=0$, or one more if we do count $t=0$. (Here $\lfloor \, \rfloor$ denote the floor function.)

Here's a quick example using the numbers from your diagram. We have $s_A = 1.1$ and $s_b = 1.3$, and $T = 18.5$. So the formula says there will be $\big \lfloor (1.3 - 1.1) \cdot 18.5 \big \rfloor = \lfloor 3.7 \rfloor = 3$ intersections not counting $t = 0$. That matches up with what I see in your picture.

David Clyde
  • 5,251
  • 1
    This is a very cool explanation! I didn't think about the difference of un-$mod$-ed functions being $\mathbb{Z}$ - this perfectly makes sense. Thank you! – Andrew Dunai Dec 10 '22 at 12:12