Trapezoid Integral
Approximate ∫ₐᵇ f(x)dx by composite trapezoid rule.
∫ ≈ —
Numerical integration by the trapezoidal rule
The trapezoidal rule approximates ∫f(x)dx by replacing the area under f with a chain of trapezoids. Dividing [a,b] into n subintervals of width h = (b−a)/n gives ∫ ≈ h/2 · (f(x₀) + 2·Σf(xᵢ) + f(xₙ)). The error is O(h²) — halving when you double n. Simpson's 1/3 rule fits parabolas instead and reaches O(h⁴) for the same cost per point; Romberg integration applies Richardson extrapolation on top of trapezoidal results and accelerates convergence further. Example: ∫₀¹ x² dx = 1/3. With n=4 trapezoids you get ≈ 0.3438; with n=100, 0.33335; with n=10000, essentially the exact value.
Applications and context
Trapezoidal integration is everywhere: volume and area under curves in CAD, energy consumed (integral of power over time), rainfall analysis from hydrograph curves, consumer/producer surplus in economics, signal-processing RMS and regression diagnostics. Whenever you have tabulated data without an analytic formula — sensor logs, financial flows — it's usually the first integrator you reach for.
FAQ
How do I choose n? Start small, double n, compare results: if they agree to your tolerance, stop. This adaptive refinement is the basis of Romberg.
Trapezoidal vs Simpson — when is Simpson worth it? Whenever f is smooth, Simpson gives orders of magnitude more accuracy for the same number of evaluations. For noisy or piecewise data, trapezoidal is more robust.
What about non-uniform spacing? The trapezoidal rule generalizes: each trapezoid uses its own width (xᵢ₊₁−xᵢ)·(f(xᵢ)+f(xᵢ₊₁))/2. Perfect for irregular sensor samples.
Related Tools
Rent Adjustment Calculator
Compute annual rent adjustment by IGP-M or IPCA accumulated in the last 12 months (manually configurable).
Pregnancy Calculator
Compute estimated due date (EDD), gestational age and trimester from the last menstrual period (LMP).
Fertile Period Calculator
Compute fertile window and ovulation day from the first day of the last cycle and the average cycle length.