A First Session with AXIOM

We start by some illustrative examples of Computer Algebra capabilities using the AXIOM system.

For more information about AXIOM please visit:

http://www.nag.co.uk/symbolic_software.asp
http://www.nongnu.org/axiom/

AXIOM SESSIONscale=2.5]

Starts dribbling to session1.out (Mon Sep 15 12:01:24 2003)


--------------------------------------------
-- There are different types of integers  --
--------------------------------------------

123
 

   (1)  123
                                                        Type: PositiveInteger
                                                                  Time: 0 sec

0
 

   (2)  0
                                                     Type: NonNegativeInteger
                                                                  Time: 0 sec

-45
 

   (3)  - 45
                                                                Type: Integer
                                                                  Time: 0 sec

------------------------------------------
-- There is a type inference mechanism  --
------------------------------------------

123 + (-45)
 

   (4)  78
                                                        Type: PositiveInteger
                                                                  Time: 0 sec

123 + (-456)
 

   (5)  - 333
                                                                Type: Integer
                                                                  Time: 0 sec

355/113
 

        355
   (6)  ---
        113
                                                       Type: Fraction Integer
                                                                  Time: 0 sec

355/113.0
 

   (7)  3.1415929203 539823009
                                                                  Type: Float
                           Time: 0.01 (IN) + 0.01 (OT) + 0.01 (GC) = 0.03 sec

-------------------------------
-- Coercions are also needed --
-------------------------------

(355/113) :: Float
 

   (8)  3.1415929203 539823009
                                                                  Type: Float
                                                                  Time: 0 sec

(355/113) :: DoubleFloat
 

   (9)  3.1415929203539825
                                                            Type: DoubleFloat
                                                                  Time: 0 sec

-- Type inference again

n: Integer := 12
 

   (10)  12
                                                                Type: Integer
                                                                  Time: 0 sec

a: Integer := 3
 

   (11)  3
                                                                Type: Integer
                                                                  Time: 0 sec

a^n
 

   (12)  531441
                                                       Type: Fraction Integer
                                                                  Time: 0 sec

n := -n
 

   (13)  - 12
                                                                Type: Integer
                                                   Time: 0.01 (OT) = 0.01 sec

a^n
 

            1
   (14)  ------
         531441
                                                       Type: Fraction Integer
                                                                  Time: 0 sec

inv(a^n)
 

   (15)  531441
                                                       Type: Fraction Integer
                                                                  Time: 0 sec

f := n * 1.0
 

   (16)  - 12.0
                                                                  Type: Float
                                                   Time: 0.02 (OT) = 0.02 sec

a^f
 

   (17)  0.0000018816 7642315892 07457
                                                                  Type: Float
                                       Time: 0.01 (IN) + 0.01 (OT) = 0.02 sec

-------------------------------------------
-- Types have an influence on the result --
-------------------------------------------

gcd (123,45)
 

   (18)  3
                                                        Type: PositiveInteger
                                                                  Time: 0 sec

gcd (123,45/1)
 

   (19)  1
                                                       Type: Fraction Integer
                           Time: 0.03 (IN) + 0.01 (EV) + 0.01 (OT) = 0.05 sec

x 
 

   (20)  x
                                                             Type: Variable x
                                                                  Time: 0 sec

x + 1
 

   (21)  x + 1
                                                     Type: Polynomial Integer
                                       Time: 0.01 (IN) + 0.01 (GC) = 0.02 sec

x + 1/2
 

             1
   (22)  x + -
             2
                                            Type: Polynomial Fraction Integer
                                       Time: 0.04 (IN) + 0.01 (OT) = 0.05 sec

p := (2*x + 2) * (x + 2)
 

           2
   (23)  2x  + 6x + 4
                                                     Type: Polynomial Integer
                                                   Time: 0.01 (IN) = 0.01 sec

q := (x + 1) * (x + 3) * 2
 

           2
   (24)  2x  + 8x + 6
                                                     Type: Polynomial Integer
                                                   Time: 0.01 (OT) = 0.01 sec

gcd(p,q)
 

   (25)  2x + 2
                                                     Type: Polynomial Integer
                                       Time: 0.01 (OT) + 0.03 (GC) = 0.04 sec

q := (x + 1) * (x + 3) * 2/1
 

           2
   (26)  2x  + 8x + 6
                                            Type: Polynomial Fraction Integer
               Time: 0.01 (IN) + 0.01 (EV) + 0.01 (OT) + 0.01 (GC) = 0.04 sec

gcd (p,q)
 

   (27)  x + 1
                                            Type: Polynomial Fraction Integer
                                       Time: 0.02 (IN) + 0.01 (EV) = 0.03 sec

----------------------
-- Specifying types --
----------------------

Z := Integer
 

   (28)  Integer
                                                                 Type: Domain
                                                                  Time: 0 sec

a: Z := 12
 

   (29)  12
                                                                Type: Integer
                                                                  Time: 0 sec

b: Z := 45
 

   (30)  45
                                                                Type: Integer
                                                                  Time: 0 sec

gcd(a,b)
 

   (31)  3
                                                        Type: PositiveInteger
                                                                  Time: 0 sec

Q := Fraction Integer
 

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

r: Q := a
 

   (33)  12
                                                       Type: Fraction Integer
                                                                  Time: 0 sec

s: Q := b
 

   (34)  45
                                                       Type: Fraction Integer
                                                                  Time: 0 sec

gcd(r,s)
 

   (35)  1
                                                       Type: Fraction Integer
                                                                  Time: 0 sec

gcd(12,45)$Q
 

   (36)  1
                                                       Type: Fraction Integer
                                                                  Time: 0 sec

gcd(12,45)$Z
 

   (37)  3
                                                                Type: Integer
                                                                  Time: 0 sec

a := inv(a)
 
 
   Cannot convert right-hand side of assignment
    1
   --
   12

      to an object of the type Integer of the left-hand side.

--------------------
-- Browsing types --
--------------------

)sh Z
 
 Integer is a domain constructor.
 Abbreviation for Integer is INT 
 This constructor is exposed in this frame.
 Issue )edit /usr/local/share/axiom/axiom2.3//mnt/linuxglibc2.1//../../src/algebra/integer.spad to see algebra source code for INT 

------------------------------- Operations --------------------------------

 ?*? : (Integer,%) -> %                ?*? : (PositiveInteger,%) -> %
 ?*? : (%,%) -> %                      ?**? : (%,PositiveInteger) -> %
 ?+? : (%,%) -> %                      ?-? : (%,%) -> %
 -? : % -> %                           ?<? : (%,%) -> Boolean
 ?<=? : (%,%) -> Boolean               ?=? : (%,%) -> Boolean
 ?>? : (%,%) -> Boolean                ?>=? : (%,%) -> Boolean
 D : (%,NonNegativeInteger) -> %       D : % -> %
 OMwrite : (%,Boolean) -> String       OMwrite : % -> String
 1 : () -> %                           0 : () -> %
 ?^? : (%,PositiveInteger) -> %        abs : % -> %
 addmod : (%,%,%) -> %                 associates? : (%,%) -> Boolean
 base : () -> %                        binomial : (%,%) -> %
 bit? : (%,%) -> Boolean               coerce : % -> OutputForm
 coerce : Integer -> %                 coerce : % -> %
 convert : % -> DoubleFloat            convert : % -> Float
 convert : % -> InputForm              convert : % -> Integer
 convert : % -> Pattern Integer        convert : % -> String
 copy : % -> %                         dec : % -> %
 differentiate : % -> %                even? : % -> Boolean
 factor : % -> Factored %              factorial : % -> %
 gcd : List % -> %                     gcd : (%,%) -> %
 hash : % -> SingleInteger             hash : % -> %
 inc : % -> %                          init : () -> %
 invmod : (%,%) -> %                   latex : % -> String
 lcm : List % -> %                     lcm : (%,%) -> %
 length : % -> %                       mask : % -> %
 max : (%,%) -> %                      min : (%,%) -> %
 mulmod : (%,%,%) -> %                 negative? : % -> Boolean
 odd? : % -> Boolean                   one? : % -> Boolean
 permutation : (%,%) -> %              positive? : % -> Boolean
 positiveRemainder : (%,%) -> %        powmod : (%,%,%) -> %
 prime? : % -> Boolean                 ?quo? : (%,%) -> %
 random : % -> %                       random : () -> %
 rational : % -> Fraction Integer      rational? : % -> Boolean
 recip : % -> Union(%,"failed")        ?rem? : (%,%) -> %
 retract : % -> Integer                sample : () -> %
 shift : (%,%) -> %                    sign : % -> Integer
 sizeLess? : (%,%) -> Boolean          squareFree : % -> Factored %
 squareFreePart : % -> %               submod : (%,%,%) -> %
 symmetricRemainder : (%,%) -> %       unit? : % -> Boolean
 unitCanonical : % -> %                zero? : % -> Boolean
 ?~=? : (%,%) -> Boolean              
 ?*? : (NonNegativeInteger,%) -> %
 ?**? : (%,NonNegativeInteger) -> %
 OMwrite : (OpenMathDevice,%,Boolean) -> Void
 OMwrite : (OpenMathDevice,%) -> Void
 ?^? : (%,NonNegativeInteger) -> %
 characteristic : () -> NonNegativeInteger
 differentiate : (%,NonNegativeInteger) -> %
 divide : (%,%) -> Record(quotient: %,remainder: %)
 euclideanSize : % -> NonNegativeInteger
 expressIdealMember : (List %,%) -> Union(List %,"failed")
 exquo : (%,%) -> Union(%,"failed")
 extendedEuclidean : (%,%) -> Record(coef1: %,coef2: %,generator: %)
 extendedEuclidean : (%,%,%) -> Union(Record(coef1: %,coef2: %),"failed")
 gcdPolynomial : (SparseUnivariatePolynomial %,SparseUnivariatePolynomial %) -> SparseUnivariatePolynomial %
 multiEuclidean : (List %,%) -> Union(List %,"failed")
 nextItem : % -> Union(%,"failed")
 patternMatch : (%,Pattern Integer,PatternMatchResult(Integer,%)) -> PatternMatchResult(Integer,%)
 principalIdeal : List % -> Record(coef: List %,generator: %)
 rationalIfCan : % -> Union(Fraction Integer,"failed")
 reducedSystem : Matrix % -> Matrix Integer
 reducedSystem : (Matrix %,Vector %) -> Record(mat: Matrix Integer,vec: Vector Integer)
 retractIfCan : % -> Union(Integer,"failed")
 subtractIfCan : (%,%) -> Union(%,"failed")
 unitNormal : % -> Record(unit: %,canonical: %,associate: %)



)sh Q
 
 Fraction Integer is a domain constructor.
 Abbreviation for Fraction is FRAC 
 This constructor is exposed in this frame.
 Issue )edit /usr/local/share/axiom/axiom2.3//mnt/linuxglibc2.1//../../src/algebra/fraction.spad to see algebra source code for FRAC 

------------------------------- Operations --------------------------------

 ?*? : (Fraction Integer,%) -> %       ?*? : (Integer,%) -> %
 ?*? : (PositiveInteger,%) -> %        ?*? : (%,Fraction Integer) -> %
 ?*? : (%,Integer) -> %                ?*? : (%,%) -> %
 ?**? : (%,Integer) -> %               ?**? : (%,PositiveInteger) -> %
 ?+? : (%,%) -> %                      ?-? : (%,%) -> %
 -? : % -> %                           ?/? : (Integer,Integer) -> %
 ?/? : (%,%) -> %                      ?<? : (%,%) -> Boolean
 ?<=? : (%,%) -> Boolean               ?=? : (%,%) -> Boolean
 ?>? : (%,%) -> Boolean                ?>=? : (%,%) -> Boolean
 D : (%,List Symbol) -> %              D : (%,NonNegativeInteger) -> %
 D : (%,Symbol) -> %                   D : % -> %
 OMwrite : (%,Boolean) -> String       OMwrite : % -> String
 1 : () -> %                           0 : () -> %
 ?^? : (%,Integer) -> %                ?^? : (%,PositiveInteger) -> %
 abs : % -> %                          associates? : (%,%) -> Boolean
 ceiling : % -> Integer                coerce : % -> OutputForm
 coerce : Fraction Integer -> %        coerce : Integer -> %
 coerce : Symbol -> %                  coerce : % -> %
 convert : % -> DoubleFloat            convert : % -> Float
 convert : % -> InputForm              convert : % -> Pattern Float
 convert : % -> Pattern Integer        denom : % -> Integer
 denominator : % -> %                  differentiate : (%,Symbol) -> %
 differentiate : % -> %                ?.? : (%,Integer) -> %
 eval : (%,Equation Integer) -> %      eval : (%,Integer,Integer) -> %
 eval : (%,Symbol,Integer) -> %        factor : % -> Factored %
 floor : % -> Integer                  fractionPart : % -> %
 gcd : List % -> %                     gcd : (%,%) -> %
 hash : % -> SingleInteger             init : () -> %
 inv : % -> %                          latex : % -> String
 lcm : List % -> %                     lcm : (%,%) -> %
 max : (%,%) -> %                      min : (%,%) -> %
 negative? : % -> Boolean              numer : % -> Integer
 numerator : % -> %                    one? : % -> Boolean
 positive? : % -> Boolean              prime? : % -> Boolean
 ?quo? : (%,%) -> %                    random : () -> %
 recip : % -> Union(%,"failed")        ?rem? : (%,%) -> %
 retract : % -> Fraction Integer       retract : % -> Integer
 retract : % -> Symbol                 sample : () -> %
 sign : % -> Integer                   sizeLess? : (%,%) -> Boolean
 squareFree : % -> Factored %          squareFreePart : % -> %
 unit? : % -> Boolean                  unitCanonical : % -> %
 wholePart : % -> Integer              zero? : % -> Boolean
 ?~=? : (%,%) -> Boolean              
 ?*? : (NonNegativeInteger,%) -> %
 ?**? : (%,NonNegativeInteger) -> %
 D : (%,List Symbol,List NonNegativeInteger) -> %
 D : (%,(Integer -> Integer),NonNegativeInteger) -> %
 D : (%,(Integer -> Integer)) -> %
 D : (%,Symbol,NonNegativeInteger) -> %
 OMwrite : (OpenMathDevice,%,Boolean) -> Void
 OMwrite : (OpenMathDevice,%) -> Void
 ?^? : (%,NonNegativeInteger) -> %
 characteristic : () -> NonNegativeInteger
 charthRoot : % -> Union(%,"failed")
 conditionP : Matrix % -> Union(Vector %,"failed")
 differentiate : (%,List Symbol,List NonNegativeInteger) -> %
 differentiate : (%,List Symbol) -> %
 differentiate : (%,(Integer -> Integer),NonNegativeInteger) -> %
 differentiate : (%,(Integer -> Integer)) -> %
 differentiate : (%,NonNegativeInteger) -> %
 differentiate : (%,Symbol,NonNegativeInteger) -> %
 divide : (%,%) -> Record(quotient: %,remainder: %)
 euclideanSize : % -> NonNegativeInteger
 eval : (%,List Equation Integer) -> %
 eval : (%,List Integer,List Integer) -> %
 eval : (%,List Symbol,List Integer) -> %
 expressIdealMember : (List %,%) -> Union(List %,"failed")
 exquo : (%,%) -> Union(%,"failed")
 extendedEuclidean : (%,%) -> Record(coef1: %,coef2: %,generator: %)
 extendedEuclidean : (%,%,%) -> Union(Record(coef1: %,coef2: %),"failed")
 factorPolynomial : SparseUnivariatePolynomial % -> Factored SparseUnivariatePolynomial %
 factorSquareFreePolynomial : SparseUnivariatePolynomial % -> Factored SparseUnivariatePolynomial %
 gcdPolynomial : (SparseUnivariatePolynomial %,SparseUnivariatePolynomial %) -> SparseUnivariatePolynomial %
 map : ((Integer -> Integer),%) -> %
 multiEuclidean : (List %,%) -> Union(List %,"failed")
 nextItem : % -> Union(%,"failed")
 patternMatch : (%,Pattern Float,PatternMatchResult(Float,%)) -> PatternMatchResult(Float,%)
 patternMatch : (%,Pattern Integer,PatternMatchResult(Integer,%)) -> PatternMatchResult(Integer,%)
 principalIdeal : List % -> Record(coef: List %,generator: %)
 reducedSystem : Matrix % -> Matrix Integer
 reducedSystem : (Matrix %,Vector %) -> Record(mat: Matrix Integer,vec: Vector Integer)
 retractIfCan : % -> Union(Fraction Integer,"failed")
 retractIfCan : % -> Union(Integer,"failed")
 retractIfCan : % -> Union(Symbol,"failed")
 solveLinearPolynomialEquation : (List SparseUnivariatePolynomial %,SparseUnivariatePolynomial %) -> Union(List SparseUnivariatePolynomial %,"failed")
 squareFreePolynomial : SparseUnivariatePolynomial % -> Factored SparseUnivariatePolynomial %
 subtractIfCan : (%,%) -> Union(%,"failed")
 unitNormal : % -> Record(unit: %,canonical: %,associate: %)



