[ << ] [ < ] [ Up ] [ > ] [ >> ] [Top] [Contents] [Index] [ ? ]

## 9.5 Summary of functions for algebraic numbers

 [ << ] [ < ] [ Up ] [ > ] [ >> ] [Top] [Contents] [Index] [ ? ]

### 9.5.1 `newalg`

newalg(defpoly)

:: Creates a new root.

return

algebraic number (root)

defpoly

polynomial

```[0] A0=newalg(x^2-2);
(#0)
```
Reference

 [ << ] [ < ] [ Up ] [ > ] [ >> ] [Top] [Contents] [Index] [ ? ]

### 9.5.2 `defpoly`

defpoly(alg)

:: Returns the defining polynomial of root alg.

return

polynomial

alg

algebraic number (`root`)

• Returns the defining polynomial of root alg.
• If the argument alg, a root, is `#n`, then the main variable of its defining polynomial is `t#n`.
```[1] defpoly(A0);
t#0^2-2
```
Reference

 [ << ] [ < ] [ Up ] [ > ] [ >> ] [Top] [Contents] [Index] [ ? ]

### 9.5.3 `alg`

alg(i)

:: Returns a root which correspond to the index i.

return

algebraic number (`root`)

i

integer

• Returns `#i`, a root.
• Because `#i` cannot be input directly, this function provides an alternative way: input `alg(i)`.
```[2] x+#0;
syntax error
0
[3] alg(0);
(#0)
```
Reference

 [ << ] [ < ] [ Up ] [ > ] [ >> ] [Top] [Contents] [Index] [ ? ]

### 9.5.4 `algv`

algv(i)

:: Returns the associated indeterminate with `alg(i)`.

return

polynomial

i

integer

• Returns an indeterminate `t#i`
• Since indeterminate `t#i` cannot be input directly, it is input by `algv(i)`.
```[4] var(defpoly(A0));
t#0
[5] t#0;
syntax error
0
[6] algv(0);
t#0
```
Reference

 [ << ] [ < ] [ Up ] [ > ] [ >> ] [Top] [Contents] [Index] [ ? ]

### 9.5.5 `simpalg`

simpalg(rat)

:: Simplifies algebraic numbers in a rational expression.

return

rational expression

rat

rational expression

• Defined in the file ‘sp’.
• Simplifies algebraic numbers contained in numbers, polynomials, and rational expressions by the defining polynomials of root’s contained in them.
• If the argument is a number having the denominator, it is rationalized and the result is a polynomial in root’s.
• If the argument is a polynomial, each coefficient is simplified.
• If the argument is a rational expression, its denominator and numerator are simplified as a polynomial.
```[7] simpalg((1+A0)/(1-A0));
simpalg undefined
[46] simpalg((1+A0)/(1-A0));
(-2*#0-3)
[47] simpalg((2-A0)/(2+A0)*x^2-1/(3+A0));
(-2*#0+3)*x^2+(1/7*#0-3/7)
[48] simpalg((x+1/(A0-1))/(x-1/(A0+1)));
(x+(#0+1))/(x+(-#0+1))
```

 [ << ] [ < ] [ Up ] [ > ] [ >> ] [Top] [Contents] [Index] [ ? ]

### 9.5.6 `algptorat`

algptorat(poly)

:: Substitutes the associated indeterminate for every root

return

polynomial

poly

polynomial

• Defined in the file ‘sp’.
• Substitutes the associated indeterminate `t#n` for every root `#n` in a polynomial.
```[49] algptorat((-2*alg(0)+3)*x^2+(1/7*alg(0)-3/7));
(-2*t#0+3)*x^2+1/7*t#0-3/7
```
Reference

 [ << ] [ < ] [ Up ] [ > ] [ >> ] [Top] [Contents] [Index] [ ? ]

### 9.5.7 `rattoalgp`

rattoalgp(poly,alglist)

:: Substitutes a root for the associated indeterminate with the root.

return

polynomial

poly

polynomial

alglist

list

• Defined in the file ‘sp’.
• The second argument is a list of root’s. Function `rattoalgp()` substitutes a root for the associated indeterminate of the root.
```[51] rattoalgp((-2*algv(0)+3)*x^2+(1/7*algv(0)-3/7),[alg(0)]);
(-2*#0+3)*x^2+(1/7*#0-3/7)
```
Reference

 [ << ] [ < ] [ Up ] [ > ] [ >> ] [Top] [Contents] [Index] [ ? ]

### 9.5.8 `cr_gcda`

cr_gcda(poly1,poly2)

:: GCD of two uni-variate polynomials over an algebraic number field.

return

polynomial

poly1 poly2

polynomial

