Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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).



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-----



what?? the solution set is infinite, how does it choose?


Right!? Such is the magic of orthogonal polynomials. If one chooses the integration grid to lie at zeros of the appropriate orthogonal polynomial, information is gained.

https://en.wikipedia.org/wiki/Gaussian_quadrature




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: