Polynomial and power series functions.

We group here all functions which are specific to polynomials or power series, including functions related to number fields. Many other functions which can be applied on these objects are described in the other sections. Also, some of the functions described here can be applied to other types.

apprpadic(x, a): vector of p-adic roots of the polynomial x congruent to the p-adic number a modulo p (or modulo 4 if p = 2), and with the same p-adic precision as a. The number a can be an ordinary p-adic number (type 7, i.e. an element of $\Bbb$Qp) or can be an element of a finite extension of $\Bbb$Qp, in which case it is of type 9 (polymod), where at least one of the coefficients of the polymod is a p-adic number. In this case, the result is the vector of roots belonging to the same extension of $\Bbb$Qp as a.

The library syntax is $\teb$apprgen9(x, a), but if a is known to be simply a p-adic number (type 7), the syntax $\teb$apprgen(x, a) can be used.

base(x): [*] of the number field defined by the monic irreducible polynomial x, using the round 2 algorithm.

The library syntax is $\teb$base(x,&d ), where d will receive the discriminant of the number field (not of the polynomial x). This program is the translation in C of a program written by David Ford.

convol(x, y): convolution (or [*]) of the two power series x and y; in other words if x = $\sum$ak*Xk and y = $\sum$bk*Xk then convol(x, y) = $\sum$ak*bk*Xk.

The library syntax is $\teb$convol(x, y).

deriv(x, y): derivative of x with respect to the simple variable y. x can be any type except polymod. The derivative of a scalar type is zero, and the derivative of a vector or matrix is done componentwise.

The library syntax is $\teb$deriv(x, v), where v is the number of the variable y.

disc(x): discriminant of x. x must be a polynomial. The algorithm used is the [*].

The library syntax is $\teb$discsr(x).

discf(x): [*] of the number field defined by the monic irreducible polynomial x.

The library syntax is $\teb$discf(x). See also base, 3.6.1 above.

eval(x): replace in x the formal variables by the values that have been assigned to them after the creation of x. This is mainly useful in GP, and not in library mode. Do not confuse this with substitution (see subst, 3.6.32 below).

The library syntax is $\teb$geval(x).

factoredbase(x, p): [*] of the number field defined by the monic irreducible polynomial x, using the round 2 algorithm, where p is the two column matrix of the factorization of the discriminant of the polynomial x.

The library syntax is $\teb$factoredbase(x, p,&d ), where d will receive the discriminant of the number field.

factoreddiscf(x, p): [*] of the number field defined by the monic irreducible polynomial x, using the round 2 algorithm, where p is the two column matrix of the factorization of the discriminant of the polynomial x.

The library syntax is $\teb$factoreddiscf(x, p).

factoredpolred(x, p): same as polred (see 3.6.18 below) except that p is the two column matrix of the factorization of the discriminant of the polynomial x.

The library syntax is $\teb$factoredpolred(x, p, prec).

factorpadic(x, p, r): p-adic factorization of the polynomial x to precision r, the result being a two column matrix as in factor. In the present version 1.35, only separable factors are given, hence the sum of the degrees of the factors may not add up to the degree of x. In any case, r must be stricly larger than some value which is at most equal to the p-adic valuation of the discriminant of x for the result to make any sense.

The library syntax is $\teb$factorpadic(x, p, r), where r is a C-integer.

factpol(x, l ): x must be a polynomial with coefficients in $\Bbb$Z. If l = 0, find the complete factorization of x, and if l > 0, search only for irreducible factors of degree less than or equal to l. The result is a two column matrix, the first one containing the irreducible factors, the second one the exponents.

The library syntax is $\teb$factpol(x, l ). The algorithm used is the standard Hensel lifting of a mod p factorization. Another implementation using instead root finding over $\Bbb$C (instead of implicitly using $\Bbb$Qp) is $\teb$factpol2(x, l ).

integ(x, y): [*] of x with respect to the simple variable y. No logarithmic terms must occur in the result. x can be of any type, but the case where x is a rational function is not implemented in the present version (1.35).

The library syntax is $\teb$integ(x).

laplace(x): x must be a power series with only nonnegative exponents. If x = $\sum$(ak/k!)*Xk then the result is $\sum$ak*Xk.

The library syntax is $\teb$laplace(x).

legendre(x): creates the xth [*].

The library syntax is $\teb$legendre(x), where x is a 32-bit C-integer.

newtonpoly(x, p): gives the vector of the slopes of the Newton polygon of the polynomial x with respect to the prime number p. The n components of the vector are in decreasing order, and n is equal to the degree of x.

The library syntax is $\teb$newtonpoly(x, p).

