6.13.1 rings.multi_polynomial_ring - Multivariate Polynomials

AUTHORS: David Joyner and William Stein

The module rings.multi_polynomial_ring defines the following methods:

MPolynomialRing( base_ring, [n=dict], [names=None], [repr=1])

Create a Multivariate polynomial ring over a commutative base ring.

INPUT:
    base_ring -- CommutativeRing

n - int, number of variables (default: 1)

names - list or str; list of n variable names or a string; if a string, names the variables var_0, var_1, etc. (default: None) repr - str; choice of underlying representation of polynomials. (default: 'dict') The choices are 'dict' - Use a Python dictionary-based representation (much faster) 'list' - Use a Python list-based representation

sage: R = MPolynomialRing(RationalField(), 3)
sage: R
Polynomial ring in x_0, x_1, x_2 over Rational Field
sage: x_0,x_1,x2 = R.gens()
sage: x_0.element()
PolyDict with representation {(1, 0, 0): 1}
sage: x_0 + x_1 + x2
x_2 + x_1 + x_0
sage: (x_0 + x_1 + x2)**2
x_2^2 + 2*x_1*x_2 + x_1^2 + 2*x_0*x_2 + 2*x_0*x_1 + x_0^2

Next we specify all the variables and do some additional examples of arithmetic.

sage: R = MPolynomialRing(RationalField(), 3, repr='list', names=['a','b','c'])
sage: R
Polynomial ring in a, b, c over Rational Field
sage: a,b,c = R.gens()
sage: a.element()
PolyList with distributive representation [[1, [1, 0, 0]]]
sage: (a+b)**2
2*a*b + a^2 + b^2
sage: (a + 2*b + 3*c**2)**3
27*a*c^4 + 8*b^3 + 27*c^6 + 9*a^2*c^2 + 36*a*b*c^2 + a^3 + 54*b*c^4 +
6*a^2*b + 12*a*b^2 + 36*b^2*c^2

We can construct multi-variate polynomials rings over completely arbitrary SAGE rings. In this example, we construct a polynomial ring S in 3 variables over a polynomial ring in 2 variables over GF(9). Then we construct a polynomial ring in 20 variables over S!

sage: R = MPolynomialRing(GF(9),2, names=['n1','n2']); n1,n2=R.gens()
sage: n1**2 + 2*n2
2*n2 + n1^2
sage: S = MPolynomialRing(R,3, names='a'); a0,a1,a2=S.gens()
sage: S
Polynomial ring in a_0, a_1, a_2 over Polynomial ring in n1, n2 over Finite
field in x of size 3^2
sage: x = (n1+n2)*a0 + 2*a1**2
sage: x
2*a_1^2 + (n2 + n1)*a_0
sage: x**3
2*a_1^6 + (n2^3 + n1^3)*a_0^3
sage: T = MPolynomialRing(S, 20)
sage: T
Polynomial ring in x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8, x_9, x_10,
x_11, x_12, x_13, x_14, x_15, x_16, x_17, x_18, x_19 over Polynomial ring
in a_0, a_1, a_2 over Polynomial ring in n1, n2 over Finite field in x of
size 3^2

The module rings.multi_polynomial_ring defines the following classes:

class MPolynomialRing_generic

class MPolynomialRing_polydict

class MPolynomialRing_polydict_domain

class MPolynomialRing_polylist

class MPolynomialRing_polylist_domain



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