File r34/xlog/arnum.log artifact 577681da1c part of check-in 3519b83598


Sat Jun 29 14:07:47 PDT 1991
REDUCE 3.4, 15-Jul-91 ...

1: 1: 
2: 2: 
3: 3: % Test of algebraic number package.

defpoly sqrt2**2-2;



1/(sqrt2+1);


SQRT2 - 1


(x**2+2*sqrt2*x+2)/(x+sqrt2);


X + SQRT2


on gcd;



(x**3+(sqrt2-2)*x**2-(2*sqrt2+3)*x-3*sqrt2)/(x**2-2);


  2
 X  - 2*X - 3
--------------
  X - SQRT2


off gcd;



sqrt(x**2-2*sqrt2*x*y+2*y**2);


X - SQRT2*Y


off arnum;

  %to start a new algebraic extension.


defpoly cbrt5**3-5;



on rationalize;



1/(x-cbrt5);


  2                  2
 X  + CBRT5*X + CBRT5
-----------------------
         3
        X  - 5


off rationalize;



off arnum;

  %to start a new algebraic extension.


%The following examples are taken from P.S. Wang Math. Comp. 30,
%    134,(1976),p.324.

on factor;



defpoly i**2+1=0;



w0 := x**2+1;


W0 := (X + I)*(X - I)


w1 := x**4-1;


W1 := (X + I)*(X - I)*(X + 1)*(X - 1)


w2 := x**4+(i+2)*x**3+(2*i+5)*x**2+(2*i+6)*x+6;


        2
W2 := (X  + I*X + 3)*(X + (I + 1))*(X - (I - 1))


w3 := (2*i+3)*x**4+(3*i-2)*x**3-2*(i+1)*x**2+i*x-1;


                  2              2     2        3
W3 := (2*I + 3)*(X  + I*X - 1)*(X  - (----*I - ----))
                                       13       13


off arnum;




defpoly a**2-5;



w4 := x**2+x-1;


             1       1           1       1
W4 := (X + (---*A + ---))*(X - (---*A - ---))
             2       2           2       2


off arnum;




defpoly a**2+a+2;



w5 := x**4+3*x**2+4;


W5 := (X + (A + 1))*(X + A)*(X - (A + 1))*(X - A)


off arnum;




defpoly a**3+2=0;



w6:=64*x**6-4;


           2     1          1   2    2     1          1   2
W6 := 64*(X  + (---*A)*X + ---*A )*(X  - (---*A)*X + ---*A )
                 2          4              2          4

             1           1
      *(X + ---*A)*(X - ---*A)
             2           2


off arnum;




defpoly a**4+a**3+a**2+a+1=0;



w7:=16*x**4+8*x**3+4*x**2+2*x+1;


                1   3    1   2    1       1          1   3
W7 := 16*(X + (---*A  + ---*A  + ---*A + ---))*(X - ---*A )
                2        2        2       2          2

             1   2        1
      *(X - ---*A )*(X - ---*A)
             2            2


off arnum, factor;




defpoly sqrt5**2-5,cbrt3**3-3;


*** Defining polynomial for primitive element:

  6        4       3        2
A1  - 15*A1  - 6*A1  + 75*A1  - 90*A1 - 116



cbrt3**3;


3


sqrt5**2;


5


cbrt3;


     120     5     27     4    2000    3    1170    2    6676
 - (------*A1  + ------*A1  - ------*A1  - ------*A1  + ------*A1
     8243         8243         8243         8243         8243

        6825
     - ------)
        8243


sqrt5;


 120     5     27     4    2000    3    1170    2    14919
------*A1  + ------*A1  - ------*A1  - ------*A1  + -------*A1
 8243         8243         8243         8243         8243

    6825
 - ------
    8243


sqrt(x**2+2*(sqrt5-cbrt3)*x+5-2*sqrt5*cbrt3+cbrt3**2);


      240     5     54     4    4000    3    2340    2    21595
X + (------*A1  + ------*A1  - ------*A1  - ------*A1  + -------*A1
      8243         8243         8243         8243         8243

         13650
      - -------)
         8243


on rationalize;



