Trap rule error in periodic functions

            Any function that has all derivatives at its beginning, t=0, equal to all derivatives at its end, t=T, can be expanded as a periodic function.

            A periodic function can always be expanded as

                                           

Note that cj is complex and that

                                   

Since the first exponential is always 1.  The integral from 0 to T of f is

                 

The value of the integral is given by the c0 term alone.  All other terms in the expansion integrate to zero. 

Let  so that the midpoint trap rule approximation to this integral is

               

Note the interchange of summation orders.   Let , so that

     

The last term can be written as a sum of zk and we can use the familiar relation for z¹1

                                   

So that                     

Note that  so that the numerator in is always zero.  The denominator is also zero for j=mN for which .  In this case the last sum in is N so that

              

            The terms that enter are not uniform.  If for some accidental reason c10 = 0, 10 point integration will seem exact up to c20.  Changing N from 10 to 20 will give a false accuracy reading.  The correct change is from 10 to 11 or 13, Do not simply double the points.