Skip to content
Test versionSearch

Mathematics

Numerical integral and derivative

Estimate a definite integral with finite limits, or a first or second derivative, using a numerical method.

How it worksFAQRelated tools

Content reviewed:

Also available for Germany, in German 

Expressions use x, pi, e, + - * / ^, parentheses and sin, cos, tan, atan, asin, acos, sinh, cosh, tanh, exp, ln/log, log10, sqrt, cbrt, abs, sign. sin/cos arguments and atan/asin/acos results use radians; ln/log mean the natural logarithm. Use a decimal dot in expressions. Bounds and points: −10000 to 10000. Only the selected operation uses bounds or point/order. Derivative mode also offers separate right-sided and left-sided estimates for orders 1 and 2. Read the sampling explanation before comparing them. For the first central derivative you can explicitly include f(x₀), the estimated slope and a conditional local linear approximation. atan is the real inverse tangent, returning radians; atan(x) is defined for every finite real x within the existing expression limits. Asin is the real principal inverse sine for arguments in [-1,1], returning radians in [-π/2,π/2]. Derivative estimates at ±1 refuse; they are not finite derivatives. Acos is the real principal inverse cosine for arguments in [-1,1], returning radians in [0,π]. Derivative estimates at ±1 refuse; they are not finite derivatives. Sinh is the real hyperbolic sine for a dimensionless real argument. Nonfinite results or intermediate magnitudes above 1e100 refuse. Cosh is the real hyperbolic cosine for a dimensionless real argument. Nonfinite results or intermediate magnitudes above 1e100 refuse. Tanh is the real hyperbolic tangent for a dimensionless real argument. Floating-point values can round to ±1 at large magnitudes; this does not establish an exact zero derivative. Inner operations still must meet the finite/magnitude limits. Cbrt is the real cube root for positive, zero and negative real arguments. Its value at zero is 0, but cbrt(x) has no finite derivative there. Inner operations still must meet the finite/magnitude limits. For a central second-order cbrt or sign expression, a converged first-order estimate is also required. This numerical safeguard does not prove differentiability. Sign returns -1 for a negative real argument, 0 at zero, and 1 for a positive argument. The jump at zero has no finite derivative. Composed discontinuities or corners may refuse; numerical sampling is not a differentiability proof. Bounded integral refinement may refuse an endpoint jump, even when a finite integral exists. Conservative derivative scope: every order and sampling scheme refuses a variable-dependent cbrt/sign argument that is zero at the centre, except the exact admission identities cbrt(u)^3 and cbrt(u^3). Constant arguments independent of x remain allowed. Other possibly smooth zero compositions may refuse; the original expression is still evaluated with all domain/magnitude guards. This is no proof of differentiability. Tan scope: the whole expression must be tan(a*x+b), including constant arguments. Only affine arithmetic is supported: sums, differences, negation, multiplication by constants and division by a provably nonzero constant. No powers, inner functions, nested tan or outer compositions. Arguments must be conservatively enclosed within ±16 radians and stay at least 1e-10 radians outside every enclosed pole. The entire finite integral interval or largest derivative stencil is checked before sampling. Near-pole, uncertain and unsupported requests refuse; this is no rigorous output error or improper-integral result. Log10 is the base-10 logarithm for strictly positive real arguments. ln and log keep their natural-logarithm meaning. Inner operations still must meet the finite/magnitude limits.

Approximation only: refinement differences are not a rigorous error bound. Narrow peaks or oscillations can be missed; no smoothness proof. Undefined samples, excessive magnitudes or failure to converge refuse. No symbolic, improper or double integral and no clinical use.

Decimal results are approximate. Inputs stay in this browser tab.

Sources

How it works

Composite Simpson refinement for integrals; central finite difference refinement for derivatives. Successive differences are estimates, not guaranteed error bounds.

Worked example

For sin(x) between 0 and pi, the finite integral is approximately 2.

About this calculation

The tool estimates a definite integral between two finite bounds, or the first or second derivative of a function at a point. Integrals use the composite Simpson rule, refined step by step until successive results agree within the tolerance you set. Derivatives use central finite differences, refined the same way, and there are also right-sided and left-sided estimates for orders 1 and 2. You write the function with x, pi, e, the usual operators and functions such as sin, exp, ln, sqrt or abs, using a decimal point.

Angles are in radians, and ln and log both mean the natural logarithm. Bounds and the derivative point must lie between −10000 and 10000. The result is an approximation: the difference between refinement steps is shown as an error estimate, but it is not a guaranteed limit. If a sample is undefined, a value grows too large or the steps do not settle, the tool gives no result. Symbolic, improper and double integrals are not covered.

Example: the integral of sin(x) from 0 to pi comes out as 2.00000000403 after 451 function evaluations.

Worked example

With these example values the calculator gives the result below. You can change any value in the form above.

Inputs

Operation
Finite definite integral
Expression f(x)
sin(x)
Lower finite bound
0
Upper finite bound
3.1415926535898
Derivative point
0
Derivative order (1 or 2)
1
Refinement tolerance
1.0E-7

Result

Numerical estimate
2.00000000403
Difference-based error estimate (not a bound)
0.00000000403318297278
Function evaluations
451

Frequently asked questions

How do I calculate a definite integral numerically?

The numerical integral and derivative tool estimates a finite definite integral with composite Simpson refinement. For example, the integral of sin(x) between 0 and pi is approximately 2.

How is a numerical derivative calculated?

First and second derivatives are estimated with central finite difference refinement. Derivative mode also offers separate right-sided and left-sided estimates for orders 1 and 2.

Which functions can I use in the expression?

Expressions use x, pi, e, + - * / ^, parentheses and sin, cos, tan, atan, asin, acos, sinh, cosh, tanh, exp, ln or log, log10, sqrt, cbrt, abs and sign, with a decimal dot.

Are trigonometric functions in degrees or radians?

Radians. Arguments of sin and cos and results of atan, asin and acos are in radians, while ln and log both mean the natural logarithm and log10 is the base-10 logarithm.

What range can the bounds and the point have?

Integration bounds and the derivative point must lie between −10000 and 10000. Only the selected operation uses the bounds or the point and order.

How accurate is the numerical integral or derivative?

It is an approximation. Differences between refinement steps are estimates, not a rigorous error bound, and narrow peaks or oscillations can be missed. Undefined samples, excessive magnitudes or failure to converge are refused.

Can the tool handle improper or double integrals?

No. There is no symbolic, improper or double integral, and the tool does not prove differentiability.