Numerical Integration

Numerical integration approximates definite integrals \(\int_a^b f(x) \, dx\) when analytical solutions are unavailable.

Trapezoidal Rule

Approximates the integral as \(\frac{h}{2} [f(a) + f(b)] + h \sum_{i=1}^{n-1} f(x_i)\), where \(h = \frac{b-a}{n}\).

Examples

For \(\int_0^1 x^2 \, dx\) with \(n=2\), the trapezoidal rule gives 0.375 (exact: 0.333).

Other Methods

Simpson’s rule and Gaussian quadrature improve accuracy for smoother functions.