4.6.1.1 PolynomialRing Objects

class PolynomialRing
Univariate polynomial ring.
PolynomialRing( base_ring, [variable=False], [sparse=x])

sage: import rings
sage: Q = rings.RationalField()
sage: R = PolynomialRing(Q)
sage: x = R.gen()
sage: R(-1) + R(1)
0
sage: (x - '2/3')*(x**2 - 8*x + 16)
x^3 - 26/3*x^2 + 64/3*x - 32/3

Instances of class PolynomialRing have the following functions (in addition to inherited functions and special functions):

base_ring,$  $ characteristic,$  $ cyclotomic_polynomial,$  $ gen,$  $ is_field,$  $ is_sparse,$  $ name,$  $ ngens,$  $ polynomial,$  $ quotient,$  $ random,$  $ set_variable,$  $ variable

Further documentation:

cyclotomic_polynomial( n)

The nth cyclotomic polynomial.

sage: R = PolynomialRing(QQ)
sage: R.cyclotomic_polynomial(8)
x^4 + 1
sage: R.cyclotomic_polynomial(12)
x^4 - x^2 + 1
sage: S = PolynomialRing(GF(7))
sage: S.cyclotomic_polynomial(12)
x^4 + 6*x^2 + 1

gen( [n=0])

If this is R[x], return x.

random( degree, [bound=10])

Return a random polynomial.

INPUT:
    degree -- an int
    bound -- an int

OUTPUT:
    Polynomial -- A polynomial whose coefficients of x^i, for
    i up to degree, are coercisions to the base ring of random
    integers between -bound and bound.

variable( )

Returns the string which is used to print the generator of the polynomial ring.

OUTPUT: str - generator name

Instances of class PolynomialRing also have the following special functions:

__call__,$  $ __cmp__,$  $ __contains__

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