Re: [Axiom-mail] finding source code

Tim Daly <[email protected]> Thu, 29 Oct 2009 13:09:54 -0500
Newsgroups gmane.comp.mathematics.axiom.devel,gmane.comp.mathematics.axiom.user
Message-ID <[email protected]>
Martin Baker wrote:
>> May I ask how you found out about Axiom? What version did you
>> actually install on your computer?
>>     
>
> Ralf,
>
> I have been looking for an open source computer algebra system for some time 
> although I did not try any, I came across Axiom in lists of such systems but I 
> did not try it because (for some reason) I was put off when it said that it 
> was based on LISP.
>
> Having tried it now it works well and it seems very good (I wish I had done so 
> earlier). At first sight the user language reminds me a bit of 'Scala' in that 
> the type is given after the variable if required, also the way that brackets 
> can sometimes be omitted for what looks to me like function calls.
>
> I loaded the binary from this page:
> http://www.axiom-developer.org/axiom-website/download.html
> (suse,May2009)
>
> I recorded what I did on my web page here:
> http://www.euclideanspace.com/maths/standards/program/
>
> As you can see the program seems to work except the draw function which seems 
> to fail with:
>
>   
>>> System error:
>>>       
> Unknown bfd format
>
> The only other problem is capturing the output to put on a web page, you can 
> see what I mean about 2/3 of the way down this screen:
>
> http://www.euclideanspace.com/maths/algebra/equations/polynomial/cubic/
>
> Apart from being too big for the page, not all the LaTeX seemed to be 
> recognised (I cut and pasted from Axiom to Lyx and then did a screen shot).
>
> So, that's my experience so far, apart from these small problems it looks like 
> a very useful program.
>
> Martin
>
>
> _______________________________________________
> Axiom-mail mailing list
> [email protected]
> http://lists.nongnu.org/mailman/listinfo/axiom-mail
>
>   
Martin,

It appears that you have an interest in documenting the use of mathematics.
Axiom is being rewritten into literate form, which means that the source 
code
is now taken directly from the books, such as bookvol10.3 which contains the
sources for the Axiom domains.

You may also find interesting examples in several places in Axiom.

1) EXAMPLES OF FUNCTION CALLS

First, there is documentation of example code use. You can type
  )display operation makeprod
and you will see the "Mappings" and some example code. In the case
of the "makeprod" function the example will look like:

  Examples of makeprod from Product

  f:(x:INT):INT +-> 3*x
  g:(x:INT):INT +-> x^3
  h(x:INT):Product(INT,INT) == makeprod(f x,g x)
  h(3)

This gives you sample input for the makeprod command.


2) FUNCTIONS FROM A DOMAIN

You have also expressed an interest in Quaternions. You can see
what functions are available for Quaternions by typing
   )show Quaternion
which gives the output shown below.


3) HELP FUNCTION

For some domains you can also type
   )help Quaternion
and see a help page for that domain with the output shown below.

Axiom is in the process of documenting all of the code. If you
would like to help, either with examples or with explanations of
areas like Quaternions that would be greatly appreciated.


4) INPUT FILES

The directory $AXIOM/input contains a large number of files
which can be read into Axiom and executed. There are examples
of quite a few domains.

5) HYPERDOC

Clearly you cannot get hyperdoc running. I am not sure what
the problem might be but if you send me email we can discuss
it further.

Tim Daly
Elder of the Internet





                        AXIOM Computer Algebra System
                       Version: Axiom (September 2009)
              Timestamp: Thursday October 29, 2009 at 06:43:59
-----------------------------------------------------------------------------
   Issue )copyright to view copyright notices.
   Issue )summary for a summary of useful system commands.
   Issue )quit to leave AXIOM and return to shell.
-----------------------------------------------------------------------------
 
   Re-reading compress.daase   Re-reading interp.daase
   Re-reading operation.daase
   Re-reading category.daase
   Re-reading browse.daase
(1) ->
(1) -> )display operation makeprod

There is one unexposed function called makeprod :
   [1] (D1,D2) -> Product(D1,D2) from Product(D1,D2)
            if D1 has SETCAT and D2 has SETCAT

Examples of makeprod from Product

