parent, [x=False], [check=False], [is_gen=True], [construct=None]) |
complex_roots,
copy,
degree,
discriminant,
factor_mod,
factor_padic,
gcd,
lcm,
list,
ntl_ZZX,
quo_rem,
resultant,
set_directly,
xgcd
Further documentation:
[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(ZZ); x = R.gen() sage: f = 1 - x**2 - x**3 - x**4 + x**6 sage: f.complex_roots()[0] # todo: known bug in PARI 2.2.10 !! 0.71363917353690087
) |
Return the degree of this polynomial. The zero polynomial has degree -1.
) |
sage: x = PolynomialRing(ZZ).gen() sage: f = x**3 + 3*x - 17 sage: f.discriminant() -7911
p) |
Return the factorization of self modulo the prime p.
INPUT: p -- prime OUTPUT: factorization of self reduced modulo p.
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.
right) |
Return the GCD of self and other. The leading coefficient need not be 1.
right) |
Return the LCM of self and other, as a monic polynomial.
) |
sage: x = PolynomialRing(ZZ).gen() sage: f = x**3 + 3*x - 17 sage: f.list() [-17, 3, 0, 1]
) |
Return underlying NTL representation of this polynomial. Additional ``bonus'' functionality may be available through this function.
right) |
Returns a tuple (quotient, remainder) where self = quotient*other + remainder.
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 NTL's polresultant function.
sage: x = PolynomialRing(ZZ).gen() sage: f = x**3 + x + 1; g = x**3 - x - 1 sage: f.resultant(g) -8
v) |
Set the value of this polynomial directly from a vector or string.
Polynomials over the integers are stored internally using NTL's ZZX class. Use this function to set the value of this polynomial using the NTL constructor, which is potentially quicker. The input v is either a vector of ints or a string of the form '[ n1 n2 n3 ... ]' where the ni are integers and there are no commas between them. The optimal input format is the string format, since that's what NTL uses.
sage: R = PolynomialRing(ZZ) sage: R([1,2,3]) 3*x^2 + 2*x + 1 sage: f = R(0) sage: f.set_directly([1,2,3]) sage: f 3*x^2 + 2*x + 1 sage: f.set_directly('[1 2 3 4]') sage: f 4*x^3 + 3*x^2 + 2*x + 1
right) |
Returns r,s,t such that r = s*self + t*other.
Instances of class Polynomial_integer_dense also have the following special methods:
__getitem__,
__getslice__,
__pow__,
__reduce__,
__setitem__,
_add,
_mul,
_pari_,
_sub
Further documentation:
right) |
sage: x = PolynomialRing(ZZ).gen() sage: (x - 2)*(x**2 - 8*x + 16) x^3 - 10*x^2 + 32*x - 32
See About this document... for information on suggesting changes.