Module: sage.rings.multi_polynomial_ring
Author Log:
We construct the Frobenius morphism on
F
over
:
sage: R, (x,y,z) = PolynomialRing(GF(5), 3, 'xyz').objgens() sage: frob = R.hom([x^5, y^5, z^5]) sage: frob(x^2 + 2*y - z^4) 4*z^20 + 2*y^5 + x^10 sage: frob((x + 2*y)^3) 3*y^15 + 2*x^5*y^10 + x^10*y^5 + x^15 sage: (x^5 + 2*y^5)^3 3*y^15 + 2*x^5*y^10 + x^10*y^5 + x^15
Module-level Functions
base_ring, [n=False], [names=degrevlex], [order=None], [macaulay2=1]) |
Create a Multivariate polynomial ring over a commutative base ring.
INPUT: base_ring -- CommutativeRing n -- int, number of variables (default: 1) names -- tuple or string: - tuple of n variable names - if string, names the variables the characters in the string. default: names variables x0, x1, etc.
order - string; the term order, or an object of type TermOrder: 'degrevlex' (default) - degree reverse lexicographic 'revlex' - reverse lexicographic 'lex' - lexicographic 'deglex' - degree lexicographic 'wp(w1,...,wn)' - weight reverse lexicographic 'Wp(w1,...,wn)' - weight lexicographic
macaulay2 - boolean (default: False); Use Macaulay2 for internal representations; provides some additional functionality. (Currently only supported when the base ring is ZZ or a prime field.)
sage: R = MPolynomialRing(RationalField(), 3) sage: R Polynomial Ring in x0, x1, x2 over Rational Field sage: x0,x1,x2 = R.gens() sage: x0.element() PolyDict with representation {(1, 0, 0): 1} sage: x0 + x1 + x2 x2 + x1 + x0 sage: (x0 + x1 + x2)**2 x2^2 + 2*x1*x2 + x1^2 + 2*x0*x2 + 2*x0*x1 + x0^2
This example illustrates the quick shorthand for naming several variables one-letter names.
sage: MPolynomialRing(ZZ, 4, 'xyzw') Polynomial Ring in x, y, z, w over Integer Ring
To obtain both the ring and its generators, use the objgens
function.
sage: R, (x,y,z,w) = MPolynomialRing(ZZ, 4, 'xyzw').objgens() sage: (x+y+z+w)^2 w^2 + 2*z*w + z^2 + 2*y*w + 2*y*z + y^2 + 2*x*w + 2*x*z + 2*x*y + x^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, (n1,n2) = MPolynomialRing(GF(9),2, names=['n1','n2']).objgens() 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 a0, a1, a2 over Polynomial Ring in n1, n2 over Finite Field in a of size 3^2 sage: x = (n1+n2)*a0 + 2*a1**2 sage: x 2*a1^2 + (n2 + n1)*a0 sage: x**3 2*a1^6 + (n2^3 + n1^3)*a0^3 sage: T = MPolynomialRing(S, 20) sage: T Polynomial Ring in x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19 over Polynomial Ring in a0, a1, a2 over Polynomial Ring in n1, n2 over Finite Field in a of size 3^2
We create a polynomial ring that uses the Macaualy2 interface.
sage: R, (x,y,z) = MPolynomialRing(ZZ, 3, 'xyz', macaulay2=True).objgens() # optional sage: type(R) # optional <class 'sage.rings.multi_polynomial_ring.MPolynomialRing_macaulay2_repr_dom ain'>
x) |
Class: MPolynomialRing_generic
self, base_ring, n, names, order) |
Functions: assign_names,
base_ring,
characteristic,
gen,
gens,
is_field,
is_finite,
krull_dimension,
latex_variable_names,
ngens,
term_order,
var_dict
self) |
Return the characteristic of this polynomial ring.
sage: R = MPolynomialRing(RationalField(), 3) sage: R.characteristic() 0 sage: R = MPolynomialRing(GF(7),20) sage: R.characteristic() 7
self) |
Return True if this multivariate polynomial ring is a field, i.e., it is a ring in 0 generators over a field.
self) |
Returns the list of variable names suitable for latex output.
All '_SOMETHING' substrings are replaced by '_SOMETHING' recursively so that subscripts of subscripts work.
sage: R, x = PolynomialRing(QQ,12).objgens(); sage: x (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11) sage: print R.latex_variable_names () ['x_{0}', 'x_{1}', 'x_{2}', 'x_{3}', 'x_{4}', 'x_{5}', 'x_{6}', 'x_{7}', 'x_{8}', 'x_{9}', 'x_{10}', 'x_{11}'] sage: f = x[0]^3 + 15/3 * x[1]^10 sage: print latex(f) 5 x_{1}^{10} + x_{0}^{3}
self) |
Return dictionary of paris varname:var of the variables of this multivariate polynomial ring.
Special Functions: __cmp__,
__contains__,
_ideal_class_,
_is_valid_homomorphism_,
_latex_,
_monomial_order_function,
_repr_
self, x) |
This definition of containment does not involve a natural inclusion from rings with less variables into rings with more.
Class: MPolynomialRing_macaulay2_repr
Functions: ideal
Special Functions: __call__,
_macaulay2_,
_poly_class
self, x, [check=True]) |
Coerce x into this multivariate polynomial ring.
We create a Macaulay2 multivariate polynomial via ideal arithmetic, then coerce it into R.
sage: R, (x,y) = PolynomialRing(QQ, 2, ['x','y'], macaulay2=True).objgens() # optional sage: I = R.ideal([x^3 + y, y]) # optional sage: S = I._macaulay2_() # optional sage: T = S*S*S # optional sage: U = T.gens().entries().flatten() # optional sage: f = U[2]; f # optional x^3*y^2+y^3 sage: R(f) # optional y^3 + x^3*y^2
Class: MPolynomialRing_macaulay2_repr_domain
Class: MPolynomialRing_polydict
sage: R = MPolynomialRing(Integers(12),5); R Polynomial Ring in x0, x1, x2, x3, x4 over Ring of integers modulo 12 sage: loads(R.dumps()) == R True
self, base_ring, n, names, order) |
Special Functions: __call__,
_monomial_order_function,
_poly_class
self, x, [check=True]) |
Coerce x into this multivariate polynomial ring.
We create a Singular multivariate polynomial via ideal arithmetic, then coerce it into R.
sage: R, (x,y) = PolynomialRing(QQ, 2, ['x','y']).objgens() sage: I = R.ideal([x^3 + y, y]) sage: S = singular(I) sage: f = (S*S*S)[2] sage: f x^3*y^2+y^3 sage: R(f) y^3 + x^3*y^2
Class: MPolynomialRing_polydict_domain
self, base_ring, n, names, order) |
Functions: ideal
Class: TermOrder
sage: t = TermOrder('lex') sage: t Lexicographic term order sage: loads(dumps(t)) == t True
self, [name=lex]) |
Functions: macaulay2_str,
singular_str
Special Functions: __cmp__,
_repr_