int
Definite and indefinite integrals
Description
computes the integral of the symbolic expression F
= int(expr
)expr
.
Because you do not specify bounds for the integral, this syntax computes the
indefinite integral. int
uses the default integration
variable determined by symvar
(expr,1
). If expr
is a
constant, then the default integration variable is x
.
specifies additional options using one or more F
= int(___,Name=Value
)Name=Value
arguments. For example, IgnoreAnalyticConstraints=true
specifies that int
applies additional simplifications to the integrand.
Note
The int
function computes integral symbolically,
and it is not related to integer data types in MATLAB®. For more information about integers, see Integers.
Examples
Input Arguments
Tips
In contrast to differentiation, symbolic integration is a more complicated task. If
int
cannot compute an integral of an expression, check for these reasons:The antiderivative does not exist in a closed form.
The antiderivative exists, but
int
cannot find it.
If
int
cannot compute a closed form of an integral, it returns an unresolved integral.For some integrals that have closed form solutions, where these solutions are complicated and
int
returns unresolved integrals, you can usesimplify
to obtain the closed form solutions. For example, the following code finds the closed form solution of the integral off(x)
:syms x f(x) = x*log(x/2+sqrt(x^2+1)); F = int(f,x) simplify(F,Steps=10)
Otherwise, you can try approximating unresolved integrals by using one of these methods:
For indefinite integrals, use series expansions. Use this method to approximate an integral around a particular value of the variable.
For definite integrals, use numeric approximations.
For indefinite integrals,
int
does not return a constant of integration in the result. The results of integrating mathematically equivalent expressions may be different. For example,syms x; int((x+1)^2)
returns(x+1)^3/3
, whilesyms x; int(x^2+2*x+1)
returns(x*(x^2+3*x+3))/3
, which differs from the first result by1/3
.For indefinite integrals,
int
implicitly assumes that the integration variablevar
is real. For definite integrals,int
restricts the integration variablevar
to the specified integration interval. If one or both integration boundsa
andb
are not numeric,int
assumes thata <= b
unless you explicitly specify otherwise.
Algorithms
When you use IgnoreAnalyticConstraints
, int
applies some of these rules:
log(a) + log(b) = log(a·b) for all values of a and b. In particular, the following equality is valid for all values of a, b, and c:
(a·b)c = ac·bc.
log(ab) = b·log(a) for all values of a and b. In particular, the following equality is valid for all values of a, b, and c:
(ab)c = ab·c.
If f and g are standard mathematical functions and f(g(x)) = x for all small positive numbers, then f(g(x)) = x is assumed to be valid for all complex values x. In particular:
log(ex) = x
asin(sin(x)) = x, acos(cos(x)) = x, atan(tan(x)) = x
asinh(sinh(x)) = x, acosh(cosh(x)) = x, atanh(tanh(x)) = x
Wk(x·ex) = x for all branch indices k of the Lambert W function.
Version History
Introduced before R2006aSee Also
diff
| dsolve
| functionalDerivative
| symvar
| vpaintegral
| integrateByParts
| changeIntegrationVariable
| release
| rewrite