I'm trying to perform nth-Order Legendre-Gauss Quadrature on an integral of mine. The algorithm I've written for the quadrature works on simple integrals, like the following.
However, the problem I'd like to solve is particularly ugly and the results from quadrature don't converge no matter how high in n I go (I've gone to 256th order!). The results are (seemingly) random across several orders of magnitude. I'm wondering if anyone has any insight into this issue and might have ideas on how to attack it.
The integral is used to calculate the intensity in x-ray diffraction of a lattice of atoms. The lattice is perfect except for a collection of dislocations. There are five types of dislocations detailed below, indexed by , which have an associated Burger's vector, , and gives a displacement vector on the lattice. Only the z-component of the displacement vector, here defined as is needed. Note that is a physical parameter (a constant for the lattice) called Poisson's ratio, are also constants.
Now, the total (z-component of the) displacement vector in the lattice is
is the number of -type disolcations, and is the intersection of the th -type dislocation with the sample surface.
Finally, we can get to the integral. and are vectors that are constant in space, is the sample's thickness, and is the coherent area, which is simplified as a rectangle bounded by .
Why doesn't the quadrature work on my integral?!! I've outlined Gauss Quadrature below.
An integral of the function can (in theory) be approximated by the following. are the roots of the nth Legendre polynomial, and are the associated weights.