How this calculation works
Evaluate the entered function at equally spaced nodes and combine those values with the selected rule’s weights. Compare with the same method at half the step size and a denser Simpson run. The graph overlays the sampled function with trapezoid or quadratic panel outlines, and the table retains every coarse node contribution.
Trapezoid: h/2 × weighted sum with 1,2,…,2,1; Simpson: h/3 × 1,4,2,…,4,1A worked example
For f(x)=x² from 0 to 2 with two intervals, the trapezoidal estimate is 3 and Simpson’s estimate is 8/3. The exact integral in this example is 8/3; the tool’s general denser comparison remains a numerical estimate rather than a universal true-value calculation.
Good to know
Bounded safe arithmetic grammar, finite endpoints within ±1000 and 1–1000 coarse intervals. Finite samples do not prove continuity or detect every interior singularity. Not an improper or adaptive integration solver. Resolution differences are estimates, not certified error bounds. Reverse bounds retain the sign convention, not unsigned area.
Reference: OpenStax Calculus: numerical integration (opens in a new tab) ↗
Keep the signed integral distinct from a picture of area
A definite integral accumulates signed contributions. Values below the horizontal axis contribute with the opposite sign from values above it. Reversing the limits reverses the integral. Those conventions remain in this tool, so a negative answer does not automatically indicate a numerical failure or a negative geometric area.
Green shading shows the sampled curve above the horizontal axis; orange shading shows it below. The boundary drawing uses linear interpolation between sampled values, including interpolated zero crossings. It is not an exact root finder or a separate certified geometric-area computation. Reversing bounds reverses the signed integral without changing which heights are above the axis.
The graph shows sampled values of the entered function alongside the chosen panel shapes. Trapezoidal panels join successive endpoint values with straight segments. Simpson panels interpolate three consecutive nodes with a quadratic. Their outlines explain the approximation; they are not a proof that the entered function stays close to those shapes between nodes.
The antiderivative family and slope field visualizer separates a recognized primitive from a numerical anchored base and its constant shifts. A family of functions is different from one definite-integral value.
Follow the weights instead of treating n as a precision setting
For n equal intervals, there are n plus one nodes. The composite trapezoidal rule gives the first and last samples weight one and every interior sample weight two, then multiplies the sum by h/2. Simpson’s 1/3 rule instead alternates interior weights four and two, with endpoint weights one, and multiplies by h/3. Its panels consume two intervals at a time, which is why n must be even.
For x² on [0,2] with n=2, the nodes are 0, 1 and 2, with function values 0, 1 and 4. Trapezoidal weights give (1/2)×(0+2+4)=3. Simpson weights give (1/3)×(0+4+4)=8/3. The latter matches the exact polynomial integral in this example; the rule is not exact for every entered function.
Use comparison runs honestly
The half-step run uses the same method with twice as many intervals. The denser comparison uses Simpson quadrature with at least 4,096 intervals. Neither is named the true value. A small difference can be encouraging for a smooth, well-resolved function, but two grids can miss the same narrow feature, oscillation or interior singularity. A denser numerical run does not become an analytic answer merely because it uses more samples.
The displayed absolute difference is the magnitude of the coarse result minus the comparison estimate. Relative difference divides by the magnitude of that comparison. It is undefined when the comparison is zero and can be misleading when that denominator is merely very small. The tool therefore retains both numerical values and the absolute difference rather than presenting an unsupported accuracy guarantee.
Check the function and its domain first
The expression parser accepts a bounded arithmetic language rather than executing JavaScript. Use explicit multiplication such as 2*x, and parentheses around each supported function argument. Trigonometric functions use radians. log and ln mean the natural logarithm, and sqrt requires a nonnegative real argument at every sampled point. Invalid or nonfinite sampled values stop the calculation instead of being replaced by zero.
This still cannot certify that a denominator remains nonzero between samples. A function such as 1/x over an interval crossing zero requires an improper-integral analysis, even if a particular finite grid avoids the exact singular point. tan(x) can likewise have poles inside otherwise finite endpoints. Establish that the ordinary finite-interval rule is appropriate before interpreting the result.
Read the node table and export the explanation
Each coarse node remains in the table with its x coordinate, function value, rule weight and weighted contribution. The step size retains its sign when limits are reversed. The copyable result records the expression, limits, interval count and both comparison runs, allowing a worked scenario to be checked without confusing it with another set of inputs.
The Riemann sum calculator studies a different rectangle-sampling convention. The Taylor approximation calculator constructs a local polynomial model instead of directly summing quadrature panels. Those tools can help explain different approximation ideas, but their results do not certify this estimate. The downloadable SVG preserves the sampled curve and panel outlines in the same coordinate system shown on the page.
A few questions, answered
Why must Simpson’s interval count be even?
A Simpson 1/3 panel uses three nodes spanning two intervals. The composite rule requires complete pairs of intervals.
Is the dense comparison the true integral?
No. It is another numerical estimate. It can share sampling errors or miss features and is not a certified error bound.
Can I reverse the integration bounds?
Yes. The step and integral retain the correct signed convention. This does not compute unsigned geometric area automatically.
Does finite output prove the function is continuous?
No. A finite grid can miss singularities between its nodes. Check the mathematical domain before using ordinary finite-interval quadrature.