Previous Page Next Page Contents

limit -- compute a limit

Introduction

limit(f, x = x0) computes the bidirectional limit lim(f(x), x = x0).

limit(f, x = x0, Left) computes the one-sided limit lim(f(x), x = x0-).

limit(f, x = x0, Right) computes the one-sided limit lim(f(x), x = x0+).

Call(s)

limit(f, x <= x0> <, dir>)

Parameters

f - an arithmetical expression representing a function in x
x - an identifier
x0 - the limit point: an arithmetical expression, possibly infinity or -infinity

Options

dir - either Left or Right. This controls the direction of the limit computation.

Returns

an arithmetical expression, an interval of type Dom::Interval, an expression of type "limit", or FAIL.

Side Effects

The function is sensitive to the environment variable ORDER, which determines the default number of terms in series computations (see series and example 6 below).

Properties of identifiers set by assume are taken into account.

Overloadable:

f

Related Functions

asympt, diff, discont, int, O, series, taylor

Details

Example 1

The following command computes lim( (1-cos(x)/x^2),x=0 ):

>> limit((1 - cos(x))/x^2, x)
                                    1/2

A possible definition of e is given by the limit of the sequence (1+1/n)^n for n->infinity:

>> limit((1 + 1/n)^n, n = infinity)
                                  exp(1)

Here is a more complex example:

>> limit(
     (exp(x*exp(-x)/(exp(-x) + exp(-2*x^2/(x+1)))) - exp(x))/x,
     x = infinity
   )
                                  -exp(2)

Example 2

The bidirectional limit of f(x)=1/x for x -> 0 does not exist:

>> limit(1/x, x = 0)
                                 undefined

You can compute the one-sided limits from the left and from the right by passing the options Left and Right, respectively:

>> limit(1/x, x = 0, Left), 
   limit(1/x, x = 0, Right)
                            -infinity, infinity

Example 3

If limit is not able to compute the limit, then a symbolic limit call is returned:

>> delete f: limit(f(x), x = infinity)
                         limit(f(x), x = infinity)

Example 4

The function sin(x) oscillates for x -> infinity. The limes inferior and the limes superior are -1 and 1, respectively:

>> limit(sin(x), x = infinity)
                                  [-1, 1]

In fact, for x -> infinity the function f=sin(x) assumes every value in the returned interval infinitely often. This need not be the case in general.

Example 5

limit is not able to compute the limit of x^n for x -> infinity without additional information about the parameter n:

>> delete n: limit(x^n, x = infinity)
      Warning: cannot determine sign of n [stdlib::limit::limitMRV]
      
                                 n
                          limit(x , x = infinity)

However, for n > 0 the limit exists and equals infinity. We use assume to achieve this:

>> assume(n > 0): limit(x^n, x = infinity)
                                 infinity

Similarly, the limit is zero for n < 0:

>> assume(n < 0): limit(x^n, x = infinity)
                                     0

Example 6

It may be necessary to increase the value of the environment variable ORDER in order to find the limit, as in the following example:

>> limit((sin(tan(x)) - tan(sin(x)))/x^7, x = 0)
      Warning: ORDER seems to be not big enough for series \
      computation [stdlib::limit::lterm]
      
                                   FAIL
>> ORDER := 8: limit((sin(tan(x)) - tan(sin(x)))/x^7, x)
                                   -1/30

Background

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000