Q has Field
 

   (38)  true
                                                                Type: Boolean
                                                                  Time: 0 sec

Z has Field
 

   (39)  false
                                                                Type: Boolean
                                                                  Time: 0 sec

)sh Field
 
 Field  is a category constructor
 Abbreviation for Field is FIELD 
 This constructor is exposed in this frame.
 Issue )edit /usr/local/share/axiom/axiom2.3//mnt/linuxglibc2.1//../../src/algebra/catdef.spad to see algebra source code for FIELD 

------------------------------- Operations --------------------------------
 ?*? : (Fraction Integer,%) -> %       ?*? : (%,Fraction Integer) -> %
 ?*? : (%,%) -> %                      ?*? : (Integer,%) -> %
 ?*? : (PositiveInteger,%) -> %        ?**? : (%,Integer) -> %
 ?**? : (%,PositiveInteger) -> %       ?+? : (%,%) -> %
 ?-? : (%,%) -> %                      -? : % -> %
 ?/? : (%,%) -> %                      ?=? : (%,%) -> Boolean
 1 : () -> %                           0 : () -> %
 ?^? : (%,Integer) -> %                ?^? : (%,PositiveInteger) -> %
 associates? : (%,%) -> Boolean        coerce : Fraction Integer -> %
 coerce : % -> %                       coerce : Integer -> %
 coerce : % -> OutputForm              factor : % -> Factored %
 gcd : List % -> %                     gcd : (%,%) -> %
 hash : % -> SingleInteger             inv : % -> %
 latex : % -> String                   lcm : List % -> %
 lcm : (%,%) -> %                      one? : % -> Boolean
 prime? : % -> Boolean                 ?quo? : (%,%) -> %
 recip : % -> Union(%,"failed")        ?rem? : (%,%) -> %
 sample : () -> %                      sizeLess? : (%,%) -> Boolean
 squareFree : % -> Factored %          squareFreePart : % -> %
 unit? : % -> Boolean                  unitCanonical : % -> %
 zero? : % -> Boolean                  ?~=? : (%,%) -> Boolean
 ?*? : (NonNegativeInteger,%) -> %
 ?**? : (%,NonNegativeInteger) -> %
 ?^? : (%,NonNegativeInteger) -> %
 characteristic : () -> NonNegativeInteger
 divide : (%,%) -> Record(quotient: %,remainder: %)
 euclideanSize : % -> NonNegativeInteger
 expressIdealMember : (List %,%) -> Union(List %,"failed")
 exquo : (%,%) -> Union(%,"failed")
 extendedEuclidean : (%,%,%) -> Union(Record(coef1: %,coef2: %),"failed")
 extendedEuclidean : (%,%) -> Record(coef1: %,coef2: %,generator: %)
 gcdPolynomial : (SparseUnivariatePolynomial %,SparseUnivariatePolynomial %) -> SparseUnivariatePolynomial %
 multiEuclidean : (List %,%) -> Union(List %,"failed")
 principalIdeal : List % -> Record(coef: List %,generator: %)
 subtractIfCan : (%,%) -> Union(%,"failed")
 unitNormal : % -> Record(unit: %,canonical: %,associate: %)


Z has Ring
 

   (40)  true
                                                                Type: Boolean
                                                                  Time: 0 sec

)sh Ring
 
 Ring  is a category constructor
 Abbreviation for Ring is RING 
 This constructor is exposed in this frame.
 Issue )edit /usr/local/share/axiom/axiom2.3//mnt/linuxglibc2.1//../../src/algebra/catdef.spad to see algebra source code for RING 

------------------------------- Operations --------------------------------
 ?*? : (%,%) -> %                      ?*? : (Integer,%) -> %
 ?*? : (PositiveInteger,%) -> %        ?**? : (%,PositiveInteger) -> %
 ?+? : (%,%) -> %                      ?-? : (%,%) -> %
 -? : % -> %                           ?=? : (%,%) -> Boolean
 1 : () -> %                           0 : () -> %
 ?^? : (%,PositiveInteger) -> %        coerce : Integer -> %
 coerce : % -> OutputForm              hash : % -> SingleInteger
 latex : % -> String                   one? : % -> Boolean
 recip : % -> Union(%,"failed")        sample : () -> %
 zero? : % -> Boolean                  ?~=? : (%,%) -> Boolean
 ?*? : (NonNegativeInteger,%) -> %
 ?**? : (%,NonNegativeInteger) -> %
 ?^? : (%,NonNegativeInteger) -> %
 characteristic : () -> NonNegativeInteger
 subtractIfCan : (%,%) -> Union(%,"failed")


Z has OrderedRing
 

   (41)  true
                                                                Type: Boolean
                                                                  Time: 0 sec

)sh OrderedRing
 
 OrderedRing  is a category constructor
 Abbreviation for OrderedRing is ORDRING 
 This constructor is exposed in this frame.
 Issue )edit /usr/local/share/axiom/axiom2.3//mnt/linuxglibc2.1//../../src/algebra/catdef.spad to see algebra source code for ORDRING 