• Defined in the file ‘sp’.
• Finds the GCD of two uni-variate polynomials.
```[76] X=x^6+3*x^5+6*x^4+x^3-3*x^2+12*x+16\$
[77] Y=x^6+6*x^5+24*x^4+8*x^3-48*x^2+384*x+1024\$
[78] A=newalg(X);
(#0)
[79] cr_gcda(X,subst(Y,x,x+A));
x+(-#0)
```
Reference

 [ << ] [ < ] [ Up ] [ > ] [ >> ] [Top] [Contents] [Index] [ ? ]

### 9.5.9 `sp_norm`

sp_norm(alg,var,poly,alglist)

:: Norm computation over an algebraic number field.

return

polynomial

var

The main variable of poly

poly

univariate polynomial

alg

`root`

alglist

`root` list

• Defined in the file ‘sp’.
• Computes the norm of poly with respect to alg. Namely, if we write K = Q(alglist \ {alg}), The function returns a product of all conjugates of poly, where the conjugate of polynomial poly is a polynomial in which the algebraic number alg is substituted for its conjugate over K.
• The result is a polynomial over K.
• The method of computation depends on the input. Currently direct computation of resultant and Chinese remainder theorem are used but the selection is not necessarily optimal. By setting the global variable `USE_RES` to 1, the builtin function `res()` is always used.
```[0] load("sp")\$
[39] A0=newalg(x^2+1)\$
[40] A1=newalg(x^2+A0)\$
[41] sp_norm(A1,x,x^3+A0*x+A1,[A1,A0]);
x^6+(2*#0)*x^4+(#0^2)*x^2+(#0)
[42] sp_norm(A0,x,@@,[A0]);
x^12+2*x^8+5*x^4+1
```
Reference

 [ << ] [ < ] [ Up ] [ > ] [ >> ] [Top] [Contents] [Index] [ ? ]

### 9.5.10 `asq`, `af`, `af_noalg`

asq(poly)

:: Square-free factorization of polynomial poly over an algebraic number field.

af(poly,alglist)
af_noalg(poly,defpolylist)

:: Factorization of polynomial poly over an algebraic number field.

return

list

poly

polynomial

alglist

`root` list

defpolylist

`root` list of pairs of an indeterminate and a polynomial

• Both defined in the file ‘sp’.
• If the inputs contain no root’s, these functions run fast since they invoke functions over the integers. In contrast to this, if the inputs contain root’s, they sometimes take a long time, since `cr_gcda()` is invoked.
• Function `af()` requires the specification of base field, i.e., list of root’s for its second argument.
• In the second argument `alglist`, root defined last must come first.
• In `af(F,AL)`, `AL` denotes a list of `roots` and it represents an algebraic number field. In `AL=[An,...,A1]` each `Ak` should be defined as a root of a defining polynomial whose coefficients are in `Q(A(k+1),...,An)`.
```[1] A1 = newalg(x^2+1);
[2] A2 = newalg(x^2+A1);
[3] A3 = newalg(x^2+A2*x+A1);
[4] af(x^2+A2*x+A1,[A2,A1]);
[[x^2+(#1)*x+(#0),1]]
```

To call `sp_noalg`, one should replace each algebraic number ai in poly with an indeterminate vi. `defpolylist` is a list [[vn,dn(vn,...,v1)],...,[v1,d(v1)]]. In this expression di(vi,...,v1) is a defining polynomial of ai represented as a multivariate polynomial.

```[1] af_noalg(x^2+a2*x+a1,[[a2,a2^2+a1],[a1,a1^2+1]]);
[[x^2+a2*x+a1,1]]
```
• The result is a list, as a result of usual factorization, whose elements is of the form [factor, multiplicity]. In the result of `af_noalg`, algebraic numbers in factor< are replaced by the indeterminates according to defpolylist.
• The product of all factors with multiplicities counted may differ from the input polynomial by a constant.
```[98] A = newalg(t^2-2);
(#0)
[99] asq(-x^4+6*x^3+(2*alg(0)-9)*x^2+(-6*alg(0))*x-2);
[[-x^2+3*x+(#0),2]]
[100] af(-x^2+3*x+alg(0),[alg(0)]);
[[x+(#0-1),1],[-x+(#0+2),1]]
[101] af_noalg(-x^2+3*x+a,[[a,x^2-2]]);
[[x+a-1,1],[-x+a+2,1]]
```
Reference

 [ << ] [ < ] [ Up ] [ > ] [ >> ] [Top] [Contents] [Index] [ ? ]

### 9.5.11 `sp`, `sp_noalg`

sp(poly)
sp_noalg(poly)

:: Finds the splitting field of polynomial poly and splits.

return

list

poly

polynomial