f:=(x:INT):INT +-> 3*x
g:=(x:INT):INT +-> x^3
h(x:INT):Product(INT,INT) == makeprod(f x, g x)
h(3)

(1) -> )show Quaternion
 Quaternion R: CommutativeRing  is a domain constructor
 Abbreviation for Quaternion is QUAT
 This constructor is exposed in this frame.
 Issue )edit bookvol10.3.spad.pamphlet to see algebra source code for QUAT

------------------------------- Operations --------------------------------
 ?*? : (R,%) -> %                      ?*? : (%,R) -> %
 ?*? : (%,%) -> %                      ?*? : (Integer,%) -> %
 ?*? : (PositiveInteger,%) -> %        ?**? : (%,PositiveInteger) -> %
 ?+? : (%,%) -> %                      ?-? : (%,%) -> %
 -? : % -> %                           ?=? : (%,%) -> Boolean
 D : (%,(R -> R)) -> %                 D : % -> % if R has DIFRING
 1 : () -> %                           0 : () -> %
 ?^? : (%,PositiveInteger) -> %        abs : % -> R if R has RNS
 coerce : R -> %                       coerce : Integer -> %
 coerce : % -> OutputForm              conjugate : % -> %
 hash : % -> SingleInteger             imagI : % -> R
 imagJ : % -> R                        imagK : % -> R
 inv : % -> % if R has FIELD           latex : % -> String
 map : ((R -> R),%) -> %               norm : % -> R
 one? : % -> Boolean                   quatern : (R,R,R,R) -> %
 real : % -> R                         recip : % -> Union(%,"failed")
 retract : % -> R                      sample : () -> %
 zero? : % -> Boolean                  ?~=? : (%,%) -> Boolean
 ?*? : (Fraction Integer,%) -> % if R has FIELD
 ?*? : (%,Fraction Integer) -> % if R has FIELD
 ?*? : (NonNegativeInteger,%) -> %
 ?**? : (%,Integer) -> % if R has FIELD
 ?**? : (%,NonNegativeInteger) -> %
 ?<? : (%,%) -> Boolean if R has ORDSET
 ?<=? : (%,%) -> Boolean if R has ORDSET
 ?>? : (%,%) -> Boolean if R has ORDSET
 ?>=? : (%,%) -> Boolean if R has ORDSET
 D : (%,(R -> R),NonNegativeInteger) -> %
 D : (%,List Symbol,List NonNegativeInteger) -> % if R has PDRING SYMBOL
 D : (%,Symbol,NonNegativeInteger) -> % if R has PDRING SYMBOL
 D : (%,List Symbol) -> % if R has PDRING SYMBOL
 D : (%,Symbol) -> % if R has PDRING SYMBOL
 D : (%,NonNegativeInteger) -> % if R has DIFRING
 ?^? : (%,Integer) -> % if R has FIELD
 ?^? : (%,NonNegativeInteger) -> %
 characteristic : () -> NonNegativeInteger
 charthRoot : % -> Union(%,"failed") if R has CHARNZ
 coerce : Fraction Integer -> % if R has FIELD or R has RETRACT FRAC INT
 convert : % -> InputForm if R has KONVERT INFORM
 differentiate : (%,(R -> R)) -> %
 differentiate : (%,(R -> R),NonNegativeInteger) -> %
 differentiate : (%,List Symbol,List NonNegativeInteger) -> % if R has 
PDRING SYMBOL
 differentiate : (%,Symbol,NonNegativeInteger) -> % if R has PDRING SYMBOL
 differentiate : (%,List Symbol) -> % if R has PDRING SYMBOL
 differentiate : (%,Symbol) -> % if R has PDRING SYMBOL
 differentiate : (%,NonNegativeInteger) -> % if R has DIFRING
 differentiate : % -> % if R has DIFRING
 ?.? : (%,R) -> % if R has ELTAB(R,R)
 eval : (%,Symbol,R) -> % if R has IEVALAB(SYMBOL,R)
 eval : (%,List Symbol,List R) -> % if R has IEVALAB(SYMBOL,R)
 eval : (%,List Equation R) -> % if R has EVALAB R
 eval : (%,Equation R) -> % if R has EVALAB R
 eval : (%,R,R) -> % if R has EVALAB R
 eval : (%,List R,List R) -> % if R has EVALAB R
 max : (%,%) -> % if R has ORDSET
 min : (%,%) -> % if R has ORDSET
 rational : % -> Fraction Integer if R has INS
 rational? : % -> Boolean if R has INS
 rationalIfCan : % -> Union(Fraction Integer,"failed") if R has INS
 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
 retract : % -> Fraction Integer if R has RETRACT FRAC INT
 retract : % -> Integer if R has RETRACT INT
 retractIfCan : % -> Union(R,"failed")
 retractIfCan : % -> Union(Fraction Integer,"failed") if R has RETRACT 
