int

Symbolic integral, indefinite or definite.

Category: Mathematics > Calculus

Syntax

F = int(f, x)

Antiderivative of f with respect to x, without the constant of integration.

F = int(f, x, a, b)

Definite integral from a to b.

Description

int applies integration rules, substitutions and integration by parts to find an exact result. Definite integrals are evaluated through the antiderivative, so int(x^2, x, 0, 3) gives the exact 9. The constant of integration is omitted.

When the engine cannot find a formula, the unevaluated int(f, x) is returned; numeric integration with integral is then an alternative.

Input arguments

f
Symbolic expression.
x
Integration variable.
a, b
Limits, possibly -Inf or Inf.

Output arguments

F
Symbolic result. When no closed form is found, the call is returned unevaluated as int(...).

Example

Antiderivative and definite integral

syms x
int(x*exp(x), x)
int(x^2, x, 0, 3)
int(1/x, x, 1, 2)
Output
ans = x*exp(x) - exp(x)
ans = 9
ans = log(2)

Notes

Some integrals that MATLAB solves, such as sin(x)^2 or the Gaussian over the real line, are returned unevaluated by MatLivre.

See also

diff integral symsum integrateByParts changeIntegrationVariable