Unit IV: Numerical Differentiation and Integration
Numerical Differentiation Using Newton's Interpolation Formulae
Numerical differentiation is the process of calculating the derivative of a function using a set of discrete data values, usually when the explicit function is unknown or too complex to differentiate analytically. We utilize Newton's interpolation formulae to approximate the function and then differentiate the resulting polynomial.
Newton's Forward Difference Interpolation Formula
When values are given at equal intervals and we need the derivative near the beginning of the table, we use Newton's Forward Interpolation Formula. Let the step size be h, and let u = (x - x0) / h.
P(x) = y0 + uΔy0 + [u(u - 1) / 2!]Δ2y0 + [u(u - 1)(u - 2) / 3!]Δ3y0 + ...
Differentiating P(x) with respect to x using the chain rule (since du/dx = 1 / h):
dy / dx = (1 / h) [Δy0 + ((2u - 1) / 2!)Δ2y0 + ((3u2 - 6u + 2) / 3!)Δ3y0 + ...]
Newton's Backward Difference Interpolation Formula
When values are given at equal intervals and we need the derivative near the end of the table, we use Newton's Backward Interpolation Formula. Let u = (x - xn) / h.
dy / dx = (1 / h) [∇yn + ((2u + 1) / 2!)∇2yn + ((3u2 + 6u + 2) / 3!)∇3yn + ...]
- Step-by-Step Procedure: 1. Construct the difference table. 2. Choose the appropriate forward or backward formula depending on the point of evaluation. 3. Express u in terms of x. 4. Differentiate the formula with respect to u and multiply by du/dx = 1 / h. 5. Substitute the specific value of u to find the numerical derivative.
- Exam-Oriented Note: At the tabular points themselves (e.g., at x = x0, u = 0), the derivative formulas simplify significantly because higher-order terms vanish. For example, at u = 0, dy/dx ≈ (1 / h)[Δy0 - (1/2)Δ2y0 + (1/3)Δ3y0 - ...].
Error in Numerical Differentiation
Numerical differentiation is notoriously sensitive to errors. Because data points often contain inherent rounding errors or experimental measurement errors, differentiating the data tends to amplify these small errors, making numerical differentiation less stable than numerical integration.
Total Error = Truncation Error + Round-off Error
- Truncation Error: Caused by approximating the function with a finite polynomial (i.e., dropping higher-order terms in Newton's interpolation series). As step size h decreases, truncation error decreases.
- Round-off Error: Caused by the computer or calculator rounding off numbers at decimal places. As step size h decreases, the difference between numerator values (like y1 - y0) becomes very small, dividing by a tiny h greatly magnifies the round-off error.
- Optimal Step Size: Due to competing behaviors (truncation error decreases as h decreases, while round-off error increases as h decreases), an optimal value of h exists that minimizes the total error.
- Common Mistake: Assuming that making h infinitely small always yields better accuracy. In practice, too small an h leads to massive round-off error propagation.
General Quadrature Formula
The general quadrature formula forms the foundation of Newton-Cotes numerical integration methods. It is derived by integrating Newton's forward interpolation polynomial over an interval [x0, xn].
∫x0xn y dx = h ∫0n [y0 + uΔy0 + [u(u - 1) / 2!]Δ2y0 + ...] du
By substituting different values for n (the number of subintervals), we obtain different standard numerical integration rules:
- For n = 1: Trapezoidal Rule
- For n = 2: Simpson's One-Third Rule
- For n = 3: Simpson's Three-Eighth Rule
Trapezoidal Rule for Numerical Integration
The Trapezoidal Rule approximates the region under the graph of the function as a trapezoid on each subinterval. It uses first-order polynomials (linear interpolation) between consecutive points.
∫x0xn y dx = (h / 2) [y0 + 2(y1 + y2 + ... + yn-1) + yn]
Where h = (b - a) / n, and n is the number of subintervals.
- Geometric Interpretation: Summing the areas of individual trapezoids formed by connecting adjacent data points with straight line segments.
- Error Term: The error in the composite Trapezoidal rule is proportional to h2 (O(h2)), meaning halving the step size reduces the error by a factor of 4.
- Practical Example: Evaluating ∫01 x2 dx using n = 2 subintervals (h = 0.5): points are x0=0, x1=0.5, x2=1. Corresponding y values are 0, 0.25, 1. Area = (0.5 / 2) [0 + 2(0.25) + 1] = 0.25 × 1.5 = 0.375.
Simpson's One-Third Rule
Simpson's One-Third Rule fits parabolic arcs (second-degree polynomials) through sets of three consecutive points across the integration interval. This generally provides higher accuracy than the Trapezoidal Rule.
∫x0x2 y dx = (h / 3) [y0 + 4y1 + y2]
For a composite interval divided into an even number of subintervals n:
∫x0xn y dx = (h / 3) [(y0 + yn) + 4(y1 + y3 + ... + yn-1) + 2(y2 + y4 + ... + yn-2)]
- Important Condition: The total number of subintervals (n) must be even (or the number of data points must be odd) to apply Simpson's One-Third Rule.
- Error Term: The truncation error is proportional to h4 (O(h4)).
- Exam-Oriented Note: Remember the coefficient pattern: 1 for the endpoints, 4 for all odd-indexed intermediate ordinates, and 2 for all even-indexed intermediate ordinates.
Simpson's Three-Eighth Rule
Simpson's Three-Eighth Rule uses cubic polynomials to fit sets of four consecutive points (three subintervals) across the interval.
∫x0x3 y dx = (3h / 8) [y0 + 3y1 + 3y2 + y3]
For a composite interval divided into n subintervals:
∫x0xn y dx = (3h / 8) [(y0 + yn) + 3(y1 + y2 + y4 + y5 + ...) + 2(y3 + y6 + ...)]
- Important Condition: The total number of subintervals (n) must be a multiple of 3.
- Error Term: Like Simpson's 1/3 rule, the error term is of order O(h4).
| Numerical Integration Rule | Polynomial Degree | Interval Condition | Weight Pattern / Formula Structure | Error Order |
|---|---|---|---|---|
| Trapezoidal Rule | 1 (Linear) | Any value of n | y0 + 2(Sum of intermediates) + yn | O(h2) |
| Simpson's 1/3 Rule | 2 (Quadratic) | n must be even | (y0 + yn) + 4(Odd ordinates) + 2(Even ordinates) | O(h4) |
| Simpson's 3/8 Rule | 3 (Cubic) | n must be a multiple of 3 | (y0 + yn) + 3(Non-multiple of 3 ordinates) + 2(Multiple of 3 ordinates) | O(h4) |