FRAC INT
 retractIfCan : % -> Union(Integer,"failed") if R has RETRACT INT
 subtractIfCan : (%,%) -> Union(%,"failed")

(1) -> )help Quaternion
====================================================================
Quaternion examples
====================================================================

The domain constructor Quaternion implements quaternions over
commutative rings.

The basic operation for creating quaternions is quatern.  This is a
quaternion over the rational numbers.

  q := quatern(2/11,-8,3/4,1)
     2        3
    -- - 8i + - j + k
    11        4
                        Type: Quaternion Fraction Integer

The four arguments are the real part, the i imaginary part, the j
imaginary part, and the k imaginary part, respectively.

  [real q, imagI q, imagJ q, imagK q]
      2     3
    [--,- 8,-,1]
     11     4
                        Type: List Fraction Integer

Because q is over the rationals (and nonzero), you can invert it.

  inv q
      352     15488      484       1936
    ------ + ------ i - ----- j - ------ k
    126993   126993     42331     126993
                        Type: Quaternion Fraction Integer

The usual arithmetic (ring) operations are available

  q^6
      2029490709319345   48251690851     144755072553     48251690851
    - ---------------- - ----------- i + ------------ j + ----------- k
         7256313856        1288408         41229056         10307264
                        Type: Quaternion Fraction Integer

  r := quatern(-2,3,23/9,-89); q + r
      20        119
    - -- - 5i + --- j - 88k
      11         36
                        Type: Quaternion Fraction Integer

In general, multiplication is not commutative.

  q * r - r * q
      2495             817
    - ---- i - 1418j - --- k
       18               18
                         Type: Quaternion Fraction Integer

There are no predefined constants for the imaginary i, j, and k parts,
but you can easily define them.

  i:=quatern(0,1,0,0)
    i
                         Type: Quaternion Integer

  j:=quatern(0,0,1,0)
    j
                         Type: Quaternion Integer
 
  k:=quatern(0,0,0,1)
    k
                         Type: Quaternion Integer

These satisfy the normal identities.

  [i*i, j*j, k*k, i*j, j*k, k*i, q*i]
                             2         3
     [- 1,- 1,- 1,k,i,j,8 + -- i + j - - k]
                            11         4
                          Type: List Quaternion Fraction Integer

The norm is the quaternion times its conjugate.

  norm q
    126993
    ------
     1936
                          Type: Fraction Integer

  conjugate q
      2        3
     -- + 8i - - j - k
     11        4
                          Type: Quaternion Fraction Integer

  q * %
     126993
     ------
      1936
                          Type: Quaternion Fraction Integer

See Also:
o )help Octonion
o )help Complex
o )help CliffordAlgebra
o )show Quaternion

(1) -> )sys cat int/input/Quaternion.output
Starts dribbling to Quaternion.output (2009/10/29, 7:36:17).
)set message test on
 
)set message auto off
 
)clear all
 
--S 1 of 13
q := quatern(2/11,-8,3/4,1)
 

         2        3
   (1)  -- - 8i + - j + k
        11        4
                                            Type: Quaternion Fraction 
Integer
--R
--R
--R         2        3
--R   (1)  -- - 8i + - j + k
--R        11        4
--R                                            Type: Quaternion Fraction 
Integer
--E 1

--S 2 of 13
[real q, imagI q, imagJ q, imagK q]
 

          2     3
   (2)  [--,- 8,-,1]
         11     4
                                                  Type: List Fraction 
Integer
--R
--R
--R          2     3
--R   (2)  [--,- 8,-,1]
--R         11     4
--R                                                  Type: List Fraction 
Integer
--E 2

