Definite Integral Calculator
Numerically evaluate ∫ab f(x) dx using midpoint, trapezoidal, or Simpson's rule.
+ - * / ^ ( ), variable x, constants pi, e, functions:
sin, cos, tan, asin, acos, atan, sqrt, abs, exp, log, ln, floor, ceil, round.
Use explicit multiplication, e.g. 2*x (not 2x).
What is a definite integral?
A definite integral measures accumulated change over an interval. Geometrically, it often represents signed area between a curve and the x-axis. In notation, the expression ∫ab f(x) dx adds infinitely many tiny contributions of f(x) from x = a to x = b.
In practical work, integrals appear everywhere: distance from velocity, total revenue from marginal revenue, probability from density functions, energy from force, and more. This calculator focuses on fast numerical approximations when an exact antiderivative is hard or unnecessary.
How this definite integral calculator works
The tool approximates the integral numerically by splitting the interval into n subintervals and summing function values. You can choose from three methods:
- Midpoint Rule: samples each subinterval at its midpoint.
- Trapezoidal Rule: approximates each slice with a trapezoid.
- Simpson's Rule: uses parabolic arcs, typically giving higher accuracy for smooth functions.
For many smooth functions, Simpson's rule converges quickly and is usually the best default choice.
Step-by-step usage
1) Enter your function
Type an expression in terms of x, such as x^3 - 2*x + 1 or sin(x)*exp(-x).
2) Set integration bounds
Choose lower bound a and upper bound b. If a > b, the result will be negative of the reversed integral, as expected from calculus rules.
3) Choose subintervals and method
Larger n generally improves accuracy but takes more computation. Simpson's rule requires an even n; if you enter an odd value, the calculator automatically adjusts it.
4) Click calculate
You receive the approximation plus a quick refinement estimate by comparing with a finer partition.
Interpreting results correctly
Remember that a definite integral returns signed area. Regions below the x-axis contribute negatively. If you need total geometric area regardless of sign, split the interval at roots and sum absolute contributions.
Also note that functions with discontinuities (for example, 1/x across 0) can fail or produce misleading results unless treated as improper integrals.
Accuracy tips for numerical integration
- Increase
nfor oscillatory functions likesin(20*x). - Use Simpson's rule for smooth curves whenever possible.
- Check convergence: compare outputs at
nand2n. - Be careful near singularities and sharp spikes.
- Use explicit multiplication symbols (
*) to avoid parse errors.
Common examples
Example A: ∫0π sin(x) dx
The exact value is 2. This is a great sanity test for your settings and method choice.
Example B: ∫01 x^2 dx
The exact value is 1/3 ≈ 0.333333.... If your answer is close, the calculator is configured well.
Example C: ∫-11 1/(1+x^2) dx
The exact value is π/2. This checks rational-function handling and symmetry.
Why a definite integral calculator is useful
Even if you know integration techniques, numerical tools are valuable for fast exploration, validating hand calculations, and solving real-world models that do not simplify to elementary antiderivatives. Engineers, analysts, students, and researchers all use numerical integration as part of normal workflow.
Final note
This page is designed to be simple, fast, and practical. Use it for homework checks, model prototyping, and quick computational calculus tasks. For best results, test with known integrals first, then move on to your custom functions.