next up previous
Next: Algebraic systems Up: An introduction to Computer Algebra Previous: Operations on matrices

Operations on univariate polynomials

AXIOM SESSIONscale=2.5]

N := NonNegativeInteger
 

   (1)  NonNegativeInteger
                                                                 Type: Domain
                                                                  Time: 0 sec

Z := Integer
 

   (2)  Integer
                                                                 Type: Domain
                                                                  Time: 0 sec

UZ := UnivariatePolynomial(x,Z)
 

   (3)  UnivariatePolynomial(x,Integer)
                                                                 Type: Domain
                                                                  Time: 0 sec


u: UZ  := (3*x-1)**2 * (2*x + 8)
 

           3      2
   (4)  18x  + 60x  - 46x + 8
                                        Type: UnivariatePolynomial(x,Integer)
                                                   Time: 0.01 (OT) = 0.01 sec

v: UZ := (1 - 6*x + 9*x**2)**2
 

           4       3      2
   (5)  81x  - 108x  + 54x  - 12x + 1
                                        Type: UnivariatePolynomial(x,Integer)
                                                   Time: 0.01 (OT) = 0.01 sec


u**2 + u*v
 

             7        6        5         4        3        2
   (6)  1458x  + 3240x  - 7074x  + 10584x  - 9282x  + 4120x  - 878x + 72
                                        Type: UnivariatePolynomial(x,Integer)
                                                   Time: 0.01 (OT) = 0.01 sec

leadingCoefficient u
 

   (7)  18
                                                        Type: PositiveInteger
                                                                  Time: 0 sec

degree u
 

   (8)  3
                                                        Type: PositiveInteger
                                                                  Time: 0 sec

reductum u
 

           2
   (9)  60x  - 46x + 8
                                        Type: UnivariatePolynomial(x,Integer)
                                                                  Time: 0 sec

gcd(u,v)
 

           2
   (10)  9x  - 6x + 1
                                        Type: UnivariatePolynomial(x,Integer)
                                                                  Time: 0 sec

factor(u)
 

                         2
   (11)  2(x + 4)(3x - 1)
                               Type: Factored UnivariatePolynomial(x,Integer)
                                                                  Time: 0 sec

factor(v)
 

                 4
   (12)  (3x - 1)
                               Type: Factored UnivariatePolynomial(x,Integer)
                                                                  Time: 0 sec


PZ := Polynomial Z
 

   (13)  Polynomial Integer
                                                                 Type: Domain
                                                                  Time: 0 sec

pz: PZ := (4*x**3+2*y**2+1)*(12*x**5-x**3*y+12)
 

             3 3       5       2        6    3        8      5      3
   (14)  - 2x y  + (24x  + 24)y  + (- 4x  - x )y + 48x  + 12x  + 48x  + 12
                                                     Type: Polynomial Integer
                                                   Time: 0.01 (IN) = 0.01 sec

factor(pz)
 

             3       5         2     3
   (15)  - (x y - 12x  - 12)(2y  + 4x  + 1)
                                            Type: Factored Polynomial Integer
                                                   Time: 0.04 (EV) = 0.04 sec



Q := Fraction Integer
 

   (16)  Fraction Integer
                                                                 Type: Domain
                                                                  Time: 0 sec

PQ := Polynomial Q
 

   (17)  Polynomial Fraction Integer
                                                                 Type: Domain
                                                                  Time: 0 sec

pq: PQ := (4*x**3+(2/3)*x**2+1)*(12*x**5-(1/2)*x**3+12)
 

            8     7     6   35  5   95  3     2
   (18)  48x  + 8x  - 2x  + -- x  + -- x  + 8x  + 12
                             3       2
                                            Type: Polynomial Fraction Integer
                                       Time: 0.03 (IN) + 0.01 (OT) = 0.04 sec

factor(pq)
 

             3   1  2   1   5    1  3
   (19)  48(x  + - x  + -)(x  - -- x  + 1)
                 6      4       24
                                   Type: Factored Polynomial Fraction Integer
                                       Time: 0.03 (EV) + 0.01 (OT) = 0.04 sec

AXIOM SESSIONscale=2.5]

P := UnivariatePolynomial(x,Fraction Integer)
 

   (1)  UnivariatePolynomial(x,Fraction Integer)
                                                                 Type: Domain
                                                                  Time: 0 sec

euclideanGcd(a,b) ==
         l := [a];
         a:=unitCanonical a
         b:=unitCanonical b
         while not zero? b repeat
            l := cons(b,l)
            (a,b):= (b,a rem b)
            b:=unitCanonical b   
         reverse l
 
                                                                   Type: Void
                                                                  Time: 0 sec

p1: P  := x^8 + x^6  -3*x^4 -3*x^3 +8*x^2 +2*x -5
 

         8    6     4     3     2
   (3)  x  + x  - 3x  - 3x  + 8x  + 2x - 5
                               Type: UnivariatePolynomial(x,Fraction Integer)
                                                   Time: 0.01 (OT) = 0.01 sec