------------------------------- Operations --------------------------------
 ?*? : (%,%) -> %                      ?*? : (Integer,%) -> %
 ?*? : (PositiveInteger,%) -> %        ?**? : (%,PositiveInteger) -> %
 ?+? : (%,%) -> %                      -? : % -> %
 ?-? : (%,%) -> %                      ?<? : (%,%) -> Boolean
 ?<=? : (%,%) -> Boolean               ?=? : (%,%) -> Boolean
 ?>? : (%,%) -> Boolean                ?>=? : (%,%) -> Boolean
 1 : () -> %                           0 : () -> %
 ?^? : (%,PositiveInteger) -> %        abs : % -> %
 coerce : Integer -> %                 coerce : % -> OutputForm
 hash : % -> SingleInteger             latex : % -> String
 max : (%,%) -> %                      min : (%,%) -> %
 negative? : % -> Boolean              one? : % -> Boolean
 positive? : % -> Boolean              recip : % -> Union(%,"failed")
 sample : () -> %                      sign : % -> Integer
 zero? : % -> Boolean                  ?~=? : (%,%) -> Boolean
 ?*? : (NonNegativeInteger,%) -> %
 ?**? : (%,NonNegativeInteger) -> %
 ?^? : (%,NonNegativeInteger) -> %
 characteristic : () -> NonNegativeInteger
 subtractIfCan : (%,%) -> Union(%,"failed")


Q has OrderedRing
 

   (42)  true
                                                                Type: Boolean
                                                                  Time: 0 sec

Z has GcdDomain
 

   (43)  true
                                                                Type: Boolean
                                                   Time: 0.01 (OT) = 0.01 sec

Q has GcdDomain
 

   (44)  true
                                                                Type: Boolean
                                                                  Time: 0 sec

Z has EuclideanDomain
 

   (45)  true
                                                                Type: Boolean
                                                   Time: 0.01 (OT) = 0.01 sec

Q has EuclideanDomain
 

   (46)  true
                                                                Type: Boolean
                                                                  Time: 0 sec

--------------------------
-- Programming in AXIOM --
--------------------------

f(u,v) == gcd(u,v)
 
                                                                   Type: Void
                                                                  Time: 0 sec

f(a,b)
 
   Compiling function f with type (Integer,Integer) -> Integer 

   (48)  3
                                                        Type: PositiveInteger
                                                                  Time: 0 sec

f(r,s)
 
   Compiling function f with type (Fraction Integer,Fraction Integer)
       -> Fraction Integer 

   (49)  1
                                                       Type: Fraction Integer
                                                                  Time: 0 sec

g(u,v) == while u ~= v repeat if u < v then v := v - u else u := u - v 
 
                                                                   Type: Void
                                                                  Time: 0 sec

h(u,v) == 
    g(u,v)
    u
 
                                                                   Type: Void
                                                                  Time: 0 sec

h(12,45)
 
   Compiling function g with type (PositiveInteger,PositiveInteger) -> 
      Void 
   Compiling function h with type (PositiveInteger,PositiveInteger) -> 
      PositiveInteger 

   (52)  12
                                                        Type: PositiveInteger
                                                   Time: 0.03 (IN) = 0.03 sec

h(u,v) ==
   while u ~= v repeat if u < v then v := v - u else u := u - v 
   u
 
   Compiled code for h has been cleared.
   1 old definition(s) deleted for function or rule h 
                                                                   Type: Void
                                                                  Time: 0 sec
   
h(12,45)
 
   Compiling function h with type (PositiveInteger,PositiveInteger) -> 
      Integer 

+++ |*2;h;1;Session1| redefined

   (54)  3
                                                        Type: PositiveInteger
                                                   Time: 0.01 (OT) = 0.01 sec


-------------------------------
-- Functions returning types --
-------------------------------

3/4
 

         3
   (55)  -
         4
                                                       Type: Fraction Integer
                                                                  Time: 0 sec

(x + 1)/(x + 2)
 

         x + 1
   (56)  -----
         x + 2
                                            Type: Fraction Polynomial Integer
                                                   Time: 0.01 (OT) = 0.01 sec

)sh Fraction
 
 Fraction S: IntegralDomain  is a domain constructor
 Abbreviation for Fraction is FRAC 
 This constructor is exposed in this frame.
 Issue )edit /usr/local/share/axiom/axiom2.3//mnt/linuxglibc2.1//../../src/algebra/fraction.spad to see algebra source code for FRAC 

