Lurker News

Comments (491) 209 threads

Show all comments

Showing thread 46 of 209

drjesusphd3 replies#
Gaussian integration.

You might have heard of "2nd order" or "4th order methods to calculate an integral. This means that the error drops off with the number of sampling points like N^-2 or N^-4, respectively. But Gaussian quadrature has spectral accuracy, which transcends this measure. Error goes down like an exponential of N.
Another neat feature is polynomials of degree 2N-1 or less are integrated exactly with this method. So if you have just 10 sampling points, you can calculate exactly the integral of a 19th order polynomial (times, perhaps, some known weighting function).

blt1 reply#
what?? the solution set is infinite, how does it choose?
stabbles#
This is a bit misleading. If the integrand is analytic, then the Gauss quadrature converges geometrically.

For example with f(x) = sqrt(1 + sin(x)) and you approximate integral f(x) dx from -1 to 1 with n Gauss points, then the the convergence is geometric:

    n | approx
    1 | 2.0-------------
    2 | 1.9172----------
    3 | 1.917703--------
    4 | 1.917702153-----
    5 | 1.917702154417--
    6 | 1.91770215441681
But with a function that is not differentiable such as g(x) = |x|, there is definitely not geometric convergence.

      n | approx
      1 | 0.0-----------
     10 | 1.007---------
    100 | 1.00008-------
   1000 | 1.0000008-----