File r37/packages/misc/limits.rlg artifact 42a439015a part of check-in 5f584e9b52


Sun Jun  6 19:47:21 MET DST 1999
REDUCE 3.7, 15-Apr-1999 ...

1: 1: 
2: 2: 2: 2: 2: 2: 2: 2: 2: 
3: 3: % Tests of limits package.

limit(sin(x)/x,x,0);


1
 % 1
limit(sin(x)^2/x,x,0);


0
 % 0
limit(sin(x)/x,x,1);


sin(1)
 % sin(1)
limit(1/x,x,0);


infinity
 % infinity
limit(-1/x,x,0);


 - infinity
 % - infinity
limit((sin(x)-x)/x^3,x,0);


  - 1
------
  6
 % -1/6
limit(x*sin(1/x),x,infinity);


1
 % 1
limit(sin x/x^2,x,0);


infinity
 % infinity
limit(x^2*sin(1/x),x,infinity);


infinity
 % infinity

% Simple examples from Schaum's Theory & Problems of Advanced Calculus

limit(x^2-6x+4,x,2);


-4
 % -4
limit((x+3)*(2x-1)/(x^2+3x-2),x,-1);


 3
---
 2
 % 3/2
limit((sqrt(4+h)-2)/h,h,0);


 1
---
 4
 % 1/4
limit((sqrt(x)-2)/(4-x),x,4);


  - 1
------
  4
 % -1/4
limit((x^2-4)/(x-2),x,2);


4
 % 4
limit(1/(2x-5),x,-1);


  - 1
------
  7
 % -1/7
limit(sqrt(x)/(x+1),x,1);


 1
---
 2
 % 1/2
limit((2x+5)/(3x-2),x,infinity);


 2
---
 3
 % 2/3
limit((1/(x+3)-2/(3x+5))/(x-1),x,1);


 1
----
 32
 % 1/32
limit(sin(3x)/x,x,0);


3
 % 3
limit((1-cos(x))/x^2,x,0);


 1
---
 2
 % 1/2
limit((6x-sin(2x))/(2x+3*sin(4x)),x,0);


 2
---
 7
 % 2/7
limit((1-2*cos(x)+cos(2x))/x^2,x,0);


-1
 % -1
limit((3*sin(pi*x) - sin(3*pi*x))/x^3,x,0);


    3
4*pi
 % 4*pi^3
limit((cos(a*x)-cos(b*x))/x^2,x,0);


     2    2
  - a  + b
------------
     2
 % (-a^2 + b^2)/2
limit((e^x-1)/x,x,0);


1
 % 1
limit((a^x-b^x)/x,x,0);


log(a) - log(b)
 % log(a) - log(b)

% Examples taken from Hyslop's Real Variable

limit(sinh(2x)^2/log(1+x^2),x,0);


4
 % 4
limit(x^2*(e^(1/x)-1)*(log(x+2)-log(x)),x,infinity);


2
 % 2
limit(x^alpha*log(x+1)^2/log(x),x,infinity);


                        2
       alpha  log(x + 1)
limit(x     *-------------,x,infinity)
                log(x)

  %% if repart alpha < 0 then 0 else infinity.
  %% fails because answer depends in essential way on parameter.

limit((2*cosh(x)-2-x^2)/log(1+x^2)^2,x,0);


 1
----
 12
 % 1/12
limit((x*sinh(x)-2+2*cosh(x))/(x^4+2*x^2),x,0);


1
 % 1
limit((2*sinh(x)-tanh(x))/(e^x-1),x,0);


1
 % 1
limit(x*tanh(x)/(sqrt(1-x^2)-1),x,0);


-2
 % -2
limit((2*log(1+x)+x^2-2*x)/x^3,x,0);


 2
---
 3
 % 2/3
limit((e^(5*x)-2*x)^(1/x),x,0);


 3
e
 % e^3
limit(log(log(x))/log(x)^2,x,infinity);


0
 % 0

% These are adapted from Lession 4 from Stoutmyer

limit((e^x-1)/x, x, 0);


1
 % 1
limit(((1-x)/log(x))**2, x, 1);


1
 % 1
limit(x/(e**x-1), x, 0);


1
 % 1

%% One sided limits
limit!+(sin(x)/sqrt(x),x,0);


0
 % 0
limit!-(sin(x)/sqrt(x),x,0);


0
 % 0


limit(x/log x,x,0);


0
 % 0
limit(log(1 + x)/log x,x,infinity);


1
 % 1
limit(log x/sqrt x,x,infinity);


0
 % 0
limit!+(sqrt x/sin x,x,0);


infinity
 % infinity
limit(log x,x,0);


 - infinity
 % - infinity
limit(x*log x,x,0);


0
 % 0
limit(log x/log(2x),x,0);


1
 % 1
limit(log x*log(1+x)*(1+x),x,0);


0
 % 0
limit(log x/x,x,infinity);


0
 % 0
limit(log x/sqrt x,x,infinity);


0
 % 0
limit(log x,x,infinity);