------------------------------- Operations --------------------------------
 ?*? : (%,S) -> %                      ?*? : (S,%) -> %
 ?*? : (Fraction Integer,%) -> %       ?*? : (%,Fraction Integer) -> %
 ?*? : (%,%) -> %                      ?*? : (Integer,%) -> %
 ?*? : (PositiveInteger,%) -> %        ?**? : (%,Integer) -> %
 ?**? : (%,PositiveInteger) -> %       ?+? : (%,%) -> %
 ?-? : (%,%) -> %                      -? : % -> %
 ?/? : (S,S) -> %                      ?/? : (%,%) -> %
 ?=? : (%,%) -> Boolean                D : (%,(S -> S)) -> %
 D : % -> % if S has DIFRING           1 : () -> %
 0 : () -> %                           ?^? : (%,Integer) -> %
 ?^? : (%,PositiveInteger) -> %        associates? : (%,%) -> Boolean
 ceiling : % -> S if S has INS         coerce : S -> %
 coerce : Fraction Integer -> %        coerce : % -> %
 coerce : Integer -> %                 coerce : % -> OutputForm
 denom : % -> S                        denominator : % -> %
 factor : % -> Factored %              floor : % -> S if S has INS
 gcd : List % -> %                     gcd : (%,%) -> %
 hash : % -> SingleInteger             init : () -> % if S has STEP
 inv : % -> %                          latex : % -> String
 lcm : List % -> %                     lcm : (%,%) -> %
 map : ((S -> S),%) -> %               numer : % -> S
 numerator : % -> %                    one? : % -> Boolean
 prime? : % -> Boolean                 ?quo? : (%,%) -> %
 random : () -> % if S has INS         recip : % -> Union(%,"failed")
 ?rem? : (%,%) -> %                    retract : % -> S
 sample : () -> %                      sizeLess? : (%,%) -> Boolean
 squareFree : % -> Factored %          squareFreePart : % -> %
 unit? : % -> Boolean                  unitCanonical : % -> %
 zero? : % -> Boolean                  ?~=? : (%,%) -> Boolean
 ?*? : (NonNegativeInteger,%) -> %
 ?**? : (%,NonNegativeInteger) -> %
 ?<? : (%,%) -> Boolean if S has ORDSET
 ?<=? : (%,%) -> Boolean if S has ORDSET
 ?>? : (%,%) -> Boolean if S has ORDSET
 ?>=? : (%,%) -> Boolean if S has ORDSET
 D : (%,(S -> S),NonNegativeInteger) -> %
 D : (%,List Symbol,List NonNegativeInteger) -> % if S has PDRING SYMBOL
 D : (%,Symbol,NonNegativeInteger) -> % if S has PDRING SYMBOL
 D : (%,List Symbol) -> % if S has PDRING SYMBOL
 D : (%,Symbol) -> % if S has PDRING SYMBOL
 D : (%,NonNegativeInteger) -> % if S has DIFRING
 OMwrite : (OpenMathDevice,%,Boolean) -> Void if S has INS and S has OM
 OMwrite : (OpenMathDevice,%) -> Void if S has INS and S has OM
 OMwrite : (%,Boolean) -> String if S has INS and S has OM
 OMwrite : % -> String if S has INS and S has OM
 ?^? : (%,NonNegativeInteger) -> %
 abs : % -> % if S has OINTDOM
 characteristic : () -> NonNegativeInteger
 charthRoot : % -> Union(%,"failed") if $ has CHARNZ and S has PFECAT or S has CHARNZ
 coerce : Symbol -> % if S has RETRACT SYMBOL
 conditionP : Matrix % -> Union(Vector %,"failed") if $ has CHARNZ and S has PFECAT
 convert : % -> DoubleFloat if S has REAL
 convert : % -> Float if S has REAL
 convert : % -> InputForm if S has KONVERT INFORM
 convert : % -> Pattern Float if S has KONVERT PATTERN FLOAT
 convert : % -> Pattern Integer if S has KONVERT PATTERN INT
 differentiate : (%,(S -> S)) -> %
 differentiate : (%,(S -> S),NonNegativeInteger) -> %
 differentiate : (%,List Symbol,List NonNegativeInteger) -> % if S has PDRING SYMBOL
 differentiate : (%,Symbol,NonNegativeInteger) -> % if S has PDRING SYMBOL
 differentiate : (%,List Symbol) -> % if S has PDRING SYMBOL
 differentiate : (%,Symbol) -> % if S has PDRING SYMBOL
 differentiate : (%,NonNegativeInteger) -> % if S has DIFRING
 differentiate : % -> % if S has DIFRING
 divide : (%,%) -> Record(quotient: %,remainder: %)
 ?.? : (%,S) -> % if S has ELTAB(S,S)
 euclideanSize : % -> NonNegativeInteger
 eval : (%,Symbol,S) -> % if S has IEVALAB(SYMBOL,S)
 eval : (%,List Symbol,List S) -> % if S has IEVALAB(SYMBOL,S)
 eval : (%,List Equation S) -> % if S has EVALAB S
 eval : (%,Equation S) -> % if S has EVALAB S
 eval : (%,S,S) -> % if S has EVALAB S
 eval : (%,List S,List S) -> % if S has EVALAB S
 expressIdealMember : (List %,%) -> Union(List %,"failed")
 exquo : (%,%) -> Union(%,"failed")
 extendedEuclidean : (%,%,%) -> Union(Record(coef1: %,coef2: %),"failed")
 extendedEuclidean : (%,%) -> Record(coef1: %,coef2: %,generator: %)
 factorPolynomial : SparseUnivariatePolynomial % -> Factored SparseUnivariatePolynomial % if S has PFECAT
 factorSquareFreePolynomial : SparseUnivariatePolynomial % -> Factored SparseUnivariatePolynomial % if S has PFECAT
 fractionPart : % -> % if S has EUCDOM
 gcdPolynomial : (SparseUnivariatePolynomial %,SparseUnivariatePolynomial %) -> SparseUnivariatePolynomial %
 max : (%,%) -> % if S has ORDSET
 min : (%,%) -> % if S has ORDSET
 multiEuclidean : (List %,%) -> Union(List %,"failed")
 negative? : % -> Boolean if S has OINTDOM
 nextItem : % -> Union(%,"failed") if S has STEP
 patternMatch : (%,Pattern Float,PatternMatchResult(Float,%)) -> PatternMatchResult(Float,%) if S has PATMAB FLOAT
 patternMatch : (%,Pattern Integer,PatternMatchResult(Integer,%)) -> PatternMatchResult(Integer,%) if S has PATMAB INT
 positive? : % -> Boolean if S has OINTDOM
 principalIdeal : List % -> Record(coef: List %,generator: %)
 reducedSystem : Matrix % -> Matrix S
 reducedSystem : (Matrix %,Vector %) -> Record(mat: Matrix S,vec: Vector S)
 reducedSystem : (Matrix %,Vector %) -> Record(mat: Matrix Integer,vec: Vector Integer) if S has LINEXP INT
 reducedSystem : Matrix % -> Matrix Integer if S has LINEXP INT
 retract : % -> Integer if S has RETRACT INT
 retract : % -> Fraction Integer if S has RETRACT INT
 retract : % -> Symbol if S has RETRACT SYMBOL
 retractIfCan : % -> Union(Integer,"failed") if S has RETRACT INT
 retractIfCan : % -> Union(Fraction Integer,"failed") if S has RETRACT INT
 retractIfCan : % -> Union(Symbol,"failed") if S has RETRACT SYMBOL
 retractIfCan : % -> Union(S,"failed")
 sign : % -> Integer if S has OINTDOM
 solveLinearPolynomialEquation : (List SparseUnivariatePolynomial %,SparseUnivariatePolynomial %) -> Union(List SparseUnivariatePolynomial %,"failed") if S has PFECAT
 squareFreePolynomial : SparseUnivariatePolynomial % -> Factored SparseUnivariatePolynomial % if S has PFECAT
 subtractIfCan : (%,%) -> Union(%,"failed")
 unitNormal : % -> Record(unit: %,canonical: %,associate: %)
 wholePart : % -> S if S has EUCDOM


)sh Polynomial
 
 Polynomial R: Ring  is a domain constructor
 Abbreviation for Polynomial is POLY 
 This constructor is exposed in this frame.
 Issue )edit /usr/local/share/axiom/axiom2.3//mnt/linuxglibc2.1//../../src/algebra/multpoly.spad to see algebra source code for POLY 

