Thu Sep 6 13:17:31 CEST 2012

Approximation of error analysis

\sum_k exp(i 2 \pi ceil(k p /q) / p) - exp(i 2 \pi k / q)

The second term is zero when summed over k:1->q so the above gives an
exact form for the first harmonic of the approximation.

If p is large, the two angles are similar and a linear approximation
can be used:

   exp(i a) - exp (i b) = exp(i b) * (exp (i (a - b)) - 1)
                       ~= exp(i b) * i (a - b)

This then gives:

\sum_k exp(i 2 \pi k / q) * (i 2 \pi) * (1/p) * fract(k p / q)

where fract(x) = ceil(x)-x

Note this is another DFT 1st harmonic expression for period q.

It's not easy to see how this can be approximated by a constant.  The
1/p factor already gives the 1/p characteristic we're looking for, so
the rest should somehow be 

The fract (k p / q) signal is also fairly regular.

It has to be periodic with period q, so there should be a
straightforward way to compute this.

With r = p mod q, this is the same as fract (k r / q).  I.e. q = 3, r
= 2, this gives the sequence:  2/3, 1/3, 0.

So it seems that depending on the input constant, all cases will be
covered.  Next: closed form (approximate) formula?