MathIsimple
SC-04
Course 4

Numerical Integration

Learn to approximate definite integrals using quadrature formulas. From basic trapezoidal and Simpson rules to advanced Gaussian quadrature, master the tools for numerical calculus.

Learning Objectives
  • Derive and apply Newton-Cotes quadrature formulas
  • Understand algebraic precision and error analysis
  • Construct composite quadrature rules for improved accuracy
  • Apply Richardson extrapolation and Romberg integration
  • Master Gaussian quadrature for optimal accuracy
  • Choose appropriate methods for different integration problems

1. Newton-Cotes Formulas

Newton-Cotes formulas approximate integrals by integrating an interpolating polynomial through equally-spaced nodes.

Definition 4.1: Trapezoidal Rule

Using linear interpolation through (a,f(a))(a, f(a)) and (b,f(b))(b, f(b)):

abf(x)dxba2(f(a)+f(b))\int_a^b f(x) \, dx \approx \frac{b-a}{2} \left( f(a) + f(b) \right)

Theorem 4.1: Trapezoidal Rule Error

If fC2[a,b]f \in C^2[a, b], the error is:

RT(f)=(ba)312f(η),for some η(a,b)R_T(f) = -\frac{(b-a)^3}{12} f''(\eta), \quad \text{for some } \eta \in (a, b)

The trapezoidal rule has algebraic precision 1.

Definition 4.2: Simpson's Rule

Using quadratic interpolation through three points:

abf(x)dxba6(f(a)+4f(a+b2)+f(b))\int_a^b f(x) \, dx \approx \frac{b-a}{6} \left( f(a) + 4f\left(\frac{a+b}{2}\right) + f(b) \right)

Theorem 4.2: Simpson's Rule Error

If fC4[a,b]f \in C^4[a, b], the error is:

RS(f)=(ba)52880f(4)(η),for some η(a,b)R_S(f) = -\frac{(b-a)^5}{2880} f^{(4)}(\eta), \quad \text{for some } \eta \in (a, b)

Simpson's rule has algebraic precision 3 (not 2, due to symmetry).

Definition 4.3: General Newton-Cotes Formula

Divide [a,b][a, b] into nn equal parts with nodes xi=a+ihx_i = a + ih, h=(ba)/nh = (b-a)/n:

abf(x)dx(ba)i=0nci(n)f(xi)\int_a^b f(x) \, dx \approx (b-a) \sum_{i=0}^{n} c_i^{(n)} f(x_i)

where ci(n)c_i^{(n)} are the Newton-Cotes coefficients.

Example: Newton-Cotes Coefficients

nnNameCoefficientsPrecision
1Trapezoidal12,12\frac{1}{2}, \frac{1}{2}1
2Simpson16,46,16\frac{1}{6}, \frac{4}{6}, \frac{1}{6}3
3Simpson's 3/818,38,38,18\frac{1}{8}, \frac{3}{8}, \frac{3}{8}, \frac{1}{8}3
4Boole790,3290,1290,3290,790\frac{7}{90}, \frac{32}{90}, \frac{12}{90}, \frac{32}{90}, \frac{7}{90}5
Remark:

For even nn, Newton-Cotes formulas achieve precision n+1n+1 instead of just nndue to symmetry of the nodes and weights.

2. Composite Quadrature Rules

High-degree Newton-Cotes formulas can have negative coefficients and instability. Instead, apply low-degree rules on subintervals.

Definition 4.4: Composite Trapezoidal Rule

Divide [a,b][a, b] into nn equal parts with h=(ba)/nh = (b-a)/n:

Tn=h2(f(a)+2k=1n1f(a+kh)+f(b))T_n = \frac{h}{2} \left( f(a) + 2\sum_{k=1}^{n-1} f(a + kh) + f(b) \right)

Theorem 4.3: Composite Trapezoidal Error

If fC2[a,b]f \in C^2[a, b]:

R(f,Tn)=ba12h2f(η)=O(h2)R(f, T_n) = -\frac{b-a}{12} h^2 f''(\eta) = O(h^2)

Definition 4.5: Composite Simpson's Rule

Divide [a,b][a, b] into 2n2n equal parts:

Sn=h3(f(a)+4k=1nf(x2k1)+2k=1n1f(x2k)+f(b))S_n = \frac{h}{3} \left( f(a) + 4\sum_{k=1}^{n} f(x_{2k-1}) + 2\sum_{k=1}^{n-1} f(x_{2k}) + f(b) \right)

Theorem 4.4: Composite Simpson Error

If fC4[a,b]f \in C^4[a, b]:

R(f,Sn)=ba180h4f(4)(η)=O(h4)R(f, S_n) = -\frac{b-a}{180} h^4 f^{(4)}(\eta) = O(h^4)
Note:

Successive halving: From TnT_n to T2nT_{2n}:

T2n=12Tn+h2k=1nf(a+2k12h)T_{2n} = \frac{1}{2} T_n + \frac{h}{2} \sum_{k=1}^{n} f\left(a + \frac{2k-1}{2}h\right)

This avoids recomputing function values at existing nodes.

3. Romberg Integration

Richardson extrapolation systematically eliminates error terms from the trapezoidal rule.

Definition 4.6: Richardson Extrapolation

If F1(h)F_1(h) approximates FF^* with error O(hp1)O(h^{p_1}), then:

F2(h)=F1(qh)qp1F1(h)1qp1F_2(h) = \frac{F_1(qh) - q^{p_1} F_1(h)}{1 - q^{p_1}}

