# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# int

Definite and indefinite integrals

## Syntax

``int(expr,var)``
``int(expr,var,a,b)``
``int(___,Name,Value)``

## Description

example

````int(expr,var)` computes the indefinite integral of `expr` with respect to the symbolic scalar variable `var`. Specifying the variable `var` is optional. If you do not specify it, `int` uses the default variable determined by `symvar`. If `expr` is a constant, then the default variable is `x`.```

example

````int(expr,var,a,b)` computes the definite integral of `expr` with respect to `var` from `a` to `b`. If you do not specify it, `int` uses the default variable determined by `symvar`. If `expr` is a constant, then the default variable is `x`.`int(expr,var,[a,b])`, ```int(expr,var,[a b])```, and `int(expr,var,[a;b])` are equivalent to `int(expr,var,a,b)`.```

example

````int(___,Name,Value)` uses additional options specified by one or more `Name,Value` pair arguments.```

## Examples

### Indefinite Integral of Univariate Expression

Find an indefinite integral of this univariate expression:

```syms x int(-2*x/(1 + x^2)^2)```
```ans = 1/(x^2 + 1)```

### Indefinite Integrals of Multivariate Expression

Find indefinite integrals of this multivariate expression with respect to the variables `x` and `z`:

```syms x z int(x/(1 + z^2), x) int(x/(1 + z^2), z)```
```ans = x^2/(2*(z^2 + 1)) ans = x*atan(z)```

If you do not specify the integration variable, `int` uses the variable returned by `symvar`. For this expression, `symvar` returns `x`:

`symvar(x/(1 + z^2), 1)`
```ans = x```

### Definite Integrals of Univariate Expressions

Integrate this expression from `0` to `1`:

```syms x int(x*log(1 + x), 0, 1)```
```ans = 1/4```

Integrate this expression from `sin(t)` to `1` specifying the integration range as a vector:

```syms x t int(2*x, [sin(t), 1])```
```ans = cos(t)^2```

### Integrals of Matrix Elements

Find indefinite integrals for the expressions listed as the elements of a matrix:

```syms a x t z int([exp(t), exp(a*t); sin(t), cos(t)])```
```ans = [ exp(t), exp(a*t)/a] [ -cos(t), sin(t)]```

### Apply IgnoreAnalyticConstraints

Compute this indefinite integral. By default, `int` uses strict mathematical rules. These rules do not let `int` rewrite `asin(sin(x))` and `acos(cos(x))` as `x`.

```syms x int(acos(sin(x)), x)```
```ans = x*acos(sin(x)) + x^2/(2*sign(cos(x)))```

If you want a simple practical solution, try `IgnoreAnalyticConstraints`:

`int(acos(sin(x)), x, 'IgnoreAnalyticConstraints', true)`
```ans = -(x*(x - pi))/2```

### Ignore Special Cases

Compute this integral with respect to the variable `x`:

```syms x t int(x^t, x)```

By default, `int` returns the integral as a piecewise object where every branch corresponds to a particular value (or a range of values) of the symbolic parameter `t`:

```ans = piecewise(t == -1, log(x), t ~= -1, x^(t + 1)/(t + 1))```

To ignore special cases of parameter values, use `IgnoreSpecialCases`:

`int(x^t, x, 'IgnoreSpecialCases', true)`

With this option, `int` ignores the special case `t=-1` and returns only the branch where `t<>–1`:

```ans = x^(t + 1)/(t + 1)```

### Find Cauchy Principal Value

Compute this definite integral, where the integrand has a pole in the interior of the interval of integration. Mathematically, this integral is not defined.

```syms x int(1/(x - 1), x, 0, 2)```
```ans = NaN```

However, the Cauchy principal value of the integral exists. Use `PrincipalValue` to compute the Cauchy principal value of the integral:

`int(1/(x - 1), x, 0, 2, 'PrincipalValue', true)`
```ans = 0```

### Approximate Indefinite Integrals

If `int` cannot compute a closed form of an integral, it returns an unresolved integral:

```syms x F = sin(sinh(x)); int(F, x)```
```ans = int(sin(sinh(x)), x)```

If `int` cannot compute a closed form of an indefinite integral, try to approximate the expression around some point using `taylor`, and then compute the integral. For example, approximate the expression around x = 0:

`int(taylor(F, x, 'ExpansionPoint', 0, 'Order', 10), x)`
```ans = x^10/56700 - x^8/720 - x^6/90 + x^2/2```

### Approximate Definite Integrals

Compute this definite integral:

```syms x F = int(cos(x)/sqrt(1 + x^2), x, 0, 10)```
```F = int(cos(x)/(x^2 + 1)^(1/2), x, 0, 10)```

If `int` cannot compute a closed form of a definite integral, try approximating that integral numerically using `vpa`. For example, approximate `F` with five significant digits:

`vpa(F, 5)`
```ans = 0.37571```

## Input Arguments

collapse all

Integrand, specified as a symbolic expression or function, a constant, or a vector or matrix of symbolic expressions, functions, or constants.

Integration variable, specified as a symbolic variable. If you do not specify this variable, `int` uses the default variable determined by `symvar(expr,1)`. If `expr` is a constant, then the default variable is `x`.

Lower bound, specified as a number, symbolic number, variable, expression or function (including expressions and functions with infinities).

Upper bound, specified as a number, symbolic number, variable, expression or function (including expressions and functions with infinities).

### Name-Value Pair Arguments

Specify optional comma-separated pairs of `Name,Value` arguments. `Name` is the argument name and `Value` is the corresponding value. `Name` must appear inside single quotes (`' '`). You can specify several name and value pair arguments in any order as `Name1,Value1,...,NameN,ValueN`.

Example: `'IgnoreAnalyticConstraints',true` specifies that `int` applies purely algebraic simplifications to the integrand.

collapse all

Indicator for applying purely algebraic simplifications to integrand, specified as `true` or `false`. If the value is `true`, apply purely algebraic simplifications to the integrand. This option can provide simpler results for expressions, for which the direct use of the integrator returns complicated results. In some cases, it also enables `int` to compute integrals that cannot be computed otherwise.

Note that using this option can lead to wrong or incomplete results.

Indicator for ignoring special cases, specified as `true` or `false`. If the value is `true` and integration requires case analysis, ignore cases that require one or more parameters to be elements of a comparatively small set, such as a fixed finite set or a set of integers.

Indicator for returning principal value, specified as `true` or `false`. If the value is `true`, compute the Cauchy principal value of the integral.

## Tips

• In contrast to differentiation, symbolic integration is a more complicated task. If `int` cannot compute an integral of an expression, one of these reasons might apply:

• 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.

Try approximating such 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.

• Results returned by `int` do not include integration constants.

• For indefinite integrals, `int` implicitly assumes that the integration variable `var` is real. For definite integrals, `int` restricts the integration variable `var` to the specified integration interval. If one or both integration bounds `a` and `b` are not numeric, `int` assumes that ```a <= b``` unless you explicitly specify otherwise.

## Algorithms

When you use `IgnoreAnalyticConstraints`, `int` applies 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

• lambertWk(x·ex) = x for all values of k