Derivative & Integral Calculator

Numeric derivatives and Simpson's-rule integrals for any f(x).

Try: x^3 - 2x, sin(x), e^x, ln(x). log is base-10, ln is base-e.

Derivative at a point

Definite integral

How to use the derivative & integral calculator

  1. Type f(x) — for example x^2 or sin(x).
  2. Set the point x to get the slope (derivative) there.
  3. Set the bounds a and b and n to get the area (definite integral) — n = 100 is plenty; raise it to watch the value settle.
  4. Read the method notes under the answers — they show the h and n actually used and the arithmetic.

Frequently asked questions

How is the derivative computed?

With the central difference formula f′(x) ≈ (f(x+h) − f(x−h)) / 2h, using h = 0.00001. Sampling symmetrically around the point cancels the leading error term, making it much more accurate than a one-sided slope.

How is the integral computed?

With composite Simpson's rule: the interval is split into n even subintervals, and the area is approximated by fitting a parabola through each triple of points. Doubling n roughly quarters the error — try n = 100 vs n = 1000.

Why numeric instead of symbolic calculus?

Numeric methods work on any function you can type — including ones with no closed-form derivative or antiderivative — and they're accurate to about 8+ digits for smooth functions, which is plenty for checking homework.

What can I type as f(x)?

The variable x, the operators + − * / ^ with parentheses, the functions sin, cos, tan, sqrt, cbrt, ln, log, abs, exp, and the constants pi and e. log is base-10; ln is the natural log.

What if the function has a gap between the bounds?

The calculator detects it and says so plainly instead of returning a wrong number — for example, integrating 1/x across 0 has no finite answer, so you'll get an explanation, not NaN.

More from the codex