Assignment -a

Write a code to evaluate an integral of a Lorentzian from A to B – use Richardson.htm.

-- Note that the analytical anti-derivative is In G/R p.60

Trap rule error in periodic functions

                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

                  

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

Let  so that the mid point trap rule approximation to this integral is

               

note 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

            

                Note 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.  --- Press pay attention.

Assignment -b

            Evaluate  Using various integration points ranging from N=m/2 to N=4m.  Plot the integration error as a function of 1/N2.  If the method “breaks” plot the details where it breaks.