Unit 3: Numerical Differentiation, Richardson Extrapolation & Advanced Quadrature
Finite difference stencils, step-size truncation-roundoff tradeoff, Richardson extrapolation, composite Newton-Cotes quadrature (Trapezoidal, Simpson's, Weddle's), Romberg integration, and Gauss-Legendre quadrature.
§3.1 Numerical Differentiation: Finite Difference Stencils & Truncation-Roundoff Tradeoff
1. Finite Difference Approximations of Derivatives
When an analytical expression for $f(x)$ is unavailable or excessively complicated, derivatives must be computed from discrete evaluations. By truncating Taylor series expansions, we construct finite difference stencils.
Let $h > 0$ denote the discretization grid spacing.
1. Forward and Backward Difference Approximations ($\mathcal{O}(h)$):
Expanding $f(x + h)$ in Taylor series:
Solving for $f'(x)$:
Similarly, expanding $f(x - h)$:
2. Three-Point Centered Difference Formula ($\mathcal{O}(h^2)$):
Subtracting the backward Taylor expansion from the forward Taylor expansion:
Solving for $f'(x)$ yields the Centered Difference Formula:
The linear error term cancels identically due to symmetry, elevating the accuracy from $\mathcal{O}(h)$ to $\mathcal{O}(h^2)$.
3. Second Derivative Centered Difference Stencil ($\mathcal{O}(h^2)$):
Adding the two Taylor expansions:
2. The Fundamental Truncation-Roundoff Dilemma
In pure analysis, the derivative is obtained by taking $\lim_{h \to 0}$. In digital computing, as $h \to 0$, finite precision arithmetic destroys the solution!
Suppose each function evaluation is contaminated by roundoff error bounded by $\epsilon = \epsilon_{\text{mach}} |f(x)|$:
The computationally computed centered difference derivative is:
The total computational error $E_{\text{total}}(h) = |f'(x) - \tilde{D}_h^0 f(x)|$ satisfies:
where $M = \max |f'''(\xi)|$.
- As $h$ decreases, truncation error decays as $h^2$.
- But as $h$ decreases, round-off error explodes as $\frac{1}{h}$ due to division by near-zero!
Optimal Step Size ($h^*$):
Minimizing $E(h) = \frac{M h^2}{6} + \frac{\epsilon}{h}$ by setting $\frac{dE}{dh} = \frac{M h}{3} - \frac{\epsilon}{h^2} = 0$:
For double-precision floating point ($\epsilon \approx 10^{-16}$), the optimal step size for centered differences is $h^ \approx 10^{-16/3} \approx 10^{-5.3} \approx 10^{-5}$, and the achievable accuracy is bounded by $E(h^) \approx \mathcal{O}(\epsilon^{2/3}) \approx 10^{-11}$. One cannot achieve full 16-digit machine precision with simple finite differences!
§3.2 Richardson Extrapolation & Systematic Higher-Order Acceleration
1. The Principle of Richardson Error Cancellation
Richardson Extrapolation is a general numerical acceleration technique that systematically eliminates the dominant term in a truncation error expansion.
Suppose an approximation $N_1(h)$ to an unknown exact quantity $M$ has an asymptotic expansion with even powers of $h$:
where the coefficients $K_j$ are independent of $h$. Now evaluate the same approximation with half the step size, $h/2$:
Multiply the second equation by 4 and subtract the first equation:
Dividing by 3:
Define the new approximation $N_2(h) = N_1(h/2) + \frac{N_1(h/2) - N_1(h)}{3}$. Its error is $\mathcal{O}(h^4)$, having completely eliminated the $\mathcal{O}(h^2)$ term without evaluating higher derivatives!
2. General Extrapolation Tableau
Repeating this process recursively generates a triangular tableau:
- Column 1: $\mathcal{O}(h^2)$ approximations ($N_1(h), N_1(h/2), N_1(h/4), \dots$).
- Column 2: $\mathcal{O}(h^4)$ approximations.
- Column 3: $\mathcal{O}(h^6)$ approximations.
- Column $m$: $\mathcal{O}(h^{2m})$ approximations.
§3.3 Newton-Cotes Quadrature Formulas: Trapezoidal, Simpson's & Weddle's Rules
1. General Framework of Interpolatory Quadrature
Numerical integration (quadrature) replaces a definite integral $I = \int_a^b f(x) dx$ with a finite weighted sum:
In Newton-Cotes formulas, the nodes $x_i$ are equispaced: $x_i = a + i h$ with $h = \frac{b - a}{n}$. The weights $w_i$ are obtained by integrating the cardinal Lagrange basis polynomials:
2. The Trapezoidal Rule ($n = 1$)
Connecting $(a, f(a))$ and $(b, f(b))$ with a linear interpolant:
Composite Trapezoidal Rule:
Dividing $[a, b]$ into $m$ subintervals of length $h = \frac{b - a}{m}$:
Theorem 3.1 (Trapezoidal Truncation Error):
If $f \in C^2[a, b]$, the global truncation error is:
3. Simpson's 1/3 Rule ($n = 2$)
Fitting a parabola through $(x_0, f_0), (x_1, f_1), (x_2, f_2)$ with $h = \frac{b - a}{2}$:
Composite Simpson's 1/3 Rule ($m$ even):
Dividing $[a, b]$ into an even number $m$ of subintervals:
Theorem 3.2 (Simpson's Error Formula & Precision Miracle):
If $f \in C^4[a, b]$, the global error is:
Significance: Because Simpson's rule uses a symmetric quadratic interpolant, the cubic error term $\int_{-h}^h x^3 dx = 0$ vanishes by symmetry. Consequently, Simpson's rule integrates polynomials of degree up to 3 exactly without any error!
4. Simpson's 3/8 Rule ($n = 3$) and Weddle's Rule ($n = 6$)
- Simpson's 3/8 Rule: Fits a cubic through 4 equispaced points:
Composite error over $[a, b]$: $E_{3/8} = -\frac{(b - a) h^4}{80} f^{(4)}(\xi)$.
- Weddle's Rule ($n = 6$): Six-panel formula with optimal integer weights:
Global error: $E_W = -\frac{(b - a) h^6}{1400} f^{(6)}(\xi) = \mathcal{O}(h^6)$.
§3.4 Romberg Integration & Gauss-Legendre Quadrature
1. Romberg Quadrature
Romberg integration applies Richardson extrapolation systematically to the composite Trapezoidal rule:
The column entries $R_{k, j}$ have error order $\mathcal{O}(h^{2j})$. The diagonal entries $R_{k, k}$ converge with extraordinary rapidity.
2. Gauss-Legendre Quadrature Theory
Newton-Cotes formulas fix nodes $x_i$ to be equispaced and determine $n + 1$ weights, achieving degree of precision $n$ (or $n+1$ for even $n$). Gaussian Quadrature frees both the $n$ nodes $x_1, \dots, x_n$ and the $n$ weights $w_1, \dots, w_n$ (a total of $2n$ degrees of freedom), achieving maximal algebraic degree of precision.
Theorem 3.3 (Maximal Precision of Gaussian Quadrature):
Let $\{P_n(x)\}$ be the family of orthogonal Legendre polynomials on $[-1, 1]$ satisfying:
Let $x_1, x_2, \dots, x_n$ be the $n$ distinct roots of $P_n(x) = 0$ in $(-1, 1)$, and let:
Then the quadrature formula:
is strictly exact for all polynomials of degree up to $2n - 1$.
Proof: Let $p(x) \in \mathbb{P}_{2n-1}$. By polynomial division, divide $p(x)$ by $P_n(x)$:
where $\deg(q) \le n - 1$ and $\deg(r) \le n - 1$. Integrate both sides over $[-1, 1]$:
Since $\deg(q) \le n - 1$ and $P_n$ is orthogonal to all polynomials of degree $< n$, the first integral vanishes identically: $\int_{-1}^1 q(x) P_n(x) dx = 0$. Thus: $\int_{-1}^1 p(x) dx = \int_{-1}^1 r(x) dx$. Now evaluate the quadrature rule on $p(x)$:
Because the nodes $x_i$ are roots of $P_n(x)$, $P_n(x_i) = 0$. Thus:
Since $\deg(r) \le n - 1$, the interpolatory quadrature rule with $n$ nodes integrates $r(x)$ exactly:
Hence $\int_{-1}^1 p(x) dx = \sum_{i=1}^n w_i p(x_i)$, establishing precision $2n - 1$. $\blacksquare$
Transformation to Arbitrary Interval $[a, b]$:
To evaluate $\int_a^b f(t) dt$, map $t \in [a, b]$ to $x \in [-1, 1]$ via substitution:
Tiered Solved Practice Problems & Examination Proofs
Comprehensive analytical derivations, multi-tier solutions (Foundational, Intermediate Algorithmic, and Honors/Proof Challenge) with complete line-by-line verification.
Evaluate the integral $I = \int_0^1 \frac{1}{1 + x^2} dx$ (exact value: $\arctan(1) = \pi/4 \approx 0.7853981634$):
1. Using the composite Trapezoidal rule with $m = 6$ subintervals ($h = 1/6$).
2. Using composite Simpson's 1/3 rule with $m = 6$ subintervals ($h = 1/6$).
3. Using Simpson's 3/8 rule with $m = 3$ subintervals ($h = 1/3$).
4. Compare all three errors against theoretical truncation bounds.
Step 1: Node evaluation for $m = 6$ ($h = 1/6$)
Function $f(x) = \frac{1}{1 + x^2}$. Grid nodes $x_i = i/6$:
- $x_0 = 0.000000, f_0 = 1/(1+0) = 1.00000000$
- $x_1 = 1/6 \approx 0.166667, f_1 = 1/(1 + 1/36) = 36/37 \approx 0.97297297$
- $x_2 = 2/6 \approx 0.333333, f_2 = 1/(1 + 4/36) = 36/40 = 0.90000000$
- $x_3 = 3/6 = 0.500000, f_3 = 1/(1 + 9/36) = 36/45 = 0.80000000$
- $x_4 = 4/6 \approx 0.666667, f_4 = 1/(1 + 16/36) = 36/52 = 9/13 \approx 0.69230769$
- $x_5 = 5/6 \approx 0.833333, f_5 = 1/(1 + 25/36) = 36/61 \approx 0.59016393$
- $x_6 = 1.000000, f_6 = 1/(1 + 1) = 0.50000000$
Step 2: Composite Trapezoidal Rule
Sum of interior nodes: $0.97297297 + 0.90000000 + 0.80000000 + 0.69230769 + 0.59016393 = 3.95544459$.
Absolute error: $|T_6 - I| = |0.78424077 - 0.78539816| \approx 0.00115739$.
Step 3: Composite Simpson's 1/3 Rule
Odd sum: $f_1 + f_3 + f_5 = 0.97297297 + 0.80000000 + 0.59016393 = 2.36313690$.
Even sum: $f_2 + f_4 = 0.90000000 + 0.69230769 = 1.59230769$.
Absolute error: $|S_6 - I| = |0.78539794 - 0.78539816| \approx 2.2 \times 10^{-7}$! (Remarkable precision!)
Step 4: Simpson's 3/8 Rule ($m = 3, h = 1/3$)
Nodes: $x_0 = 0, f_0 = 1.0$; $x_1 = 1/3, f_1 = 9/10 = 0.9$; $x_2 = 2/3, f_2 = 9/13 \approx 0.69230769$; $x_3 = 1, f_3 = 0.5$.
Error: $|S_{3/8} - I| \approx 0.00078278$.
Trapezoidal: $T_6 \approx 0.784241$ (error $1.16 \times 10^{-3}$). Simpson 1/3: $S_6 \approx 0.785398$ (error $2.2 \times 10^{-7}$). Simpson 3/8: $S_{3/8} \approx 0.784615$ (error $7.8 \times 10^{-4}$).
Construct the complete Romberg quadrature table $R_{k, j}$ up to order $\mathcal{O}(h^6)$ ($k = 3$) for the integral $\int_0^{\pi/2} \sin(x) dx = 1.0$:
1. Compute $R_{1,1}, R_{2,1}, R_{3,1}$ using the composite Trapezoidal rule with $h_1 = \pi/2, h_2 = \pi/4, h_3 = \pi/8$.
2. Apply the Richardson acceleration formula $R_{k, j} = R_{k, j-1} + \frac{R_{k, j-1} - R_{k-1, j-1}}{4^{j-1} - 1}$ to calculate column 2 ($j = 2$, $\mathcal{O}(h^4)$) and column 3 ($j = 3$, $\mathcal{O}(h^6)$).
3. Verify that $R_{3,3}$ agrees with the exact value to 6 decimal places.
Step 1: Compute Column 1 (Composite Trapezoidal Rule)
Integral $I = \int_0^{\pi/2} \sin x\,dx = [-\cos x]_0^{\pi/2} = 1.00000000$.
- $k = 1, h_1 = \pi/2$:
- $k = 2, h_2 = \pi/4$:
- $k = 3, h_3 = \pi/8$:
$\sin(\pi/8) \approx 0.38268343, \sin(3\pi/8) \approx 0.92387953$. Sum $= 1.30656296$.
$h_3 \times 1.30656296 = \frac{\pi}{8} \times 1.30656296 \approx 0.51310065$.
Step 2: Compute Column 2 (Simpson Equivalent, $\mathcal{O}(h^4)$)
Formula for $j = 2$: $R_{k, 2} = R_{k, 1} + \frac{R_{k, 1} - R_{k-1, 1}}{4^1 - 1} = R_{k, 1} + \frac{R_{k, 1} - R_{k-1, 1}}{3}$:
- $R_{2, 2} = 0.94805945 + \frac{0.94805945 - 0.78539816}{3} = 0.94805945 + \frac{0.16266129}{3} = 0.94805945 + 0.05422043 = 1.00227988$.
- $R_{3, 2} = 0.98711580 + \frac{0.98711580 - 0.94805945}{3} = 0.98711580 + \frac{0.03905635}{3} = 0.98711580 + 0.01301878 = 1.00013458$.
Step 3: Compute Column 3 (Boole Equivalent, $\mathcal{O}(h^6)$)
Formula for $j = 3$: $R_{3, 3} = R_{3, 2} + \frac{R_{3, 2} - R_{2, 2}}{4^2 - 1} = R_{3, 2} + \frac{R_{3, 2} - R_{2, 2}}{15}$:
Error: $|R_{3, 3} - 1.0| \approx 8.4 \times 10^{-6}$. The Romberg table converges from $0.785$ to $0.999991$ with only 3 doubling steps!
Romberg Tableau: $R_{1,1}=0.785398, R_{2,1}=0.948059, R_{3,1}=0.987116$; $R_{2,2}=1.002280, R_{3,2}=1.000135$; $R_{3,3}=0.999992$, matching $1.000000$ to 5 decimal places.
Consider Gaussian quadrature on $[-1, 1]$ with $n = 3$ nodes:
1. Derive the 3rd-degree Legendre polynomial $P_3(x)$ using Gram-Schmidt orthogonalization on $\{1, x, x^2, x^3\}$ with inner product $\langle f, g \rangle = \int_{-1}^1 f(x) g(x) dx$.
2. Find the exact roots $x_1, x_2, x_3$ of $P_3(x)$ and derive the Christoffel weights $w_1, w_2, w_3$.
3. Verify that the 3-point rule integrates $x^4$ and $x^5$ with zero error (degree of precision $2n - 1 = 5$), but fails for $x^6$.
Step 1: Gram-Schmidt Orthogonalization for $P_3(x)$
Inner product $\langle f, g \rangle = \int_{-1}^1 f(x) g(x) dx$.
- $P_0(x) = 1$. $\langle P_0, P_0 \rangle = \int_{-1}^1 1\,dx = 2$.
- $P_1(x) = x - \frac{\langle x, P_0 \rangle}{\langle P_0, P_0 \rangle} P_0 = x - 0 = x$. $\langle P_1, P_1 \rangle = \int_{-1}^1 x^2\,dx = 2/3$.
- $P_2(x) = x^2 - \frac{\langle x^2, P_0 \rangle}{\langle P_0, P_0 \rangle} P_0 - \frac{\langle x^2, P_1 \rangle}{\langle P_1, P_1 \rangle} P_1 = x^2 - \frac{2/3}{2} (1) - 0 = x^2 - \frac{1}{3}$. Normalized: $\frac{1}{2}(3x^2 - 1)$.
- $P_3(x) = x^3 - \frac{\langle x^3, P_1 \rangle}{\langle P_1, P_1 \rangle} P_1 = x^3 - \frac{\int_{-1}^1 x^4\,dx}{2/3} x = x^3 - \frac{2/5}{2/3} x = x^3 - \frac{3}{5} x = \frac{x(5x^2 - 3)}{5}$.
Standard monic form: $x(x^2 - 3/5) = 0$.
Step 2: Roots and Christoffel Weights
Roots of $P_3(x) = 0$:
Compute weights via method of undetermined coefficients for exact integration of $1, x, x^2$:
- $\int_{-1}^1 1\,dx = 2 \implies w_1 + w_2 + w_3 = 2$
- $\int_{-1}^1 x\,dx = 0 \implies -w_1 \sqrt{3/5} + 0 + w_3 \sqrt{3/5} = 0 \implies w_1 = w_3$
- $\int_{-1}^1 x^2\,dx = \frac{2}{3} \implies w_1 (3/5) + w_2 (0) + w_3 (3/5) = \frac{2}{3} \implies 2 w_1 \left(\frac{3}{5}\right) = \frac{2}{3} \implies \frac{6}{5} w_1 = \frac{2}{3} \implies w_1 = \frac{5}{9}$.
Since $w_1 = w_3 = 5/9$, then $w_2 = 2 - 2(5/9) = 2 - 10/9 = 8/9$.
Step 3: Verification of Maximal Degree of Precision $2n - 1 = 5$
- Test $f(x) = x^4$:
Exact: $\int_{-1}^1 x^4\,dx = [x^5/5]_{-1}^1 = \frac{2}{5} = 0.4$.
Gaussian Quadrature:
- Test $f(x) = x^5$:
Exact: $\int_{-1}^1 x^5\,dx = 0$ (odd function).
Quadrature: $\frac{5}{9} (-3/5)^{5/2} + 0 + \frac{5}{9} (3/5)^{5/2} = 0$ (Exact!).
- Test $f(x) = x^6$ (degree 6):
Exact: $\int_{-1}^1 x^6\,dx = \frac{2}{7} \approx 0.285714$.
Quadrature: $2 \times \frac{5}{9} \left(\frac{3}{5}\right)^3 = \frac{10}{9} \times \frac{27}{125} = \frac{6}{25} = 0.240000 \ne \frac{2}{7}$.
Thus, the 3-point Gaussian rule is exact for all polynomials up to degree 5 ($2n - 1$), but fails for degree 6, completing the rigorous proof! $\blacksquare$
Gauss-Legendre 3-point: $x_1, x_3 = \mp\sqrt{3/5}, w_1 = w_3 = 5/9; x_2 = 0, w_2 = 8/9$. Algebraic degree of precision is strictly $2n - 1 = 5$.