--S 3 of 13
inv q
 

          352     15488      484       1936
   (3)  ------ + ------ i - ----- j - ------ k
        126993   126993     42331     126993
                                            Type: Quaternion Fraction 
Integer
--R
--R
--R          352     15488      484       1936
--R   (3)  ------ + ------ i - ----- j - ------ k
--R        126993   126993     42331     126993
--R                                            Type: Quaternion Fraction 
Integer
--E 3

--S 4 of 13
q^6
 

          2029490709319345   48251690851     144755072553     48251690851
   (4)  - ---------------- - ----------- i + ------------ j + ----------- k
             7256313856        1288408         41229056         10307264
                                            Type: Quaternion Fraction 
Integer
--R
--R
--R          2029490709319345   48251690851     144755072553     48251690851
--R   (4)  - ---------------- - ----------- i + ------------ j + 
----------- k
--R             7256313856        1288408         41229056         10307264
--R                                            Type: Quaternion Fraction 
Integer
--E 4

--S 5 of 13
r := quatern(-2,3,23/9,-89); q + r
 

          20        119
   (5)  - -- - 5i + --- j - 88k
          11         36
                                            Type: Quaternion Fraction 
Integer
--R
--R
--R          20        119
--R   (5)  - -- - 5i + --- j - 88k
--R          11         36
--R                                            Type: Quaternion Fraction 
Integer
--E 5

--S 6 of 13
q * r - r * q
 

          2495             817
   (6)  - ---- i - 1418j - --- k
           18               18
                                            Type: Quaternion Fraction 
Integer
--R
--R
--R          2495             817
--R   (6)  - ---- i - 1418j - --- k
--R           18               18
--R                                            Type: Quaternion Fraction 
Integer
--E 6

--S 7 of 13
i:=quatern(0,1,0,0)
 

   (7)  i
                                                     Type: Quaternion 
Integer
--R
--R
--R   (7)  i
--R                                                     Type: Quaternion 
Integer
--E 7

--S 8 of 13
j:=quatern(0,0,1,0)
 

   (8)  j
                                                     Type: Quaternion 
Integer
--R
--R
--R   (8)  j
--R                                                     Type: Quaternion 
Integer
--E 8

--S 9 of 13
k:=quatern(0,0,0,1)
 

   (9)  k
                                                     Type: Quaternion 
Integer
--R
--R
--R   (9)  k
--R                                                     Type: Quaternion 
Integer
--E 9

--S 10 of 13
[i*i, j*j, k*k, i*j, j*k, k*i, q*i]
 

                                 2         3
   (10)  [- 1,- 1,- 1,k,i,j,8 + -- i + j - - k]
                                11         4
                                       Type: List Quaternion Fraction 
Integer
--R
--R
--R                                 2         3
--R   (10)  [- 1,- 1,- 1,k,i,j,8 + -- i + j - - k]
--R                                11         4
--R                                       Type: List Quaternion Fraction 
Integer
--E 10

--S 11 of 13
norm q
 

         126993
   (11)  ------
          1936
                                                       Type: Fraction 
Integer
--R
--R
--R         126993
--R   (11)  ------
--R          1936
--R                                                       Type: Fraction 
Integer
--E 11

--S 12 of 13
conjugate q
 

          2        3
   (12)  -- + 8i - - j - k
         11        4
                                            Type: Quaternion Fraction 
Integer
--R
--R
--R          2        3
--R   (12)  -- + 8i - - j - k
--R         11        4
--R                                            Type: Quaternion Fraction 
Integer
--E 12

--S 13 of 13
q * %
 

         126993
   (13)  ------
          1936
                                            Type: Quaternion Fraction 
Integer
--R
--R
--R         126993
--R   (13)  ------
--R          1936
--R                                            Type: Quaternion Fraction 
Integer
--E 13
)spool
 
(1) ->

                        AXIOM Computer Algebra System
                       Version: Axiom (September 2009)
              Timestamp: Thursday October 29, 2009 at 06:43:59
-----------------------------------------------------------------------------
   Issue )copyright to view copyright notices.
   Issue )summary for a summary of useful system commands.
   Issue )quit to leave AXIOM and return to shell.