1/(x+sqrt5-cbrt3);


  5     240     5     54     4    4000    3    2340    2    21595
(X  - (------*A1  + ------*A1  - ------*A1  - ------*A1  + -------*A1
        8243         8243         8243         8243         8243

           13650    4     108     5    800     4    1800    3
        - -------)*X  - (------*A1  - ------*A1  - ------*A1
           8243           8243         8243         8243

        15433    2    15900        14465    3      3           2
     + -------*A1  + -------*A1 + -------)*X  - (A1  - 15*A1)*X  - (
        8243          8243         8243

     900     5    3919    4    15000    3    8775    2    148986
    ------*A1  - ------*A1  - -------*A1  - ------*A1  + --------*A1
     8243         8243         8243          8243          8243

        154225         1919    5    1050    4    18245    3
     - --------)*X - (------*A1  + ------*A1  - -------*A1
         8243          8243         8243         8243

        12528    2    236725        73080      6       4      3
     - -------*A1  + --------*A1 - -------))/(X  - 15*X  - 6*X
        8243           8243         8243

          2
    + 75*X  - 90*X - 116)


off arnum, rationalize;




split!_field(x**3+2);


*** Splitting field is generated by:

  6
A3  + 108


  1     4    1
{----*A3  + ---*A3,
  36         2

     1     4
  - ----*A3 ,
     18

  1     4    1
 ----*A3  - ---*A3}
  36         2


for each j in ws product (x-j);


 3
X  + 2


split!_field(x**3+4*x**2+x-1);


*** Splitting field is generated by:

  3       2
A4  + 4*A4  + A4 - 1


      2                  2
{A4,A4  + 3*A4 - 2, - (A4  + 4*A4 + 2)}


for each j in ws product (x-j);


 3      2
X  + 4*X  + X - 1


split!_field(x**3-3*x+7);


*** Splitting field is generated by:

  6        4        2
A6  - 18*A6  + 81*A6  + 1215


   1     4    5     2    1        2
{-----*A6  - ----*A6  + ---*A6 + ---,
  126         42         2        7

      1     4    5     2    4
  - (----*A6  - ----*A6  + ---),
      63         21         7

   1     4    5     2    1        2
 -----*A6  - ----*A6  - ---*A6 + ---}
  126         42         2        7


for each j in ws product (x-j);


 3
X  - 3*X + 7


split!_field(x**3+4*x**2+x-1);


*** Splitting field is generated by:

  3       2
A7  + 4*A7  + A7 - 1


      2                  2
{A7,A7  + 3*A7 - 2, - (A7  + 4*A7 + 2)}


for each j in ws product (x-j);


 3      2
X  + 4*X  + X - 1


split!_field(x**3-x**2-x-1);


*** Splitting field is generated by:

  6       5       4        3        2
A9  - 6*A9  + 7*A9  + 12*A9  - 17*A9  - 6*A9 + 53


      3     4    3     3    1     2    5         17
{ - (----*A9  - ----*A9  - ----*A9  - ----*A9 + ----),
      76         19         38         38        76

  3     4    6     3    1     2    14        17
 ----*A9  - ----*A9  - ----*A9  + ----*A9 + ----,
  38         19         19         19        38

      3     4    3     3    1     2    33        59
  - (----*A9  - ----*A9  - ----*A9  + ----*A9 - ----)}
      76         19         38         38        76


for each j in ws product (x-j);


 3    2
X  - X  - X - 1


% A longer example.

off arnum;



defpoly a**6+3*a**5+6*a**4+a**3-3*a**2+12*a+16;



factorize(x**3-3);


       1    5    1    4    1   3    7    2    11       4
{X - (----*A  + ----*A  + ---*A  - ----*A  + ----*A + ---),
       12        12        6        12        12       3

       1   5    1   4    2   3    1   2    2       7
 X + (---*A  + ---*A  + ---*A  - ---*A  + ---*A + ---),
       6        3        3        6        3       3

       1    5    1   4    1   3    5    2    1
 X - (----*A  + ---*A  + ---*A  + ----*A  - ---*A + 1)}
       12        4        2        12        4


end;

4: 4: 
Quitting
Sat Jun 29 14:08:43 PDT 1991


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