Gaussian Integration Is Cool

https://news.ycombinator.com/rss Hits: 8
Summary

Gaussian integration is cool Numerical integration techniques are often used in a variety of domains where exact solutions are not available. In this blog, we'll look at a numerical integration technique called gaussian quadrature, specifically chebyshev-gauss quadrature. This is applicable for evaluating definite integrals over [−1,1][-1,1][−1,1] and with a special functional form - we'll also look into how we can tweak an generic function over an arbitrary interval to fit this form. Gaussian quadrature Chebyshev-Gauss quadrature Extending to general functions and integration intervals Let's see it in action! Parting thoughts Fig 1: Comparing the accuracy of a basic integration technique (note log scale) with chebyshev-gauss quadrature Gaussian quadrature At it's core, gaussian quadrature gives us a way to evaluate a definite integral of a function by using the function evaluations at special points called nodes, the exact location of which can vary depending on the technique used - we'll look at a specific example using chebyshev nodes later on. Here's the basic idea for a definite integral over [−1,1][-1,1][−1,1], we'll extend this to an arbitrary interval [a,b][a,b][a,b] later on. An integral of fff can be expressed as a weighted sum of fff evaluated at nnn nodes : ∫−11f(x)dx=∑i=1nw(xi)f(xi)\int_{-1}^{1}f(x)dx = \sum_{i=1}^{n}{w(x_i)f(x_i)} ∫​−1​1​​f(x)dx=​i=1​∑​n​​w(x​i​​)f(x​i​​) Elementary integration techniques work by approximating the function fff with a polynomial. If we sample the function at n points, we can fit a polynomial of degree n-1, and integrate that to get the approximation. Basically this means that with n nodes, we can integrate polynomials with degree n-1. In contrast, Gaussian quadrature can estimate a polynomial of order 2n-1 with n nodes and another set of n weights. The weights are easily determined based on the specific technique, but now you need roughly half the number of function evaluations for an accurate integral approximation. Th...

First seen: 2025-06-08 10:14

Last seen: 2025-06-08 17:15