Suppose we have a moon $M$ following a circular orbit (with radius $R_M$) around a planet $P$, which is in turn following a circular orbit (with radius $R_P$) around a star $S$. The angular velocity of $M$ around $P$ is given to be $\omega_M$ and the angular velocity of $P$ around $S$ is given to be $\omega_P$. Then $M$ will trace out an epicycle $$p(t)=\left\langle R_P\cos\left(\omega_P\,t\right)+R_M\cos\left(\omega_M\,t\right),\,R_P\sin\left(\omega_P\,t\right)+R_M\sin\left(\omega_M\,t\right)\right\rangle$$
I am trying to represent this epicycle as an epitrochoid (EDIT: by which I mean that $M$ does not need to lie on the circumference of the rolling circle) (assuming both angular velocities to be positive), where the fixed circle centered at $S$ has radius $R$ and the rolling circle centered at $P$ has radius $r$. So I must relate $R$ and $r$ to the given values. Clearly, $R=R_P-r$.
Suppose a time $t$ as passed, and $P$ has revolved through an angle $\theta$ around $S$ and $M$ has revolved through an angle $\phi$ around $P$. By the construction of an epitrochoid (rolling without slipping), we have that $R\theta=r\phi$. Now, since $\displaystyle t=\frac{\theta}{\omega_P}=\frac{\phi}{\omega_M}$, we have that $R\omega_P=r\omega_M$. So $$\displaystyle R=\frac{R_P\omega_M}{\omega_M+\omega_P},\;r=\frac{R_P\omega_P}{\omega_M+\omega_P}$$
A similar working out can be done if one of the angular velocities is negative and the other is positive, though the curve would be a hypotrochoid.
Except, this doesn't work. When I tested this out in GeoGebra I found that the arc lengths "rolled" did not equal each other, that is, there was slippage while rolling. The actual epitrochoid corresponding to $R$, $r$, and $R_M$ did not match the epicycle. What have I done wrong?
UPDATE: I have been messing around in GeoGebra further and found that the actual value for $R$ in the above example (where $R_P=4$, $R_M=1$, $\omega_P=\frac{\pi}{3}$, and $\omega_M=\frac{7\pi}{6}$) is about 2.8572. I have tried further decimal approximations but could not find a fraction with the value.
Furthermore when $R_P=4$, $R_M=1$, $\omega_P=1$, and $\omega_M=4$, then $R$ is exactly 3.
Unfortunately I cannot find a formula which produces both of these answers using the given values.
Best Answer
The issue is that $\displaystyle t\not=\frac{\phi}{\omega_M}$. Because the rolling circle is also revolving around the center of the fixed circle, we have to account for both effects, so $\displaystyle t=\frac{\phi}{\omega_M-\omega_P}$. This means that $\displaystyle R\omega_P=r\left(\omega_M-\omega_P\right)$, so $$\displaystyle R=\frac{R_P\left(\omega_M-\omega_P\right)}{\omega_M},\,r=\frac{R_P\omega_P}{\omega_M}$$