infinity
 % infinity
limit(log(x+1)/sin x,x,0);


1
 % 1
limit(log(1+1/x)*sin x,x,0);


0
 % 0
limit(-log(1+x)*(x+2)/sin x,x,0);


-2
 % -2
limit(-log x*(3+x)/log(2x),x,0);


-3
 % -3
limit(log(x+1)^2/sqrt x,x,infinity);


0
 % 0
limit(log(x + 1) - log x,x,infinity);


0
 % 0
limit(-(log x)^2/log log x,x,infinity);


 - infinity
 % - infinity
limit(log(x-1)/sin x,x,0);


sign(log(-1))*infinity
 % infinity

limit!-(sqrt x/sin x,x,0);


 - sign(i)*infinity
 % infinity
limit(log x-log(2x),x,0);


 - log(2)
 % - log(2)
limit(sqrt x-sqrt(x+1),x,infinity);


0
 % 0

limit(sin sin x/x,x,0);


1
 % 1
limit!-(sin x/cos x,x,pi/2);


infinity
 % infinity % this works!
limit!+(sin x/cos x,x,pi/2);


 - infinity
 % - infinity % so does this!
limit(sin x/cosh x,x,infinity);


0
 % 0
limit(sin x/x,x,infinity);


0
 % 0
limit(x*sin(1/x),x,0);


0
 % 0
limit(exp x/((exp x + exp(-x))/2),x,infinity);


2
 % 2
% limit(exp x/cosh x,x,infinity); % fails in this form, but if cosh is
  %defined using let, then it works.
limit((sin(x^2)/(x*sinh x)),x,0);


1
 % 1
limit(log x*sin(x^2)/(x*sinh x),x,0);


 - infinity
 % - infinity
limit(sin(x^2)/(x*sinh x*log x),x,0);


0
 % 0
limit(log x/log(x^2),x,0);


 1
---
 2
 % 1/2
limit(log(x^2)-log(x^2+8x),x,0);


 - infinity
 % - infinity
limit(log(x^2)-log(x^2+8x),x,infinity);


0
 % 0
limit(sqrt(x+5)-sqrt x,x,infinity);


0
 % 0
limit(2^(log x),x,0);


0
 % 0

% Additional examples
limit((sin tan x-tan sin x)/(asin atan x-atan asin x),x,0);


1
 % 1

% This one has the value infinity, but fails with de L'Hospital's rule:
limit((e+1)^(x^2)/e^x,x,infinity);


               2
              x
       (e + 1)
limit(-----------,x,infinity)
           x
          e
 % infinity  % fails

comment
The following examples were not in the previous set$


% Simon test examples:
limit(log(x-a)/((a-b)*(a-c)) + log(2(x-b))/((b-c)*(b-a))
      + log(x-c)/((c-a)*(c-b)),x,infinity);


       - log(2)
----------------------
              2
 a*b - a*c - b  + b*c
 % log(1/2)/((a-b)*(b-c))

limit(1/(e^x-e^(x-1/x^2)),x,infinity);


             1
limit(----------------,x,infinity)
                    2
        x    x - 1/x
       e  - e
 % infinity  % fails

% new capabilities: branch points at the origin, needed for definite
% integration.

limit(x+sqrt x,x,0);


0
 % 0
limit!+(sqrt x/(x+1),x,0);


0
 % 0
limit!+(x^(1/3)/(x+1),x,0);


0
 % 0
limit(log(x)^2/x^(1/3),x,0);


infinity
 % infinity
limit(log x/x^(1/3),x,0);


 - infinity
 % - infinity

h := (X^(1/3) + 3*X**(1/4))/(7*(SQRT(X + 9) - 3)**(1/4));


             1/4    1/3
          3*x    + x
h := ------------------------
                         1/4
      7*(sqrt(x + 9) - 3)

limit(h,x,0);


    1/4
 3*6
--------
   7
 % 3/7*6^(1/4)

% Examples from Paul S. Wang's thesis:

limit(x^log(1/x),x,infinity);


0
 % 0
limit(cos x - 1/(e^x^2 - 1),x,0);


 - infinity
 % - infinity
limit((1+a*x)^(1/x),x,infinity);


1
 % 1
limit(x^2*sqrt(4*x^4+5)-2*x^4,x,infinity);


 5
---
 4
 % 5/4
limit!+(1/x-1/sin x,x,0);


0
 % 0
limit(e^(x*sqrt(x^2+1))-e^(x^2),x,infinity);


               2          2
       x*sqrt(x  + 1)    x
limit(e               - e  ,x,infinity)
 % 0 fails
limit((e^x+x*log x)/(log(x^4+x+1)+e^sqrt(x^3+1)),x,infinity);


                 x
                e  + x*log(x)
limit(---------------------------------,x,infinity)
                                3
            4             sqrt(x  + 1)
       log(x  + x + 1) + e
 %0 % fails
limit!-(1/(x^3-6*x+11*x-6),x,2);


 1
----
 12
 % 1/12
