**Re: number of main axis rotations required for GC**
alanb said:

Say there are two stages, is the periodicity of the resultant path only dependant on the gear ratio's no matter what shapes the individual stages follow?

Yes, provided the shapes are the same for each spindle revolution.

alanb said:

What if both stages follow a sinusoidal path and the frequency of the second is 1/7 of the first does this not affect the resultant path?

So long as there are an integral number of sinusoids per revolution, the shapes shouldn't matter. But if the number of sinusoids per revolution is fractional, then we need to modify the formula. In this case, the figure traced in the second revolution would not overlay the figure from the first revolution. I think that you would add the ratio of the sinusoids per rev to the list of GC ratios, but the number of sinusoids per rev would be expressed as d/n, not n/d. If the number of sinusoids per revolution is irrational, the pattern will never repeat (though there may be places where it gets very close).

In thinking more about this, it looks like I got the original formula wrong...

For the remaining discussion, I'll use n1/d1 for the gear ratios of the first stage GC, and n2/d2 for the second stage GC. I'll assume that these ratios are already in their lowest terms.

Basically to get a complete pattern, we need to bring the headstock index and each of the GC indexes back to their respective starting positions.

To get the headstock index back to the starting position, we simply need an integral number of headstock rotations.

The amount that the first stage GC rotates per headstock rotation is d1/n1 (the headstock index is divided by n1/d1 to get the GC index). Thus, we need n1 headstock rotations to get both the headstock and the first stage GC index back to their starting positions. The shape that the GC follows shouldn't matter.

After n1 headstock rotations, the first stage GC will have rotated d1 revolutions. For the second stage GC to get back to its starting point, the first stage has to rotate a multiple of n2. To get both stages back to their starting positions simultaneously, we need some integer I such that I * d1 is a multiple of n2. Thus I is n2/gcd(n2, d1) and the total number of headstock rotations to get back to the starting point is I * n1 or n1 * n2 / gcd(n2, d1).

The following procedure should generalize this to N GC stages:

Code:

```
def num_headstock_rotations(sequence_of_n_d):
N = 1
D = 1
for n, d in sequence_of_n_d:
divisor = gcd(n, D)
N *= n / divisor
D = D / divisor * d
return N
```