6.11.2.10 Polynomial_rational_dense Objects

class Polynomial_rational_dense
A dense polynomial over the rational numbers.
Polynomial_rational_dense( parent, [x=False], [check=False], [is_gen=True], [construct=None])

Instances of class Polynomial_rational_dense have the following methods (in addition to inherited methods and special methods):

complex_roots,$  $ copy,$  $ degree,$  $ discriminant,$  $ factor_mod,$  $ factor_padic,$  $ hensel_lift,$  $ is_irreducible,$  $ list,$  $ quo_rem,$  $ rescale,$  $ resultant

Further documentation:

complex_roots( [flag=0])

Returns the complex roots of this polynomial.

INPUT:
    flag -- optional, and can be
            0: (default), uses Schonhage's method modified by Gourdon,
            1: uses a modified Newton method.
OUTPUT:
    list of complex roots of this polynomial, counted with multiplicities.

NOTE: Calls the pari function polroots.

We compute the roots of the characteristic polynomial of some Salem numbers:

sage: R = PolynomialRing(QQ); x = R.gen()
sage: f = 1 - x**2 - x**3 - x**4 + x**6
sage: f.complex_roots()[0]
0.71363917353690087

degree( )

Return the degree of this polynomial. The zero polynomial has degree -1.

discriminant( )

sage: x = PolynomialRing(QQ).gen()        
sage: f = x**3 + 3*x - 17
sage: f.discriminant()
-7911

factor_mod( p)

Return the factorization of self modulo the prime p.

INPUT:
    p -- prime

OUTPUT:
    factorization of self reduced modulo p.

factor_padic( p, [prec=10])

Return p-adic factorization of self to given precision.

INPUT:
    p -- prime
    prec -- integer; the precision

OUTPUT:
    factorization of self reduced modulo p.

hensel_lift( p, e)

Assuming that self factors modulo $ p$ into distinct factors, computes the Hensel lifts of these factors modulo $ p^e$ . We assume that $ p$ has integer coefficients.

list( )

sage: x = PolynomialRing(QQ).gen()
sage: f = x**3 + 3*x - QQ('17/13')
sage: f.list()
[-17/13, 3, 0, 1]

quo_rem( right)

Returns a tuple (quotient, remainder) where self = quotient*other + remainder.

rescale( a)

Return f(a*X).

resultant( other)

Returns the resultant of self and other, which must lie in the same polynomial ring.

INPUT:
    other -- a polynomial
OUTPUT:
    an element of the base ring of the polynomial ring

NOTES: Implemented using pari's polresultant function.

sage: x = PolynomialRing(RationalField()).gen()
sage: f = x**3 + x + 1;  g = x**3 - x - 1
sage: f.resultant(g)
-8

Instances of class Polynomial_rational_dense also have the following special methods:

__getitem__,$  $ __getslice__,$  $ __pow__,$  $ __reduce__,$  $ __repr__,$  $ __setitem__,$  $ _add,$  $ _mul,$  $ _sub

Further documentation:

_mul( right)

sage: x = PolynomialRing(QQ).gen()
sage: (x - QQ('2/3'))*(x**2 - 8*x + 16)
x^3 - 26/3*x^2 + 64/3*x - 32/3

See About this document... for information on suggesting changes.