-----------------------------------------------------------------------------
 
   Re-reading compress.daase   Re-reading interp.daase
   Re-reading operation.daase
   Re-reading category.daase
   Re-reading browse.daase
(1) ->
(1) -> )display operation makeprod

There is one unexposed function called makeprod :
   [1] (D1,D2) -> Product(D1,D2) from Product(D1,D2)
            if D1 has SETCAT and D2 has SETCAT

Examples of makeprod from Product

f:=(x:INT):INT +-> 3*x
g:=(x:INT):INT +-> x^3
h(x:INT):Product(INT,INT) == makeprod(f x, g x)
h(3)

(1) -> )show Quaternion
 Quaternion R: CommutativeRing  is a domain constructor
 Abbreviation for Quaternion is QUAT
 This constructor is exposed in this frame.
 Issue )edit bookvol10.3.spad.pamphlet to see algebra source code for QUAT

------------------------------- Operations --------------------------------
 ?*? : (R,%) -> %                      ?*? : (%,R) -> %
 ?*? : (%,%) -> %                      ?*? : (Integer,%) -> %
 ?*? : (PositiveInteger,%) -> %        ?**? : (%,PositiveInteger) -> %
 ?+? : (%,%) -> %                      ?-? : (%,%) -> %
 -? : % -> %                           ?=? : (%,%) -> Boolean
 D : (%,(R -> R)) -> %                 D : % -> % if R has DIFRING
 1 : () -> %                           0 : () -> %
 ?^? : (%,PositiveInteger) -> %        abs : % -> R if R has RNS
 coerce : R -> %                       coerce : Integer -> %
 coerce : % -> OutputForm              conjugate : % -> %
 hash : % -> SingleInteger             imagI : % -> R
 imagJ : % -> R                        imagK : % -> R
 inv : % -> % if R has FIELD           latex : % -> String
 map : ((R -> R),%) -> %               norm : % -> R
 one? : % -> Boolean                   quatern : (R,R,R,R) -> %
 real : % -> R                         recip : % -> Union(%,"failed")
 retract : % -> R                      sample : () -> %
 zero? : % -> Boolean                  ?~=? : (%,%) -> Boolean
 ?*? : (Fraction Integer,%) -> % if R has FIELD
 ?*? : (%,Fraction Integer) -> % if R has FIELD
 ?*? : (NonNegativeInteger,%) -> %
 ?**? : (%,Integer) -> % if R has FIELD
 ?**? : (%,NonNegativeInteger) -> %
 ?<? : (%,%) -> Boolean if R has ORDSET
 ?<=? : (%,%) -> Boolean if R has ORDSET
 ?>? : (%,%) -> Boolean if R has ORDSET
 ?>=? : (%,%) -> Boolean if R has ORDSET
 D : (%,(R -> R),NonNegativeInteger) -> %
 D : (%,List Symbol,List NonNegativeInteger) -> % if R has PDRING SYMBOL
 D : (%,Symbol,NonNegativeInteger) -> % if R has PDRING SYMBOL
 D : (%,List Symbol) -> % if R has PDRING SYMBOL
 D : (%,Symbol) -> % if R has PDRING SYMBOL
 D : (%,NonNegativeInteger) -> % if R has DIFRING
 ?^? : (%,Integer) -> % if R has FIELD
 ?^? : (%,NonNegativeInteger) -> %
 characteristic : () -> NonNegativeInteger
 charthRoot : % -> Union(%,"failed") if R has CHARNZ
 coerce : Fraction Integer -> % if R has FIELD or R has RETRACT FRAC INT
 convert : % -> InputForm if R has KONVERT INFORM
 differentiate : (%,(R -> R)) -> %
 differentiate : (%,(R -> R),NonNegativeInteger) -> %
 differentiate : (%,List Symbol,List NonNegativeInteger) -> % if R has 