------------------------------- Operations --------------------------------
 ?*? : (%,R) -> %                      ?*? : (R,%) -> %
 ?*? : (%,%) -> %                      ?*? : (Integer,%) -> %
 ?*? : (PositiveInteger,%) -> %        ?**? : (%,PositiveInteger) -> %
 ?+? : (%,%) -> %                      ?-? : (%,%) -> %
 -? : % -> %                           ?=? : (%,%) -> Boolean
 D : (%,List Symbol) -> %              D : (%,Symbol) -> %
 1 : () -> %                           0 : () -> %
 ?^? : (%,PositiveInteger) -> %        coefficients : % -> List R
 coerce : Symbol -> %                  coerce : R -> %
 coerce : Integer -> %                 coerce : % -> OutputForm
 differentiate : (%,Symbol) -> %       eval : (%,Symbol,%) -> %
 eval : (%,Symbol,R) -> %              eval : (%,List %,List %) -> %
 eval : (%,%,%) -> %                   eval : (%,Equation %) -> %
 eval : (%,List Equation %) -> %       ground : % -> R
 ground? : % -> Boolean                hash : % -> SingleInteger
 latex : % -> String                   leadingCoefficient : % -> R
 leadingMonomial : % -> %              map : ((R -> R),%) -> %
 monomial? : % -> Boolean              monomials : % -> List %
 one? : % -> Boolean                   primitiveMonomials : % -> List %
 recip : % -> Union(%,"failed")        reductum : % -> %
 retract : % -> Symbol                 retract : % -> R
 sample : () -> %                      variables : % -> List Symbol
 zero? : % -> Boolean                  ?~=? : (%,%) -> Boolean
 ?*? : (Fraction Integer,%) -> % if R has ALGEBRA FRAC INT
 ?*? : (%,Fraction Integer) -> % if R has ALGEBRA FRAC INT
 ?*? : (NonNegativeInteger,%) -> %
 ?**? : (%,NonNegativeInteger) -> %
 ?/? : (%,R) -> % if R has FIELD
 ?<? : (%,%) -> Boolean if R has ORDSET
 ?<=? : (%,%) -> Boolean if R has ORDSET
 ?>? : (%,%) -> Boolean if R has ORDSET
 ?>=? : (%,%) -> Boolean if R has ORDSET
 D : (%,List Symbol,List NonNegativeInteger) -> %
 D : (%,Symbol,NonNegativeInteger) -> %
 ?^? : (%,NonNegativeInteger) -> %
 associates? : (%,%) -> Boolean if R has INTDOM
 binomThmExpt : (%,%,NonNegativeInteger) -> % if R has COMRING
 characteristic : () -> NonNegativeInteger
 charthRoot : % -> Union(%,"failed") if $ has CHARNZ and R has PFECAT or R has CHARNZ
 coefficient : (%,List Symbol,List NonNegativeInteger) -> %
 coefficient : (%,Symbol,NonNegativeInteger) -> %
 coefficient : (%,IndexedExponents Symbol) -> R
 coerce : % -> % if R has INTDOM
 coerce : Fraction Integer -> % if R has ALGEBRA FRAC INT or R has RETRACT FRAC INT
 conditionP : Matrix % -> Union(Vector %,"failed") if $ has CHARNZ and R has PFECAT
 content : (%,Symbol) -> % if R has GCDDOM
 content : % -> R if R has GCDDOM
 convert : % -> InputForm if Symbol has KONVERT INFORM and R has KONVERT INFORM
 convert : % -> Pattern Integer if Symbol has KONVERT PATTERN INT and R has KONVERT PATTERN INT
 convert : % -> Pattern Float if Symbol has KONVERT PATTERN FLOAT and R has KONVERT PATTERN FLOAT
 degree : (%,List Symbol) -> List NonNegativeInteger
 degree : (%,Symbol) -> NonNegativeInteger
 degree : % -> IndexedExponents Symbol
 differentiate : (%,List Symbol,List NonNegativeInteger) -> %
 differentiate : (%,Symbol,NonNegativeInteger) -> %
 differentiate : (%,List Symbol) -> %
 discriminant : (%,Symbol) -> % if R has COMRING
 eval : (%,List Symbol,List %) -> %
 eval : (%,List Symbol,List R) -> %
 exquo : (%,%) -> Union(%,"failed") if R has INTDOM
 exquo : (%,R) -> Union(%,"failed") if R has INTDOM
 factor : % -> Factored % if R has PFECAT
 factorPolynomial : SparseUnivariatePolynomial % -> Factored SparseUnivariatePolynomial % if R has PFECAT
 factorSquareFreePolynomial : SparseUnivariatePolynomial % -> Factored SparseUnivariatePolynomial % if R has PFECAT
 gcd : (%,%) -> % if R has GCDDOM
 gcd : List % -> % if R has GCDDOM
 gcdPolynomial : (SparseUnivariatePolynomial %,SparseUnivariatePolynomial %) -> SparseUnivariatePolynomial % if R has GCDDOM
 integrate : (%,Symbol) -> % if R has ALGEBRA FRAC INT
 isExpt : % -> Union(Record(var: Symbol,exponent: NonNegativeInteger),"failed")
 isPlus : % -> Union(List %,"failed")
 isTimes : % -> Union(List %,"failed")
 lcm : (%,%) -> % if R has GCDDOM
 lcm : List % -> % if R has GCDDOM
 mainVariable : % -> Union(Symbol,"failed")
 mapExponents : ((IndexedExponents Symbol -> IndexedExponents Symbol),%) -> %
 max : (%,%) -> % if R has ORDSET
 min : (%,%) -> % if R has ORDSET
 minimumDegree : (%,List Symbol) -> List NonNegativeInteger
 minimumDegree : (%,Symbol) -> NonNegativeInteger
 minimumDegree : % -> IndexedExponents Symbol
 monicDivide : (%,%,Symbol) -> Record(quotient: %,remainder: %)
 monomial : (%,List Symbol,List NonNegativeInteger) -> %
 monomial : (%,Symbol,NonNegativeInteger) -> %
 monomial : (R,IndexedExponents Symbol) -> %
 multivariate : (SparseUnivariatePolynomial %,Symbol) -> %
 multivariate : (SparseUnivariatePolynomial R,Symbol) -> %
 numberOfMonomials : % -> NonNegativeInteger
 patternMatch : (%,Pattern Integer,PatternMatchResult(Integer,%)) -> PatternMatchResult(Integer,%) if Symbol has PATMAB INT and R has PATMAB INT
 patternMatch : (%,Pattern Float,PatternMatchResult(Float,%)) -> PatternMatchResult(Float,%) if Symbol has PATMAB FLOAT and R has PATMAB FLOAT
 pomopo! : (%,R,IndexedExponents Symbol,%) -> %
 prime? : % -> Boolean if R has PFECAT
 primitivePart : (%,Symbol) -> % if R has GCDDOM
 primitivePart : % -> % if R has GCDDOM
 reducedSystem : Matrix % -> Matrix R
 reducedSystem : (Matrix %,Vector %) -> Record(mat: Matrix R,vec: Vector R)
 reducedSystem : (Matrix %,Vector %) -> Record(mat: Matrix Integer,vec: Vector Integer) if R has LINEXP INT
 reducedSystem : Matrix % -> Matrix Integer if R has LINEXP INT
 resultant : (%,%,Symbol) -> % if R has COMRING
 retract : % -> Integer if R has RETRACT INT
 retract : % -> Fraction Integer if R has RETRACT FRAC INT
 retractIfCan : % -> Union(Symbol,"failed")
 retractIfCan : % -> Union(Integer,"failed") if R has RETRACT INT
 retractIfCan : % -> Union(Fraction Integer,"failed") if R has RETRACT FRAC INT
 retractIfCan : % -> Union(R,"failed")
 solveLinearPolynomialEquation : (List SparseUnivariatePolynomial %,SparseUnivariatePolynomial %) -> Union(List SparseUnivariatePolynomial %,"failed") if R has PFECAT
 squareFree : % -> Factored % if R has GCDDOM
 squareFreePart : % -> % if R has GCDDOM
 squareFreePolynomial : SparseUnivariatePolynomial % -> Factored SparseUnivariatePolynomial % if R has PFECAT
 subtractIfCan : (%,%) -> Union(%,"failed")
 totalDegree : (%,List Symbol) -> NonNegativeInteger
 totalDegree : % -> NonNegativeInteger
 unit? : % -> Boolean if R has INTDOM
 unitCanonical : % -> % if R has INTDOM
 unitNormal : % -> Record(unit: %,canonical: %,associate: %) if R has INTDOM
 univariate : % -> SparseUnivariatePolynomial R
 univariate : (%,Symbol) -> SparseUnivariatePolynomial %


