So far, Axiom does most of the calculation we would expect of any computer algebra system. But now we look at an aspect of Axiom which sets it apart from other systems: its use of *types*. In Axiom, “type” is another word for “domain”, or “domain of computation”, which is a method of organizing all objects. Objects include standard mathematical constructs such as matrices, functions, integers, abelian groups; data structures such as lists and arrays; as well as constructs built up from other constructs. Thus in Axiom we can create and use the type: “List of square matrices of polynomials over integer fractions”. The type of the operand indicates the type of the operation: a simple multiplication * will have a different interpretation depending on whether the operands are integers, real numbers (floats), matrices, elements of a finite field, or many other types.

There are three special symbols which are used when dealing with types:

`::`- This is used for converting from one type to another. In the form
`object::type`it takes the object`object`and converts it to type`type`. `type`.`@`- This means to choose the operation (and possibly convert the types of the objects, if needed) so that the result is of the given type.

As examples of the use and misuse of these symbols, let’s investigate the calculation

The type we will use is `IntegerMod`, which can be abbreviated `ZMOD`:

What is happening here? In the first command, we deliberately ask that the power be taken from its ZMOD definition; that is, using the well-known fast algorithm. In the second command, the 3 was defined as being of type “`ZMOD 1048576`” before the power was attempted. This means that any further arithmetic on the 3 will use versions taken from their ZMOD definitions. The last command says, in effect: “First work out the value of 3^1000000000, and then convert that to a value modulo 1048576.” Needless to say, this is wasteful of time and memory, and will probably cause an overflow and crash Axiom.

Here’s another example of type conversion, this time using prime fields. The abbreviation for the finite field of residues modulo a prime p is `PF p`.

Note that we are using a type built of other types here: we have to convert the polynomial `p` to the type `POLY PF 5` to indicate that the type we want is polynomials defined over the finite field .

An example using matrices:

Note that again we had to give the full type of `A`. If we tried to convert `A` to type “`PF 11`” Axiom would return an error message saying that the particular conversion is not possible.

Finally, some examples of “package calling” – calling a command with the same name (in this case `random`) but from different packages. The first command requests a random integer; the second a random residue from the finite field , and the last a random element from the finite field :

“@

This means to apply the operation as defined for the initial types of the objects, and convert the result to the given type.”

My understanding is subtly different. I believe that @ affects the process by which Axiom selects the meaning of an operations. For example + can stand for many different functions – one for each type. If you add two Integers, then normally will select the function called + that operates on two Integers. Similarly @ asks Axiom to find the operation that produces the specified result. In some cases this can cause Axiom to perform conversions of the *operands* in order to satisfy this request. For example:

(2) -> )set mes bot on

(2) -> (1+3)@Float

Function Selection for +

Arguments: (FLOAT,FLOAT)

Target type: FLOAT

[1] signature: (FLOAT,FLOAT) -> FLOAT

implemented: slot

$ from INT

(3) 4

Type: Integer

Possible typo?

> As an examples of the use and misuse of these symbols…

> As an example of the use and misuse of these symbols…