limit((x*sqrt(x+5))/(sqrt(4*x^3+1)+x),x,infinity);


 1
---
 2
 % 1/2
limit!-(tan x/log cos x,x,pi/2);


 - infinity
 % - infinity

z0 := z*(z-2*pi*i)*(z-pi*i/2)/(sinh z - i);


                            2      2
       z*( - 5*i*pi*z - 2*pi  + 2*z )
z0 := --------------------------------
              2*(sinh(z) - i)

limit(df(z0,z),z,pi*i/2);


sign(i)*infinity
 % infinity
z1 := z0*(z-pi*i/2);


                3            2       2        3
       z*(2*i*pi  - 12*i*pi*z  - 9*pi *z + 4*z )
z1 := -------------------------------------------
                    4*(sinh(z) - i)

limit(df(z1,z),z,pi*i/2);


 - 2*pi
 % -2*pi

% and the analogous problem:
z2 := z*(z-2*pi)*(z-pi/2)/(sin z - 1);


              2               2
       z*(2*pi  - 5*pi*z + 2*z )
z2 := ---------------------------
            2*(sin(z) - 1)

limit(df(z2,z),z,pi/2);


 - infinity
 % infinity
z3 := z2*(z-pi/2);


                 3       2            2      3
       z*( - 2*pi  + 9*pi *z - 12*pi*z  + 4*z )
z3 := ------------------------------------------
                    4*(sin(z) - 1)

limit(df(z3,z),z,pi/2);


2*pi
 % 2*pi

% A test by Wolfram Koepf.
f:=x^2/(3*(-27*x^2 - 2*x^3 + 3^(3/2)*(27*x^4 + 4*x^5)^(1/2))^(1/3));


                             2
                            x
f := -------------------------------------------------
         2/3                                      1/3
      3*x   *(3*sqrt(4*x + 27)*sqrt(3) - 2*x - 27)

L0:=limit(f,x,0);


l0 := 0
 % L0 := 0
f1:=((f-L0)/x^(1/3))$


L1:=limit(f1,x,0);


l1 := 0
 % L1 := 0
f2:=((f1-L1)/x^(1/3))$


L2:=limit(f2,x,0);


        - 1
l2 := ------
        1/3
       2
 % L2 := -1/2^(1/3)
f3:=((f2-L2)/x^(1/3))$


L3:=limit(f3,x,0);


l3 := 0
 % L3 := 0
f4:=((f3-L3)/x^(1/3))$


L4:=limit(f4,x,0);


l4 := 0
 % L4 := 0
f5:=((f4-L4)/x^(1/3))$


L5:=limit(f5,x,0);


           2/3
        - 2
l5 := ---------
         81
 % L5 = -2^(2/3)/81
f6:=((f5-L5)/x^(1/3))$


L6:=limit(f6,x,0);


l6 := 0
 % L6 := 0
f7:=((f6-L6)/x^(1/3))$


L7:=limit(f7,x,0);


l7 := 0
 % L7 := 0
f8:=((f7-L7)/x^(1/3))$


L8:=limit(f8,x,0);


           7
l8 := -----------
             1/3
       6561*2
 % L8 := 7/(6561*2^(1/3))

limit(log(1+x)^2/x^(1/3),x,infinity);


0
  % 0
limit(e^(log(1+x)^2/x^(1/3)),x,infinity);


1
 % 1

ss := (sqrt(x^(2/5) +1) - x^(1/3)-1)/x^(1/3);


             2/5         1/3
       sqrt(x    + 1) - x    - 1
ss := ---------------------------
                  1/3
                 x

limit(ss,x,0);


-1
 % -1
limit(exp(ss),x,0);


 1
---
 e
 % 1/e
limit(log x,x,-1);


log(-1)
 % log(-1)
limit(log(ss),x,0);


log(-1)
 % log(-1)

ss := ((x^(1/2) - 1)^(1/3) + (x^(1/5) + 1)^2)/x^(1/5);


                    1/3    2/5      1/5
       (sqrt(x) - 1)    + x    + 2*x    + 1
ss := --------------------------------------
                        1/5
                       x

limit(ss,x,0);


2
 % 2

h := (X^(1/5) + 3*X**(1/4))^2/(7*(SQRT(X + 9) - 3 - x/6))**(1/5);


       1/5     9/20    2/5
      6   *(6*x     + x    + 9*sqrt(x))
h := -----------------------------------
                              1/5  1/5
      (6*sqrt(x + 9) - x - 18)   *7

limit(h,x,0);


     3/5
  - 6
---------
   1/5
  7
 % -6^(3/5)/7^(1/5)

end;

4: 4: 4: 4: 4: 4: 4: 4: 4: 

Time for test: 10400 ms, plus GC time: 350 ms

5: 5: 
Quitting
Sun Jun  6 19:47:46 MET DST 1999


REDUCE Historical
REDUCE Sourceforge Project | Historical SVN Repository | GitHub Mirror | SourceHut Mirror | NotABug Mirror | Chisel Mirror | Chisel RSS ]