### 5.19.1 Limits : limit

limit computes the limit of an expression at a finite or infinite point. It is also possible with an optional argument to compute a one-sided limit (1 for the right limit and -1 for the left limit).
limit takes three or four arguments :
an expression, the name of a variable (for example x), the limit point (for example a) and an optional argument, by default 0, to indicate if the limit is unidirectional. This argument is equal to -1 for a left limit (x<a) or is equal to 1 for a right limit (x>a) or is equal to 0 for a limit.
limit returns the limit of the expression when the variable (for example x) approaches the limit point (for example a).
Remark
It is also possible to put x=a as argument instead of x,a, hence : limit takes also as arguments an expression depending of a variable, an equality (variable =value of the limit point) and perhaps 1 or -1 to indicate the direction.
Input :

limit(1/x,x,0,-1)

or :

limit(1/x,x=0,-1)

Output :

-(infinity)

Input :

limit(1/x,x,0,1)

or :

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

Output :

+(infinity)

Input :

limit(1/x,x,0,0)

or :

limit(1/x,x,0)

or :

limit(1/x,x=0)

Output :

infinity

Hence, abs(1/x) approaches +∞ when x approaches 0.

Exercises :

- Find for n>2, the limit when x approaches 0 of :

  ntan(x)−tan(nx)
  sin(nx)−nsin(x)

  Input :
  limit((n*tan(x)-tan(n*x))/(sin(n*x)-n*sin(x)),x=0)
  Output :
  2
- Find the limit when x approaches +∞ of :

  √
  x+ |
  √
  x+ | √ |
  x
  | − | √ |
  x

  Input :
  limit(sqrt(x+sqrt(x+sqrt(x)))-sqrt(x),x=+infinity)
  Output :
  1/2
- Find the limit when x approaches 0 of :

  √ |
  1+x+x2/2
  | −exp(x/2)
  (1−cos(x))sin(x)

  Input :
  limit((sqrt(1+x+x`^`2/2)-exp(x/2))/((1-cos(x))*sin(x)),x,0)
  Output :
  -1/6

Remark
To compute limits, it is better sometimes to quote the first argument.
Input :

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

Note that the first argument is quoted, because it is better that this argument is not simplified (i.e. not evaluated).
Output :

+(infinity)