MTH 343 · 4.3 Elements of numerical integration
Pick a function and an interval [a, b]. The lab approximates the integral with the trapezoidal rule and Simpson's rule, draws the line and the parabola each rule integrates in place of f, and compares both results with the exact value.
Each rule replaces f by a polynomial through its nodes and integrates that polynomial instead. Drag the handles at a and b to move the endpoints; hover over the plot to read values.
Each rule is a weighted sum of values of f at its nodes. The trapezoidal rule uses the endpoints only; Simpson's rule also uses the midpoint.
The left endpoint a stays fixed and the right endpoint moves to a + w. Both axes are logarithmic, so an error of order w³ appears as a line of slope 3 and an error of order w⁵ as a line of slope 5. A logarithmic axis has no 0, so an error of 0 is drawn on the separate 0 line at the bottom. A curve drops to that line where the error changes sign. Where the error is too small to resolve in double precision, the curve stops and continues on the 0 line.