PDRING SYMBOL
 differentiate : (%,Symbol,NonNegativeInteger) -> % if R has PDRING SYMBOL
 differentiate : (%,List Symbol) -> % if R has PDRING SYMBOL
 differentiate : (%,Symbol) -> % if R has PDRING SYMBOL
 differentiate : (%,NonNegativeInteger) -> % if R has DIFRING
 differentiate : % -> % if R has DIFRING
 ?.? : (%,R) -> % if R has ELTAB(R,R)
 eval : (%,Symbol,R) -> % if R has IEVALAB(SYMBOL,R)
 eval : (%,List Symbol,List R) -> % if R has IEVALAB(SYMBOL,R)
 eval : (%,List Equation R) -> % if R has EVALAB R
 eval : (%,Equation R) -> % if R has EVALAB R
 eval : (%,R,R) -> % if R has EVALAB R
 eval : (%,List R,List R) -> % if R has EVALAB R
 max : (%,%) -> % if R has ORDSET
 min : (%,%) -> % if R has ORDSET
 rational : % -> Fraction Integer if R has INS
 rational? : % -> Boolean if R has INS
 rationalIfCan : % -> Union(Fraction Integer,"failed") if R has INS
 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
 retract : % -> Fraction Integer if R has RETRACT FRAC INT
 retract : % -> Integer if R has RETRACT INT
 retractIfCan : % -> Union(R,"failed")
 retractIfCan : % -> Union(Fraction Integer,"failed") if R has RETRACT 
FRAC INT
 retractIfCan : % -> Union(Integer,"failed") if R has RETRACT INT
 subtractIfCan : (%,%) -> Union(%,"failed")

(1) -> )help Quaternion
====================================================================
Quaternion examples
====================================================================

The domain constructor Quaternion implements quaternions over
commutative rings.

The basic operation for creating quaternions is quatern.  This is a
quaternion over the rational numbers.

  q := quatern(2/11,-8,3/4,1)
     2        3
    -- - 8i + - j + k
    11        4
                        Type: Quaternion Fraction Integer

The four arguments are the real part, the i imaginary part, the j
imaginary part, and the k imaginary part, respectively.

  [real q, imagI q, imagJ q, imagK q]
      2     3
    [--,- 8,-,1]
     11     4
                        Type: List Fraction Integer

Because q is over the rationals (and nonzero), you can invert it.

  inv q
      352     15488      484       1936
    ------ + ------ i - ----- j - ------ k
    126993   126993     42331     126993
                        Type: Quaternion Fraction Integer

The usual arithmetic (ring) operations are available

  q^6
      2029490709319345   48251690851     144755072553     48251690851
    - ---------------- - ----------- i + ------------ j + ----------- k
         7256313856        1288408         41229056         10307264
                        Type: Quaternion Fraction Integer

  r := quatern(-2,3,23/9,-89); q + r
      20        119
    - -- - 5i + --- j - 88k
      11         36
                        Type: Quaternion Fraction Integer

In general, multiplication is not commutative.

  q * r - r * q
      2495             817
    - ---- i - 1418j - --- k
       18               18
                         Type: Quaternion Fraction Integer

There are no predefined constants for the imaginary i, j, and k parts,
but you can easily define them.

  i:=quatern(0,1,0,0)
    i
                         Type: Quaternion Integer

  j:=quatern(0,0,1,0)
    j
                         Type: Quaternion Integer
 
  k:=quatern(0,0,0,1)
    k
                         Type: Quaternion Integer

These satisfy the normal identities.

  [i*i, j*j, k*k, i*j, j*k, k*i, q*i]
                             2         3
     [- 1,- 1,- 1,k,i,j,8 + -- i + j - - k]
                            11         4
                          Type: List Quaternion Fraction Integer

The norm is the quaternion times its conjugate.

  norm q
    126993
    ------
     1936
                          Type: Fraction Integer

  conjugate q
      2        3
     -- + 8i - - j - k
     11        4
                          Type: Quaternion Fraction Integer

  q * %
     126993
     ------
      1936
                          Type: Quaternion Fraction Integer

See Also:
o )help Octonion
o )help Complex
o )help CliffordAlgebra
o )show Quaternion

(1) -> )sys cat int/input/Quaternion.output
Starts dribbling to Quaternion.output (2009/10/29, 7:36:17).
)set message test on
 
)set message auto off
 
)clear all
 
--S 1 of 13
q := quatern(2/11,-8,3/4,1)
 

         2        3
   (1)  -- - 8i + - j + k
        11        4
                                            Type: Quaternion Fraction 
Integer
--R
--R
--R         2        3
--R   (1)  -- - 8i + - j + k
--R        11        4
--R                                            Type: Quaternion Fraction 
Integer
--E 1

