Online Integral Calculator

Calculate definite integrals using Simpson's rule. Includes a table of 20 basic integrals and integration rules.

MATHEMATICS

The Online Integral Calculator computes definite integrals numerically using Simpson's method.

Supports various mathematical functions (polynomial, trigonometric, exponential, logarithmic). Includes a table of 20 basic integrals, integration rules, and ready-to-use examples.

Disclaimer: Numerical results have a small margin of error. For exact analytical solutions, use algebraic methods.
Simbol yang didukung: +, -, *, /, ^, sqrt, sin, cos, tan, ln, log, e, pi, x

Calculator information

How to use this calculator

  1. Enter the function f(x) to integrate using standard syntax (e.g., x^2, sin(x), exp(x), log(x), sqrt(x)).
  2. Set the lower bound (a) and upper bound (b) of the definite integral - numbers, pi, or e are accepted.
  3. Choose a numerical method: Simpson 1/3 (accurate for smooth functions), Trapezoidal (fast), or Romberg (high precision).
  4. Set the number of subintervals n (must be even for Simpson; 100 is plenty for most cases).
  5. Click Calculate to get the integral value with an error estimate.
  6. Consult the table of 20 basic integrals if you need a symbolic (antiderivative) result - this calculator focuses on numerical definite integrals.
  7. Tip: for functions with a singularity in [a,b] (e.g., 1/x near 0), split the interval or apply a substitution.

Simpson's 1/3 Rule

integral[a->b] f(x)dx ~ (h/3) * [f(x_0) + 4(f(x_1)+f(x_3)+...) + 2(f(x_2)+f(x_4)+...) + f(x_n)]
  • h = (b-a)/n = subinterval width
  • n = number of subintervals (must be even)
  • x_i = a + i*h for i = 0, 1, ..., n
  • Error: |E| <= ((b-a)/180) * h^4 * max|f^(4)(x)|
  • Trapezoidal rule: integral ~ (h/2) * [f(x_0) + 2*sum(f(x_i)) + f(x_n)]

Simpson is exact for polynomials of degree <= 3; error is O(h^4) (Trapezoidal is only O(h^2)).

Worked example: Compute integral[0->pi] sin(x) dx using Simpson, n = 4

Given:
  • f(x) = sin(x)
  • a = 0, b = pi, n = 4
  • h = pi/4 ~ 0.7854
Steps:
  1. Nodes: x_0=0, x_1=pi/4, x_2=pi/2, x_3=3pi/4, x_4=pi.
  2. f values: 0, 0.7071, 1, 0.7071, 0.
  3. Weighted sum: f(x_0) + 4f(x_1) + 2f(x_2) + 4f(x_3) + f(x_4) = 0 + 2.8284 + 2 + 2.8284 + 0 = 7.6569.
  4. Integral ~ (0.7854/3) * 7.6569 = 2.0046.
  5. Exact value: [-cos(x)] from 0 to pi = -cos(pi) + cos(0) = 2.

Result: Numerical result 2.0046, error 0.23% (highly accurate with just 4 subintervals).

Frequently asked questions

When should I use numerical vs. analytical methods?
Use analytical methods (antiderivatives) when a closed-form exists, e.g., integral(x^2)dx = x^3/3. Use numerical methods when: (1) no elementary antiderivative exists (e.g., integral of e^(-x^2)), (2) you only have discrete data, (3) the function is very complex. Simpson's 1/3 is adequate for engineering precision (10^-6 relative); use Gauss-Legendre quadrature for higher accuracy.
Why is Simpson more accurate than Trapezoidal?
Trapezoidal approximates each subinterval with a straight line (degree-1 polynomial), giving O(h^2) error. Simpson 1/3 fits a parabola (degree-2 polynomial) through every three consecutive points, giving O(h^4) error. Halving the subinterval width cuts Simpson error 16x but Trapezoidal only 4x. For smooth functions, Simpson wins decisively with far fewer evaluations.
What is the error and how do I control it?
Error = |numerical result - exact result|. For Simpson 1/3 with n subintervals, error is bounded by ((b-a)^5 / (180 * n^4)) * max|f^(4)(x)|. To reduce it: (1) increase n, (2) use adaptive quadrature that auto-refines in rapidly changing regions, (3) use higher-order methods like Romberg or Gauss-Legendre. For non-smooth functions, split the integral at discontinuities.
How do I compute improper integrals?
Integrals with infinite limits or boundary singularities need special handling. For integral[0->inf] f(x)dx, substitute x = t/(1-t) to map onto [0,1], then apply Simpson. For a singularity at a, use a substitution or Gauss-Chebyshev quadrature. Many calculators use tanh-sinh (double-exponential) quadrature, which is robust against endpoint singularities.
What are some real-world applications of integration?
Integrals compute cumulative quantities: area (integral f(x)dx), volume of revolution (integral pi*f(x)^2 dx), mechanical work (integral F.ds), center of mass, moment of inertia, probabilities of continuous variables (integral p(x)dx), distance from velocity (integral v(t)dt), and Fourier transforms for signal processing. Civil engineers use integrals for river discharge (Q = integral v.dA); physicists use them for electric flux (closed-loop integral of E.dA).

Last updated: May 11, 2026