Previous Page Next Page Contents

int -- definite and indefinite integration

Introduction

int(f, x) computes the indefinite (formal) integral int(f,x).

int(f, x = a..b) computes the definite integral int(f,x=a..b).

Call(s)

int(f, x)
int(f, x = a..b <, Continuous>)
int(f, x = a..b <, PrincipalValue>)

Parameters

f - the integrand: an arithmetical expression representing a function in x
x - the integration variable: an identifier
a, b - the boundaries: arithmetical expressions

Options

Continuous - do not look for discontinuities.
PrincipalValue - compute the Cauchy principal value of the integral.

Returns

an arithmetical expression.

Overloadable:

f

Side Effects

int is sensitive to properties of identifiers set by assume; see example 4.

Further Documentation

Section 7.2 of the MuPAD Tutorial.

Related Functions

D, diff, intlib, limit, numeric::int, sum

Details

Option: Continuous

Option: PrincipalValue

Example 1

We compute the two indefinite integrals int(1/x/ln(x), x) and int(1/(x^2-8), x):

>> int(1/x/ln(x), x)
                                 ln(ln(x))
>> int(1/(x^2 - 8), x)
                  1/2           1/2     1/2           1/2
                 2    ln(x - 2 2   )   2    ln(x + 2 2   )
                 ------------------- - -------------------
                          8                     8

We compute the definite integral of (x*ln(x))^(-1) over the interval [e, e^2]:

>> int(1/x/ln(x), x = E..E^2)
                                   ln(2)  

The boundaries of definite integrals may be +-infinity as well:

>> int(exp(-x^2), x = 0..infinity)
                                     1/2
                                   PI
                                   -----
                                     2

One can also determine multiple integrals such as, e.g., the definite multiple integral int(int(int(1, z=0..c*(1-x/a-y/b)), y=0..b*(1-x/a)), x=0..a):

>> int(int(int(1, z = 0..c*(1 - x/a - y/b)),
           y = 0..b*(1 - x/a)), x = 0..a)
                                   a b c
                                   -----
                                     6

Example 2

The system cannot find a closed form for the following definite integral and returns a symbolic int call. You can obtain a floating point approximation by applying float to the result:

>> int(sin(cos(x)), x = 0..1)
                        int(sin(cos(x)), x = 0..1)
>> float(%)
                                0.738642998

Alternatively, you can use the function numeric::int. This is recommended if you are interested only in a numerical approximation, since it does not involve any symbolic preprocessing and is therefore usually much faster than applying float to a symbolic int call.

>> numeric::int(sin(cos(x)), x = 0..1)
                                0.738642998

Example 3

int cannot find a closed form for the following indefinite integral and returns a symbolic int call:

>> int((x^2 + 1)/sqrt(x^3 + 1), x)    
                              /    2           \
                              |   x  + 1       |
                           int| -----------, x |
                              |   3     1/2    |
                              \ (x  + 1)       /

You can use series to obtain a series expansion of the integral:

>> series(%, x = 0)
                              3    4    6
                             x    x    x       7
                         x + -- - -- - -- + O(x )
                             3    8    12

Alternatively, you can compute a series expansion of the integrand and integrate it afterwards. This is recommended if you are not interested in a closed form of the integral, but only in a series expansion, since it is usually much faster than the other way round:

>> int(series((x^2 + 1)/sqrt(x^3 + 1), x = 0), x)
                              3    4    6
                             x    x    x       7
                         x + -- - -- - -- + O(x )
                             3    8    12

Example 4

int correctly asserts that the following definite integral, where the integrand has a pole in the interior of the interval of integration, is not defined:

>> int(1/(x - 1), x = 0..2)
                                 undefined

However, the Cauchy principle value of the integral exists:

>> int(1/(x - 1), x = 0..2, PrincipalValue)
                                     0

If, however, the integrand contains a parameter, then int may not be able to decide whether the integrand has poles in the interval of integration. In such a case, a warning is issued and a symbolic int call is returned:

>> int(1/(x - a), x = 0..2)           
      Warning: Found potential discontinuities of the antiderivative\
      .
      Try option 'Continuous' or use properties (?assume). [intlib::\
      antiderivative]
      
                             /   1             \
                          int| -----, x = 0..2 |
                             \ x - a           /

We follow the suggestion given by the text of the warning and make an assumption on the parameter a implying that the integrand has no poles in the interval of integration. In this example, int is able to find a closed form of the integral:

>> assume(a > 2): int(1/(x - a), x = 0..2)
                            ln(2 - a) - ln(-a)

Alternatively, we can use the option Continuous to tell int that it may assume that the integrand is continuous in the range of integration:

>> unassume(a): int(1/(x - a), x = 0..2, Continuous)
                            ln(2 - a) - ln(-a)

Mathematically, the result with option Continuous may be incorrect for some values of the occurring parameters. In the example above, the result is incorrect for 0 < a < 2. We therefore recommend to use this option only as a last resort.

Example 5

In this example we will stress the effects of assumptions on the integration variable. See ``background'' section for more details.

The integration variable is implicitly assumed to be real, or even for a given (real) interval of integration restricted to that interval. Among other things this assumption has an impact on the simplification of results.

For example, to compute the following integral internally the so-called Risch algorithm is used and only because of that implicit assumption the result is simplified into a real representation.

>> int(1/cos(x)^2, x)
                                2 sin(2 x)
                              --------------
                              2 cos(2 x) + 2

In order to see what will happen without this implicit assumption one can explicitly define the integration variable to be complex:

>> assume(x, Type::Complex): int(1/cos(x)^2, x)
                                     2 I
                        - -------------------------
                          cos(2 x) - I sin(2 x) + 1

User-defined assumptions which are inconsistent with the assumptions made internally in the integration do not lead to an integration error as they should. However, the user must become aware of the inconsistency.

>> assume(x, Type::Imaginary): int(1/cos(x)^2, x)
      Warning: Cannot integrate when x has property Type::Imaginary.
      While integrating, we will assume x has property Type::Complex\
      . [intlib::int]
      
                                     2 I
                        - -------------------------
                          cos(2 x) - I sin(2 x) + 1
>> assume(x, Type::Integer): int(1/cos(x)^2, x)
      Warning: Cannot integrate when x has property Type::Integer.
      While integrating, we will assume x has property Type::Real. [\
      intlib::int]
      
                                2 sin(2 x)
                              --------------
                              2 cos(2 x) + 2

The same holds for definite integration.

>> assume(x, Type::Interval(-5, -2)): int(x, x = 0..1)
      Warning: While integrating, we will assume x has property [0, \
      1] of Type::Real instead of given property ]-5, -2[ of Type::R\
      eal. [intlib::defInt]
      
                                    1/2

Background

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000