--S 2 of 13
[real q, imagI q, imagJ q, imagK q]
 

          2     3
   (2)  [--,- 8,-,1]
         11     4
                                                  Type: List Fraction 
Integer
--R
--R
--R          2     3
--R   (2)  [--,- 8,-,1]
--R         11     4
--R                                                  Type: List Fraction 
Integer
--E 2

--S 3 of 13
inv q
 

          352     15488      484       1936
   (3)  ------ + ------ i - ----- j - ------ k
        126993   126993     42331     126993
                                            Type: Quaternion Fraction 
Integer
--R
--R
--R          352     15488      484       1936
--R   (3)  ------ + ------ i - ----- j - ------ k
--R        126993   126993     42331     126993
--R                                            Type: Quaternion Fraction 
Integer
--E 3

--S 4 of 13
q^6
 

          2029490709319345   48251690851     144755072553     48251690851
   (4)  - ---------------- - ----------- i + ------------ j + ----------- k
             7256313856        1288408         41229056         10307264
                                            Type: Quaternion Fraction 
Integer
--R
--R
--R          2029490709319345   48251690851     144755072553     48251690851
--R   (4)  - ---------------- - ----------- i + ------------ j + 
----------- k
--R             7256313856        1288408         41229056         10307264
--R                                            Type: Quaternion Fraction 
Integer
--E 4

--S 5 of 13
r := quatern(-2,3,23/9,-89); q + r
 

          20        119
   (5)  - -- - 5i + --- j - 88k
          11         36
                                            Type: Quaternion Fraction 
Integer
--R
--R
--R          20        119
--R   (5)  - -- - 5i + --- j - 88k
--R          11         36
--R                                            Type: Quaternion Fraction 
Integer
--E 5

--S 6 of 13
q * r - r * q
 

          2495             817
   (6)  - ---- i - 1418j - --- k
           18               18
                                            Type: Quaternion Fraction 
Integer
--R
--R
--R          2495             817
--R   (6)  - ---- i - 1418j - --- k
--R           18               18
--R                                            Type: Quaternion Fraction 
Integer
--E 6

--S 7 of 13
i:=quatern(0,1,0,0)
 

   (7)  i
                                                     Type: Quaternion 
Integer
--R
--R
--R   (7)  i
--R                                                     Type: Quaternion 
Integer
--E 7

--S 8 of 13
j:=quatern(0,0,1,0)
 

   (8)  j
                                                     Type: Quaternion 
Integer
--R
--R
--R   (8)  j
--R                                                     Type: Quaternion 
Integer
--E 8

--S 9 of 13
k:=quatern(0,0,0,1)
 

   (9)  k
                                                     Type: Quaternion 
Integer
--R
--R
--R   (9)  k
--R                                                     Type: Quaternion 
Integer
--E 9

--S 10 of 13
[i*i, j*j, k*k, i*j, j*k, k*i, q*i]
 

                                 2         3
   (10)  [- 1,- 1,- 1,k,i,j,8 + -- i + j - - k]
                                11         4
                                       Type: List Quaternion Fraction 
Integer
--R
--R
--R                                 2         3
--R   (10)  [- 1,- 1,- 1,k,i,j,8 + -- i + j - - k]
--R                                11         4
--R                                       Type: List Quaternion Fraction 
Integer
--E 10

--S 11 of 13
norm q
 

         126993
   (11)  ------
          1936
                                                       Type: Fraction 
Integer
--R
--R
--R         126993
--R   (11)  ------
--R          1936
--R                                                       Type: Fraction 
Integer
--E 11

--S 12 of 13
conjugate q
 

          2        3
   (12)  -- + 8i - - j - k
         11        4
                                            Type: Quaternion Fraction 
Integer
--R
--R
--R          2        3
--R   (12)  -- + 8i - - j - k
--R         11        4
--R                                            Type: Quaternion Fraction 
Integer
--E 12

--S 13 of 13
q * %
 

         126993
   (13)  ------
          1936
                                            Type: Quaternion Fraction 
Integer
--R
--R
--R         126993
--R   (13)  ------
--R          1936
--R                                            Type: Quaternion Fraction 
Integer
--E 13
)spool
 
(1) ->