P := Polynomial Q
 

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

P has EuclideanDomain
 

   (58)  false
                                                                Type: Boolean
                                                   Time: 0.01 (IN) = 0.01 sec

(x + 1)/(y + 2)
 

         x + 1
   (59)  -----
         y + 2
                                            Type: Fraction Polynomial Integer
                                                   Time: 0.01 (IN) = 0.01 sec

U := UnivariatePolynomial(x,Q)
 

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

U has EuclideanDomain
 

   (61)  true
                                                                Type: Boolean
                                                                  Time: 0 sec


p1: P := 6 * (x + 1) * (x + 2)
 

           2
   (62)  6x  + 18x + 12
                                            Type: Polynomial Fraction Integer
                                                                  Time: 0 sec

p2: P := 9 * (x + 1) * ( x + 3)
 

           2
   (63)  9x  + 36x + 27
                                            Type: Polynomial Fraction Integer
                                                   Time: 0.01 (IN) = 0.01 sec

gcd(p1,p2)
 

   (64)  x + 1
                                            Type: Polynomial Fraction Integer
                                                   Time: 0.01 (EV) = 0.01 sec

u1: U := p1
 

           2
   (65)  6x  + 18x + 12
                               Type: UnivariatePolynomial(x,Fraction Integer)
                                                   Time: 0.03 (IN) = 0.03 sec

u2: U := p2
 

           2
   (66)  9x  + 36x + 27
                               Type: UnivariatePolynomial(x,Fraction Integer)
                                                                  Time: 0 sec

gcd(u1,u2)
 

   (67)  x + 1
                               Type: UnivariatePolynomial(x,Fraction Integer)
                                                   Time: 0.01 (IN) = 0.01 sec

gcd( (y^3-1) * p1, (y^2 -1) * p2)
 

   (68)  (x + 1)y - x - 1
                                            Type: Polynomial Fraction Integer
                                                   Time: 0.02 (EV) = 0.02 sec
Session1 (69) -> )spool

Finished dribbling to session1.out.



Subsections
Marc Moreno Maza
2008-01-07