Go to the first, previous, next, last section, table of contents.

## Representation of algebraic numbers

In Asir algebraic number fields are not defined as independent objects. Instead, individual algebraic numbers are defined by some means. In Asir an algebraic number field is defined virtually as a number field obtained by adjoining a finite number of algebraic numbers to the rational number field. A new algebraic number is introduced in Asir in such a way where it is defined as a root of an uni-variate polynomial whose coefficients include already defined algebraic numbers as well as rational numbers. We shall call such a newly defined algebraic number a root. Also, we call such an uni-variate polynomial the defining polynomial of that root.

    [0] A0=newalg(x^2+1);
    (#0)
    [1] A1=newalg(x^3+A0*x+A0);
    (#1)
    [2]  [type(A0),ntype(A0)];
    [1,2]

In this example, the algebraic number assigned to `A0` is defined as a root of a polynomial `x^2+1`; that of `A1` is defined as a root of a polynomial `x^3+A0*x+A0`, which you see contains the previously defined root (`A0`) in its coefficients.

The argument to `newalg()`, i.e., the defining polynomial, must satisfy the following conditions.

1. A defining polynomial must be an uni-variate polynomial.
2. A defining polynomial is used to simplify expressions containing that algebraic number. The procedure of such simplification is performed by an internal routine similar to the built-in function `srem()`, where the defining polynomial is used for the second argument, the divisor. By this reason, the leading coefficient of the defining polynomial must be a rational number (must not be an algebraic number.)
3. Every coefficients of a defining polynomial must be a `(multi-variate) polynomial' in already defined root's. Here, `(multi-variate) polynomial' means a mathematical concept, not the object type `polynomial' in Asir.
4. A defining polynomial must be irreducible over the field that is obtained by adjoining all root's contained in its coefficients to the rational number field.

Only the first two conditions (1 and 2) are checked by function `newalg()`. Among all, it should be emphasized that no check is done for the irreducibility at all. The reason is that the irreducibility test requires enormously much computation time. You are trusted whether to check it at your own risk.

Once a root has been defined by `newalg()` function, it is given the type identifier for a number, and furthermore, the sub-type identifier for an algebraic number. (See section `type`, section `ntype`.) Also, any rational combination of rational numbers and root's is an algebraic number.

    [87] N=(A0^2+A1)/(A1^2-A0-1);
    ((#1+#0^2)/(#1^2-#0-1))
    [88] [type(N),ntype(N)];
    [1,2]

As you see it in the example, a root is displayed as `#n`. But, you cannot input that root in its immediate output form. You have to refer to a root by a program variable assigned to the root, or to get it by `alg(n)` function, or by several other indirect means. A strange use of `newalg()`, with a same argument polynomial (except for the name of its main variable), will yield the old root instead of a new root though it is apparently inefficient.

    [90] alg(0);
    (#0)
    [91] newalg(t^2+1);
    (#0)

The defining polynomial of a root can be obtained by `defpoly()` function.

    [96] defpoly(A0);
    t#0^2+1
    [97] defpoly(A1);
    t#1^3+t#0*t#1+t#0

Here, you see a strange expression, `t#0` and `t#1`. They are a specially indeterminates generated and maintained by Asir internally. Indeterminate `t#0` corresponds to root `#0`, and `t#0` to `#1`. These indeterminates also cannot be input directly by a user in their immediate forms. You can get them by several ways: by `var()` function, or `algv(n)` function.

    [98] var(@);
    t#1
    [99] algv(0);
    t#0
    [100]

Go to the first, previous, next, last section, table of contents.