• Defined in the file ‘sp’.
• Finds the splitting field of poly, an uni-variate polynomial over with rational coefficients, and splits it into its linear factors over the field.
• The result consists of a two element list: The first element is the list of all linear factors of poly; the second element is a list which represents the successive extension of the field. In the result of `sp_noalg` all the algebraic numbers are replaced by the special indeterminate associated with it, that is `t#i` for `#i`. By this operation the result of `sp_noalg` is a list containing only integral polynomials.
• The splitting field is represented as a list of pairs of form `[root,` `algptorat(defpoly(root))]`. In more detail, the list is interpreted as a representation of successive extension obtained by adjoining root’s to the rational number field. Adjoining is performed from the right root to the left.
• `sp()` invokes `sp_norm()` internally. Computation of norm is done by several methods according to the situation but the algorithm selection is not always optimal and a simple resultant computation is often superior to the other methods. By setting the global variable `USE_RES` to 1, the builtin function `res()` is always used.
```[101] L=sp(x^9-54);
[[x+(-#2),-54*x+(#1^6*#2^4),54*x+(#1^6*#2^4+54*#2),
54*x+(-#1^8*#2^2),-54*x+(#1^5*#2^5),54*x+(#1^5*#2^5+#1^8*#2^2),
-54*x+(-#1^7*#2^3-54*#1),54*x+(-#1^7*#2^3),x+(-#1)],
[[(#2),t#2^6+t#1^3*t#2^3+t#1^6],[(#1),t#1^9-54]]]
[102] for(I=0,M=1;I<9;I++)M*=L[0][I];
[111] M=simpalg(M);
-1338925209984*x^9+72301961339136
[112] ptozp(M);
-x^9+54
```
Reference

 [ << ] [ < ] [ Up ] [ > ] [ >> ] [Top] [Contents] [Index] [ ? ]

### 9.5.12 `set_field`

set_field(rootlist)

:: Set an algebraic number field as the currernt ground field.

return

0

rootlist

A list of `root`

• `set_field()` sets an algebraic number field generated by `root` in rootlist over Q.
• You don’t care about the order of `root` in rootlist, because `root` are automatically ordered internally.
```[0] A=newalg(x^2+1);
(#0)
[1] B=newalg(x^3+A);
(#1)
[2] C=newalg(x^4+B);
(#1)
[3] set_field([C,B,A]);
0
```
Reference

 [ << ] [ < ] [ Up ] [ > ] [ >> ] [Top] [Contents] [Index] [ ? ]

### 9.5.13 `algtodalg`, `dalgtoalg`, `dptodalg`, `dalgtodp`

algtodalg(alg)

:: Converts an algebraic number alg to a `DAlg`.

dalgtoalg(dalg)

:: Converts a `DAlg` `dalg` to an algebraic number.

dptodalg(dp)

:: Converts an algebraic number alg to a `DAlg`.

dalgtodp(dalg)

:: Converts a `DAlg` `dalg` to an algebraic number.

return

An algebraic number, a `DAlg` or a list [distributed polynomial,denominator]

alg

an algebraic number containing `root`

dp

a distributed polynomial over Q

• These functions are converters between `DAlg` and an algebraic number containing `root`, or a distributed polynomial.
• A ground field to which a `DAlg` belongs must be set by `set_field()` in advance.
• `dalgtodp()` returns a list containing the numerator (a distributed polynomial) and the denominator (an integer).
• `algtodalg()`, `dptodalg()` return the simplified result.
```[0] A=newalg(x^2+1);
(#0)
[1] B=newalg(x^3+A*x+A);
(#1)
[2] set_field([B,A]);
0
[3] C=algtodalg((A+B)^10);
((408)*<<2,1>>+(103)*<<2,0>>+(-36)*<<1,1>>+(-446)*<<1,0>>
+(-332)*<<0,1>>+(-218)*<<0,0>>)
[4] dalgtoalg(C);
((408*#0+103)*#1^2+(-36*#0-446)*#1-332*#0-218)
[5] D=dptodalg(<<10,10>>/10+2*<<5,5>>+1/3*<<0,0>>);
((-9)*<<2,1>>+(57)*<<2,0>>+(-63)*<<1,1>>+(-12)*<<1,0>>
+(-60)*<<0,1>>+(1)*<<0,0>>)/30
[6] dalgtodp(D);
[(-9)*<<2,1>>+(57)*<<2,0>>+(-63)*<<1,1>>+(-12)*<<1,0>>
+(-60)*<<0,1>>+(1)*<<0,0>>,30]
```
Reference

 [ << ] [ < ] [ Up ] [ > ] [ >> ]

This document was generated on December 14, 2019 using texi2html 5.0.