q1: P  := 3*x^6 + 5*x^4 - 4*x^2 -9*x +21
 

          6     4     2
   (4)  3x  + 5x  - 4x  - 9x + 21
                               Type: UnivariatePolynomial(x,Fraction Integer)
                                       Time: 0.01 (IN) + 0.01 (OT) = 0.02 sec

euclideanGcd(p1,q1)
 

   (5)
     8    6     4     3     2            6   5  4   4  2
   [x  + x  - 3x  - 3x  + 8x  + 2x - 5, x  + - x  - - x  - 3x + 7,
                                             3      3
     4   1  2   3   2   25     49      6150
    x  - - x  + -, x  + -- x - --, x - ----, 1]
         5      5       13     13      4663
                          Type: List UnivariatePolynomial(x,Fraction Integer)
                                       Time: 0.01 (IN) + 0.01 (OT) = 0.02 sec


p2: P := x^30 + x^19 + 1
 

         30    19
   (6)  x   + x   + 1
                               Type: UnivariatePolynomial(x,Fraction Integer)
                                                                  Time: 0 sec
q2: P := x^29 - x^17 + 3
 

         29    17
   (7)  x   - x   + 3
                               Type: UnivariatePolynomial(x,Fraction Integer)
                                                                  Time: 0 sec

euclideanGcd(p2,q2)
 

   (8)
     30    19       29    17       19    18
   [x   + x   + 1, x   - x   + 3, x   + x   - 3x + 1,

        18    17     11     10     9     8     7     6     5     4     3     2
       x   + x   - 3x   + 4x   - 4x  + 4x  - 4x  + 4x  - 4x  + 4x  - 4x  + 4x
     + 
       - 4x - 2
     ,

        12   4  11   4  10   4  9   4  8   4  7   4  6   4  5   4  4   4  3
       x   - - x   + - x   - - x  + - x  - - x  + - x  - - x  + - x  - - x
             3       3       3      3      3      3      3      3      3
     + 
       4  2   1     1
       - x  - - x + -
       3      3     3
     ,

        11   8732  10   8732  9   8732  8   10919  7   5816  6   10433  5
       x   - ---- x   + ---- x  - ---- x  + ----- x  - ---- x  + ----- x
             6545       6545      6545       6545      6545       6545
     + 
         676  4   9164  3   8588  2   1756      878
       - --- x  + ---- x  - ---- x  + ---- x + ----
         595      6545      6545      1309     1309
     ,

        10    9   19619  8   6553  7   15277  6       5       4      3      2
       x   - x  - ----- x  - ---- x  - ----- x  - 729x  - 242x  - 82x  - 26x
                    16         4         16
     + 
         59065     19555
       - ----- x + -----
           16        16
     ,
     9    8   1  7   1  6     2        1
    x  + x  + - x  + - x  + 3x  - 2x + -,
              3      3                 3

        8   78620  7   45799  6   34992  5   11616  4    4080  3    864   2
       x  + ----- x  + ----- x  + ----- x  + ----- x  + ----- x  + ----- x
            58777      58777      58777      58777      58777      58777
     + 
       177403     58697
       ------ x - -----
        58777     58777
     ,

        7   170782  6   2173617  5   1746351  4   5658021  3   8599611  2
       x  + ------ x  + ------- x  - ------- x  + ------- x  - ------- x
            923785      3695140      3695140      3695140      3695140
     + 
       2278869     1232437
       ------- x - -------
        739028     1847570
     ,

        6   2515753  5   15269857  4   12227447  3   2492039  2   2531080
       x  - ------- x  + -------- x  - -------- x  + ------- x  - ------- x
             142893       428679        428679        142893       428679
     + 
       4446728
       -------
        428679
     ,
     5   160644757  4   130375607  3   27115175  2   25927747     49124846
    x  - --------- x  + --------- x  - -------- x  + -------- x - --------,
          73785531       73785531      24595177      73785531     73785531
     4   4553589485  3   1129145127  2   163361143     2886544997
    x  - ---------- x  + ---------- x  + --------- x + ----------,
         7507014112      3753507056      234594191     7507014112
     3   112557717874  2   270014099776      15748937137
    x  - ------------ x  + ------------ x - ------------,
          43571774195      130715322585     130715322585
     2   619536582958      472414012299      19773994490288
    x  - ------------ x + -------------, x + --------------, 1]
         633789802471     2535159209884      34258486832515
                          Type: List UnivariatePolynomial(x,Fraction Integer)
                                                   Time: 0.04 (OT) = 0.04 sec


next up previous
Next: Algebraic systems Up: An introduction to Computer Algebra Previous: Operations on matrices
Marc Moreno Maza
2003-06-06