ordred(x): finds polynomials with reasonably small coefficients and of the same degree as that of x defining suborders of the order defined by x. One of the polynomials always defines $\Bbb$Q (hence is equal to (x - 1)n, where n is the degree), and another always defines the same order as x if x is irreducible.

The library syntax is $\teb$ordred(x).

polint(xa, ya, x): given the data vectors xa and ya of the same length n (xa containing the x-coordinates, and ya the corresponding y-coordinates), this function finds the [*] passing through these points and evaluates it at the value x.

The library syntax is $\teb$polint(xa, ya, x,&er), where er will contain an error estimate on the returned value.

polred(x): finds polynomials with reasonably small coefficients defining subfields of the number field defined by x. One of the polynomials always defines $\Bbb$Q (hence is equal to (x - 1), where n is the degree), and another always defines the same number field as x if x is irreducible.

The library syntax is $\teb$polred(x, prec).

polredreal(x): similar to polred but only valid for totally real polynomials x, i.e. polynomials having only real roots. In that case it is often faster than polred.

The library syntax is $\teb$polredreal(x, prec).

polsym(x, n): creates the vector of the [*] of the roots of the polynomial x up to power n.

The library syntax is $\teb$polsym(x).

recip(x): reciprocal polynomial of x, i.e. the coefficients are in reverse order. x must be a polynomial.

The library syntax is $\teb$polrecip(x).

resultant(x, y): resultant of the two polynomials x and y. The algorithm used is the subresultant algorithm.

The library syntax is $\teb$subres(x, y).

reverse(x): reverse power series (i.e. x-1, not 1/x ) of x. x must be a power series whose valuation is exactly equal to one.

The library syntax is $\teb$recip(x).

rootmod(x, p): roots modulo p of the polynomial x. Slightly slower than rootmod2 below for p < 100, but much faster for larger values. The particular nonprime value p = 4 is accepted, mainly for 2-adic computations. Multiple roots are not repeated.

The library syntax is $\teb$rootmod(x, p).

rootmod2(x, p): roots modulo p of the polynomial x. To be used only when p is small. Multiple roots are repeated with their order of multiplicity.

The library syntax is $\teb$rootmod2(x, p).

rootpadic(x, p, r): vector of p-adic roots of the polynomial x with p-adic precision equal to r. Multiple roots are not repeated.

The library syntax is $\teb$rootpadic(x, p, r), where r is a C-integer.

roots(x): complex roots of the polynomial x, given as a column vector where each root is repeated according to its multiplicity. The precision is given as for transcendental functions: under GP it is kept in the variable prec and is transparent to the user, but it must be explicitly given as a second argument in library mode.

The algorithm used is a variant of the Newton-Raphson method and is not guaranteed to converge, but is rather fast. If you get the messages ``too many iterations in roots'' or ``INTERNAL ERROR: incorrect result in roots'', try modifying your polynomial to get the roots.

The library syntax is $\teb$roots(x, prec).

smallbase(x): [*] of the number field defined by the monic irreducible polynomial x, using the round 2 algorithm, where one does not take into account squares of primes which are not precomputed.

The library syntax is $\teb$smallbase(x,&y), where y will receive the discriminant of the number field (not of the polynomial x). This program is the translation in C of a program written by David Ford.

smalldiscf(x): [*] of the number field defined by the monic irreducible polynomial x, where one does not take into account squares of primes which are not precomputed.

The library syntax is $\teb$smalldiscf(x). See also smallbase, 3.6.27 above.

smallpolred(x): same as polred (see 3.6.18 above) except that only a suborder of the maximal order may be used.

The library syntax is $\teb$smallpolred(x, prec).

sturm(x): number of real roots of the real polynomial x, using Sturm's algorithm.

The library syntax is $\teb$sturm(x). The result is a 32-bit C-integer.

sturmpart(x, a, b): number of real roots of the real polynomial x in the interval (a, b], using Sturm's algorithm.

The library syntax is $\teb$sturmpart(x). The result is a 32-bit C-integer.

subst (x, y, z): replace the simple variable y by the argument z in expression x. Every non-scalar type is allowed for x. If x is a power series, z must be either a polynomial, a power series, or a rational function. y must be a simple variable name.

The library syntax is $\teb$gsubst(x, v, z), where v is the number of the variable y.

taylor(x, y): taylor expansion around 0 of x with respect to the simple variable y. x can be of any reasonable type, for example a rational function. The number of terms of the expansion is transparent to the user under GP, but must be given as a second argument in library mode.

The library syntax is $\teb$tayl(x, y, n), where the 32-bit C-integer n is the desired number of terms in the expansion.

tchebi(x): creates the xth Tchebicheff polynomial.

The library syntax is $\teb$tchebi(x), where x is a 32-bit C-integer.