Wed Feb 11 00:57:32 MST 1998
aquarius% reduce
REDUCE 3.6, 15-Jul-95, patched to 15 Apr 96 ...

1: % ----------[ R e d u c e ]----------
% ---------- Initialization ----------
on time;


Time: 0 ms

% ---------- Indefinite Integrals ----------
% This integral only makes sense for x real => x |x|/2
int(abs(x), x);


 abs(x)*x
----------
    2

Time: 180 ms

% Calculus on a piecewise defined function
procedure a(x);
   if x < 0 then
      -x
   else
      x$


Time: 10 ms

% => if x < 0 then -x^2/2 else x^2/2
int(a(x), x);


***** x invalid as number

Cont? (Y or N)


?y
Time: 0 ms

clear a;


Time: 0 ms

% This would be very difficult to do by hand
% => 2^(1/3)/6 [1/2 log([x + 2^(1/3)]^2/[x^2 - 2^(1/3) x + 2^(2/3)])
%               + sqrt(3) arctan({[sqrt(3) x]/[2^(4/3) - x]   or
%                                 [2 x - 2^(1/3)]/[2^(1/3) sqrt(3)]})
%    [Gradshteyn and Ryzhik 2.126(1)]
1/(x^3 + 2);


   1
--------
  3
 x  + 2

Time: 0 ms

int(ws, x);


                            1/3
  1/3                      2    - 2*x           2/3    1/3      2
(2   *( - 2*sqrt(3)*atan(--------------) - log(2    - 2   *x + x )
                           1/3
                          2   *sqrt(3)

                 1/3
        + 2*log(2    + x)))/12

Time: 70 ms

df(ws, x);


   1
--------
  3
 x  + 2

Time: 10 ms

% This integral is easy if one realizes that 4^x = (2^x)^2
% => arcsinh(2^x)/log(2)   [Robert Israel in sci.math.symbolic]
int(2^x/sqrt(1 + 4^x), x);


           x       x
     sqrt(4  + 1)*2
int(-----------------,x)
          x
         4  + 1

Time: 70 ms

% => (-9 x^2 + 16 x - 41/5)/(2 x - 1)^(5/2)
%    [Gradshteyn and Ryzhik 2.244(8)]
int((3*x - 5)^2/(2*x - 1)^(7/2), x);


              2
        - 45*x  + 80*x - 41
----------------------------------
                     2
 5*sqrt(2*x - 1)*(4*x  - 4*x + 1)

Time: 30 ms

% => 1/[2 m sqrt(10)] log([-5 + e^(m x) sqrt(10)]/[-5 - e^(m x) sqrt(10)])
%    [Gradshteyn and Ryzhik 2.314]
int(1/(2*exp(m*x) - 5*exp(-m*x)), x);


                  m*x                      m*x
 sqrt(10)*(log(2*e    - sqrt(10)) - log(2*e    + sqrt(10)))
------------------------------------------------------------
                            20*m

Time: 70 ms

on combinelogs;


Time: 0 ms

ws;


                  m*x
               2*e    - sqrt(10)
 sqrt(10)*log(-------------------)
                  m*x
               2*e    + sqrt(10)
-----------------------------------
               20*m

Time: 60 ms

off combinelogs;


Time: 0 ms

% => -3/2 x + 1/4 sinh(2 x) + tanh x   [Gradshteyn and Ryzhik 2.423(24)]
int(sinh(x)^4/cosh(x)^2, x);


  6*x       4*x         4*x       2*x
 e    - 12*e   *x + 18*e    - 12*e   *x - 1
--------------------------------------------
                2*x   2*x
             8*e   *(e    + 1)

Time: 60 ms

% This example involves several symbolic parameters
% => 1/sqrt(b^2 - a^2) log([sqrt(b^2 - a^2) tan(x/2) + a + b]/
%                          [sqrt(b^2 - a^2) tan(x/2) - a - b])   (a^2 < b^2)
%    [Gradshteyn and Ryzhik 2.553(3)]
load_package(assist)$


Time: 110 ms

int(1/(a + b*cos(x)), x);


                            x            x
                       tan(---)*a - tan(---)*b
         2    2             2            2
 2*sqrt(a  - b )*atan(-------------------------)
                                  2    2
                            sqrt(a  - b )
-------------------------------------------------
                      2    2
                     a  - b

Time: 200 ms  plus GC time: 20 ms
df(ws, x);


      x  2  2        x  2  2    2    2        x  2  3        x  2  2
(tan(---) *a  - tan(---) *b  + a  - b )/(tan(---) *a  - tan(---) *a *b
      2              2                        2              2

           x  2    2        x  2  3    3    2        2    3
    - tan(---) *a*b  + tan(---) *b  + a  + a *b - a*b  - b )
           2                2

Time: 30 ms

trigreduce(ws);


      1
--------------
 cos(x)*b + a

Time: 40 ms

% The integral of 1/(a + 3 cos x + 4 sin x) can have 4 different forms
% depending on the value of a !   [Gradshteyn and Ryzhik 2.558(4)]
% => (a = 3) 1/4 log[3 + 4 tan(x/2)]
int(1/(3 + 3*cos(x) + 4*sin(x)), x);


            x
 log(4*tan(---) + 3)
            2
---------------------
          4

Time: 70 ms

% => (a = 4) 1/3 log([tan(x/2) + 1]/[tan(x/2) + 7])
int(1/(4 + 3*cos(x) + 4*sin(x)), x);


             x                   x
  - log(tan(---) + 7) + log(tan(---) + 1)
             2                   2
------------------------------------------
                    3

Time: 70 ms

on combinelogs;


Time: 0 ms

ws;


           x
      tan(---) + 1
           2
 log(--------------)
           x
      tan(---) + 7
           2
---------------------
          3

Time: 0 ms

off combinelogs;


Time: 0 ms

% => (a = 5) -1/[2 + tan(x/2)]
int(1/(5 + 3*cos(x) + 4*sin(x)), x);


          x
     tan(---)
          2
------------------
         x
 2*(tan(---) + 2)
         2

Time: 80 ms

% => (a = 6) 2/sqrt(11) arctan([3 tan(x/2) + 4]/sqrt(11))
int(1/(6 + 3*cos(x) + 4*sin(x)), x);


                         x
                  3*tan(---) + 4
                         2
 2*sqrt(11)*atan(----------------)
                     sqrt(11)
-----------------------------------
                11

Time: 90 ms

% => x log|x^2 - a^2| - 2 x + a log|(x + a)/(x - a)|
%    [Gradshteyn and Ryzhik 2.736(1)]
int(log(abs(x^2 - a^2)), x);


            2    2                2    2
 - log(abs(a  - x ))*a + log(abs(a  - x ))*x + 2*log( - a - x)*a - 2*x

Time: 180 ms

% => (a x)/2 + (pi x^2)/4 - 1/2 (x^2 + a^2) arctan(x/a)
%       [Gradshteyn and Ryzhik 2.822(4)]   or
%    (a x)/2 + 1/2 (x^2 + a^2) arccot(x/a)   [Gradshteyn and Ryzhik 2.853(2)]
int(x*acot(x/a), x);


       x    2         x    2
 acot(---)*a  + acot(---)*x  + a*x
       a              a
-----------------------------------
                 2

Time: 50 ms

% => [sin(5 x) Ci(2 x)]/5 - [Si(7 x) + Si(3 x)]/10
%    [Gradshteyn and Ryzhik 5.31(1)]
int(cos(5*x)*Ci(2*x), x);


int(ci(2*x)*cos(5*x),x)

Time: 130 ms  plus GC time: 40 ms
% => 1/2 [f(x) - g(x)]/[f(x) + g(x)]   [Gradshteyn and Ryzhik 2.02(25)]
operator f, g;


Time: 0 ms

int((df(f(x), x)*g(x) - f(x)*df(g(x), x))/(f(x)^2 - g(x)^2), x);


     df(f(x),x)*g(x)            df(g(x),x)*f(x)
int(-----------------,x) - int(-----------------,x)
          2       2                  2       2
      f(x)  - g(x)               f(x)  - g(x)

Time: 100 ms

% ---------- Quit ----------
quit;

Quitting

real 11.14
user 1.86
sys 1.35