approximates FF^* with error O(hp2)O(h^{p_2}) where p2>p1p_2 > p_1.

Theorem 4.5: Romberg Formula

With q=1/2q = 1/2 for successive halving:

Tm(k)=4mTm1(k+1)Tm1(k)4m1,m=1,2,T_m^{(k)} = \frac{4^m T_{m-1}^{(k+1)} - T_{m-1}^{(k)}}{4^m - 1}, \quad m = 1, 2, \ldots

where T0(k)T_0^{(k)} is the trapezoidal rule with 2k2^k subintervals.

Example: Romberg Table

The Romberg table structure (each column has higher accuracy):

T0T_0T1T_1T2T_2T3T_3
T0(0)T_0^{(0)}
T0(1)T_0^{(1)}T1(0)T_1^{(0)}
T0(2)T_0^{(2)}T1(1)T_1^{(1)}T2(0)T_2^{(0)}
T0(3)T_0^{(3)}T1(2)T_1^{(2)}T2(1)T_2^{(1)}T3(0)T_3^{(0)}

Note: T1(k)=SnT_1^{(k)} = S_n (Simpson), and Tm(k)T_m^{(k)} has error O(h2m+2)O(h^{2m+2}).

4. Gaussian Quadrature

By choosing both nodes and weights optimally, Gaussian quadrature achieves the maximum possible precision with nn function evaluations.

Definition 4.7: Gaussian Quadrature

A quadrature formula abw(x)f(x)dxi=1nAif(xi)\int_a^b w(x) f(x) \, dx \approx \sum_{i=1}^{n} A_i f(x_i)is Gaussian if it has algebraic precision 2n12n-1.

Theorem 4.6: Gauss-Legendre Nodes

For 11f(x)dx\int_{-1}^{1} f(x) \, dx, the optimal nodes are the zeros of the Legendre polynomial Pn(x)P_n(x).

The weights are: Ai=2(1xi2)[Pn(xi)]2A_i = \frac{2}{(1 - x_i^2)[P_n'(x_i)]^2}

Example: Gauss-Legendre Nodes and Weights

nnNodes xix_iWeights AiA_i
10022
2±1/3\pm 1/\sqrt{3}1,11, 1
30,±3/50, \pm\sqrt{3/5}8/9,5/9,5/98/9, 5/9, 5/9

Gauss-Laguerre

For 0exf(x)dx\int_0^{\infty} e^{-x} f(x) \, dx, nodes are zeros of Laguerre polynomials.

Gauss-Hermite

For ex2f(x)dx\int_{-\infty}^{\infty} e^{-x^2} f(x) \, dx, nodes are zeros of Hermite polynomials.

Gauss-Chebyshev

For 11f(x)1x2dx\int_{-1}^{1} \frac{f(x)}{\sqrt{1-x^2}} \, dx, nodes are zeros of Chebyshev polynomials.

Note:

To integrate over [a,b][a, b] instead of [1,1][-1, 1], use the transformationx=ba2t+a+b2x = \frac{b-a}{2}t + \frac{a+b}{2}.

Practice Quiz

Numerical Integration Quiz
10
Questions
0
Correct
0%
Accuracy
1
The trapezoidal rule approximates abf(x)dx\int_a^b f(x)dx as:
Easy
Not attempted
2
Simpson's rule has algebraic precision of degree:
Easy
Not attempted
3
The error in the composite trapezoidal rule is O(hk)O(h^k) where kk equals:
Easy
Not attempted
4
Romberg integration uses which technique to improve accuracy?
Medium
Not attempted
5
A quadrature formula has algebraic precision mm if it is exact for all polynomials of degree:
Medium
Not attempted
6
The composite Simpson's rule divides [a,b][a,b] into 2n2n equal parts and has error:
Medium
Not attempted
7
Gauss-Legendre quadrature with nn points has algebraic precision:
Hard
Not attempted
8
The nodes of Gauss-Legendre quadrature on [1,1][-1,1] are:
Hard
Not attempted
9
For Newton-Cotes formulas with even nn, the algebraic precision is:
Hard
Not attempted
10
The relationship Sn=13(4T2nTn)S_n = \frac{1}{3}(4T_{2n} - T_n) connects:
Medium
Not attempted

Frequently Asked Questions

When should I use Simpson's rule vs. Gaussian quadrature?

Simpson's rule: Good for smooth functions when you can choose equally-spaced evaluation points. Easy to implement with adaptive refinement.

Gaussian quadrature: Better accuracy with fewer function evaluations, but nodes are not equally spaced. Ideal when function evaluations are expensive.

Why does Simpson's rule have precision 3 instead of 2?

Due to symmetry! The error term for degree-3 polynomials vanishes because the nodes and weights are symmetric about the midpoint. This "bonus" precision occurs for all even-order Newton-Cotes formulas.

How do I handle improper integrals?

Options include:

  • Variable transformation to remove singularity
  • Gauss-Laguerre for [0,)[0, \infty) with exponential decay
  • Gauss-Hermite for (,)(-\infty, \infty) with Gaussian weight
  • Truncation with error estimation

What's the advantage of Romberg integration?

Romberg integration reuses function values from coarser grids, achieving high accuracy efficiently. It automatically produces error estimates by comparing successive approximations, enabling adaptive termination.

Why not always use the highest-degree Newton-Cotes formula?

High-degree Newton-Cotes formulas (n ≥ 8) have negative coefficients, causing potential cancellation errors. They can also be unstable.

Composite low-degree rules or Gaussian quadrature are preferred for accuracy and stability.