AUTHORS:
TESTS:
sage: R = PolynomialRing(GF(2**8,'a'),10,'x', order='invlex')
sage: R == loads(dumps(R))
True
sage: P.<a,b> = PolynomialRing(GF(7), 2)
sage: f = (a^3 + 2*b^2*a)^7; f
a^21 + 2*a^7*b^14
Implements methods to convert polynomial rings to Singular.
This class is a base class for all univariate and multivariate polynomial rings which support conversion from and to Singular rings.
Returns a singular ring for this polynomial ring.
Currently ,
,
,
,
and
are supported.
INPUT:
OUTPUT: Singular ring matching this ring
EXAMPLES:
sage: R.<x,y> = PolynomialRing(CC,'x',2)
sage: singular(R)
// characteristic : 0 (complex:15 digits, additional 0 digits)
// 1 parameter : I
// minpoly : (I^2+1)
// number of vars : 2
// block 1 : ordering dp
// : names x y
// block 2 : ordering C
sage: R.<x,y> = PolynomialRing(RealField(100),'x',2)
sage: singular(R)
// characteristic : 0 (real:29 digits, additional 0 digits)
// number of vars : 2
// block 1 : ordering dp
// : names x y
// block 2 : ordering C
sage: w = var('w')
sage: R.<x> = PolynomialRing(NumberField(w^2+1,'s'))
sage: singular(R)
// characteristic : 0
// 1 parameter : s
// minpoly : (s^2+1)
// number of vars : 1
// block 1 : ordering lp
// : names x
// block 2 : ordering C
sage: R = PolynomialRing(GF(127),1,'x')
sage: singular(R)
// characteristic : 127
// number of vars : 1
// block 1 : ordering lp
// : names x
// block 2 : ordering C
sage: R = PolynomialRing(QQ,1,'x')
sage: singular(R)
// characteristic : 0
// number of vars : 1
// block 1 : ordering lp
// : names x
// block 2 : ordering C
sage: R = PolynomialRing(QQ,'x')
sage: singular(R)
// characteristic : 0
// number of vars : 1
// block 1 : ordering lp
// : names x
// block 2 : ordering C
sage: R = PolynomialRing(GF(127),'x')
sage: singular(R)
// characteristic : 127
// number of vars : 1
// block 1 : ordering lp
// : names x
// block 2 : ordering C
sage: R = Frac(ZZ['a,b'])['x,y']
sage: singular(R)
// characteristic : 0
// 2 parameter : a b
// minpoly : 0
// number of vars : 2
// block 1 : ordering dp
// : names x y
// block 2 : ordering C
sage: R = IntegerModRing(1024)['x,y']
sage: singular(R)
// coeff. ring is : Z/2^10
// number of vars : 2
// block 1 : ordering dp
// : names x y
// block 2 : ordering C
sage: R = IntegerModRing(15)['x,y']
sage: singular(R)
// coeff. ring is : Z/15
// number of vars : 2
// block 1 : ordering dp
// : names x y
// block 2 : ordering C
sage: R = ZZ['x,y']
sage: singular(R)
// coeff. ring is : Integers
// number of vars : 2
// block 1 : ordering dp
// : names x y
// block 2 : ordering C
Warning
Implements coercion of polynomials to Singular polynomials.
This class is a base class for all (univariate and multivariate) polynomial classes which support conversion from and to Singular polynomials.
Due to the incompatibility of Python extension classes and multiple inheritance, this just defers to module-level functions.
Return Singular polynomial matching this polynomial.
INPUT:
EXAMPLES:
sage: P.<a,b> = PolynomialRing(GF(7), 2)
sage: f = (a^3 + 2*b^2*a)^7; f
a^21 + 2*a^7*b^14
sage: h = f._singular_(); h
a^21+2*a^7*b^14
sage: P(h)
a^21 + 2*a^7*b^14
sage: P(h^20) == f^20
True
sage: R.<x> = PolynomialRing(GF(7))
sage: f = (x^3 + 2*x^2*x)^7
sage: f
3*x^21
sage: h = f._singular_(); h
3*x^21
sage: R(h)
3*x^21
sage: R(h^20) == f^20
True
Return corresponding Singular polynomial but enforce that a new instance is created in the Singular interpreter.
Use self._singular_() instead.
Returns True if this ring’s base field or ring can be represented in Singular, and the polynomial ring has at least one generator. If this is True then this polynomial ring can be represented in Singular.
The following base rings are supported: finite fields, rationals, number fields, and real and complex fields.
EXAMPLES:
sage: from sage.rings.polynomial.polynomial_singular_interface import can_convert_to_singular
sage: can_convert_to_singular(PolynomialRing(QQ, names=['x']))
True
sage: can_convert_to_singular(PolynomialRing(QQ, names=[]))
False
Returns the least common multiple of this element and the right element.
INPUT:
OUTPUT: multivariate polynomial representing the least common multiple of self and right
ALGORITHM: Singular
EXAMPLES:
sage: r.<x,y> = PolynomialRing(GF(2**8,'a'),2)
sage: a = r.base_ring().0
sage: f = (a^2+a)*x^2*y + (a^4+a^3+a)*y + a^5
sage: f.lcm(x^4)
(a^2 + a)*x^6*y + (a^4 + a^3 + a)*x^4*y + (a^5)*x^4
sage: w = var('w')
sage: r.<x,y> = PolynomialRing(NumberField(w^4+1,'a'),2)
sage: a = r.base_ring().0
sage: f = (a^2+a)*x^2*y + (a^4+a^3+a)*y + a^5
sage: f.lcm(x^4)
(a^2 + a)*x^6*y + (a^3 + a - 1)*x^4*y + (-a)*x^4
TESTS:
sage: R.<X>=QQ[]
sage: a=R(1)
sage: b=X
sage: lcm(b,a)
X
sage: lcm(a,b)
X
computes the resultant of self and the first argument with respect to the variable given as the second argument.
If a second argument is not provide the first variable of self.parent() is chosen.
INPUT:
EXAMPLES:
sage: P.<x,y> = PolynomialRing(QQ,2)
sage: a = x+y
sage: b = x^3-y^3
sage: c = a.resultant(b); c
-2*y^3
sage: d = a.resultant(b,y); d
2*x^3
TESTS:
sage: from sage.rings.polynomial.multi_polynomial_ring import MPolynomialRing_polydict_domain
sage: P.<x,y> = MPolynomialRing_polydict_domain(QQ,2,order='degrevlex')
sage: a = x+y
sage: b = x^3-y^3
sage: c = a.resultant(b); c
-2*y^3
sage: d = a.resultant(b,y); d
2*x^3