Homogeneous ideals of free algebras#
For twosided ideals and when the base ring is a field, this implementation also provides Groebner bases and ideal containment tests.
EXAMPLES:
sage: F.<x,y,z> = FreeAlgebra(QQ, implementation='letterplace')
sage: F
Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field
sage: I = F*[x*y+y*z,x^2+x*y-y*x-y^2]*F
sage: I
Twosided Ideal (x*y + y*z, x*x + x*y - y*x - y*y) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field
>>> from sage.all import *
>>> F = FreeAlgebra(QQ, implementation='letterplace', names=('x', 'y', 'z',)); (x, y, z,) = F._first_ngens(3)
>>> F
Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field
>>> I = F*[x*y+y*z,x**Integer(2)+x*y-y*x-y**Integer(2)]*F
>>> I
Twosided Ideal (x*y + y*z, x*x + x*y - y*x - y*y) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field
One can compute Groebner bases out to a finite degree, can compute normal forms and can test containment in the ideal:
sage: I.groebner_basis(degbound=3)
Twosided Ideal (x*y + y*z,
x*x - y*x - y*y - y*z,
y*y*y - y*y*z + y*z*y - y*z*z,
y*y*x + y*y*z + y*z*x + y*z*z) of Free Associative Unital Algebra
on 3 generators (x, y, z) over Rational Field
sage: (x*y*z*y*x).normal_form(I)
y*z*z*y*z + y*z*z*z*x + y*z*z*z*z
sage: x*y*z*y*x - (x*y*z*y*x).normal_form(I) in I
True
>>> from sage.all import *
>>> I.groebner_basis(degbound=Integer(3))
Twosided Ideal (x*y + y*z,
x*x - y*x - y*y - y*z,
y*y*y - y*y*z + y*z*y - y*z*z,
y*y*x + y*y*z + y*z*x + y*z*z) of Free Associative Unital Algebra
on 3 generators (x, y, z) over Rational Field
>>> (x*y*z*y*x).normal_form(I)
y*z*z*y*z + y*z*z*z*x + y*z*z*z*z
>>> x*y*z*y*x - (x*y*z*y*x).normal_form(I) in I
True
AUTHOR:
Simon King (2011-03-22): See Issue #7797.
- class sage.algebras.letterplace.letterplace_ideal.LetterplaceIdeal(ring, gens, coerce=True, side='twosided')[source]#
Bases:
Ideal_nc
Graded homogeneous ideals in free algebras.
In the two-sided case over a field, one can compute Groebner bases up to a degree bound, normal forms of graded homogeneous elements of the free algebra, and ideal containment.
EXAMPLES:
sage: F.<x,y,z> = FreeAlgebra(QQ, implementation='letterplace') sage: I = F*[x*y+y*z,x^2+x*y-y*x-y^2]*F sage: I Twosided Ideal (x*y + y*z, x*x + x*y - y*x - y*y) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field sage: I.groebner_basis(2) Twosided Ideal (x*y + y*z, x*x - y*x - y*y - y*z) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field sage: I.groebner_basis(4) Twosided Ideal (x*y + y*z, x*x - y*x - y*y - y*z, y*y*y - y*y*z + y*z*y - y*z*z, y*y*x + y*y*z + y*z*x + y*z*z, y*y*z*y - y*y*z*z + y*z*z*y - y*z*z*z, y*z*y*y - y*z*y*z + y*z*z*y - y*z*z*z, y*y*z*x + y*y*z*z + y*z*z*x + y*z*z*z, y*z*y*x + y*z*y*z + y*z*z*x + y*z*z*z) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field
>>> from sage.all import * >>> F = FreeAlgebra(QQ, implementation='letterplace', names=('x', 'y', 'z',)); (x, y, z,) = F._first_ngens(3) >>> I = F*[x*y+y*z,x**Integer(2)+x*y-y*x-y**Integer(2)]*F >>> I Twosided Ideal (x*y + y*z, x*x + x*y - y*x - y*y) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field >>> I.groebner_basis(Integer(2)) Twosided Ideal (x*y + y*z, x*x - y*x - y*y - y*z) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field >>> I.groebner_basis(Integer(4)) Twosided Ideal (x*y + y*z, x*x - y*x - y*y - y*z, y*y*y - y*y*z + y*z*y - y*z*z, y*y*x + y*y*z + y*z*x + y*z*z, y*y*z*y - y*y*z*z + y*z*z*y - y*z*z*z, y*z*y*y - y*z*y*z + y*z*z*y - y*z*z*z, y*y*z*x + y*y*z*z + y*z*z*x + y*z*z*z, y*z*y*x + y*z*y*z + y*z*z*x + y*z*z*z) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field
Groebner bases are cached. If one has computed a Groebner basis out to a high degree then it will also be returned if a Groebner basis with a lower degree bound is requested:
sage: I.groebner_basis(2) is I.groebner_basis(4) True
>>> from sage.all import * >>> I.groebner_basis(Integer(2)) is I.groebner_basis(Integer(4)) True
Of course, the normal form of any element has to satisfy the following:
sage: x*y*z*y*x - (x*y*z*y*x).normal_form(I) in I True
>>> from sage.all import * >>> x*y*z*y*x - (x*y*z*y*x).normal_form(I) in I True
Left and right ideals can be constructed, but only twosided ideals provide Groebner bases:
sage: JL = F*[x*y+y*z,x^2+x*y-y*x-y^2]; JL Left Ideal (x*y + y*z, x*x + x*y - y*x - y*y) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field sage: JR = [x*y+y*z,x^2+x*y-y*x-y^2]*F; JR Right Ideal (x*y + y*z, x*x + x*y - y*x - y*y) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field sage: JR.groebner_basis(2) Traceback (most recent call last): ... TypeError: This ideal is not two-sided. We can only compute two-sided Groebner bases sage: JL.groebner_basis(2) Traceback (most recent call last): ... TypeError: This ideal is not two-sided. We can only compute two-sided Groebner bases
>>> from sage.all import * >>> JL = F*[x*y+y*z,x**Integer(2)+x*y-y*x-y**Integer(2)]; JL Left Ideal (x*y + y*z, x*x + x*y - y*x - y*y) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field >>> JR = [x*y+y*z,x**Integer(2)+x*y-y*x-y**Integer(2)]*F; JR Right Ideal (x*y + y*z, x*x + x*y - y*x - y*y) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field >>> JR.groebner_basis(Integer(2)) Traceback (most recent call last): ... TypeError: This ideal is not two-sided. We can only compute two-sided Groebner bases >>> JL.groebner_basis(Integer(2)) Traceback (most recent call last): ... TypeError: This ideal is not two-sided. We can only compute two-sided Groebner bases
Also, it is currently not possible to compute a Groebner basis when the base ring is not a field:
sage: FZ.<a,b,c> = FreeAlgebra(ZZ, implementation='letterplace') sage: J = FZ*[a^3-b^3]*FZ sage: J.groebner_basis(2) Traceback (most recent call last): ... TypeError: Currently, we can only compute Groebner bases if the ring of coefficients is a field
>>> from sage.all import * >>> FZ = FreeAlgebra(ZZ, implementation='letterplace', names=('a', 'b', 'c',)); (a, b, c,) = FZ._first_ngens(3) >>> J = FZ*[a**Integer(3)-b**Integer(3)]*FZ >>> J.groebner_basis(Integer(2)) Traceback (most recent call last): ... TypeError: Currently, we can only compute Groebner bases if the ring of coefficients is a field
The letterplace implementation of free algebras also provides integral degree weights for the generators, and we can compute Groebner bases for twosided graded homogeneous ideals:
sage: F.<x,y,z> = FreeAlgebra(QQ, implementation='letterplace',degrees=[1,2,3]) sage: I = F*[x*y+z-y*x,x*y*z-x^6+y^3]*F sage: I.groebner_basis(Infinity) Twosided Ideal (x*y - y*x + z, x*x*x*x*x*x - y*x*z - y*y*y + z*z, x*z*z - y*x*x*z + y*x*z*x + y*y*z + y*z*y + z*x*z + z*y*y - z*z*x, x*x*x*x*x*z + x*x*x*x*z*x + x*x*x*z*x*x + x*x*z*x*x*x + x*z*x*x*x*x + y*x*z*y - y*y*x*z + y*z*z + z*x*x*x*x*x - z*z*y, x*x*x*x*z*y*y + x*x*x*z*y*y*x - x*x*x*z*y*z - x*x*z*y*x*z + x*x*z*y*y*x*x + x*x*z*y*y*y - x*x*z*y*z*x - x*z*y*x*x*z - x*z*y*x*z*x + x*z*y*y*x*x*x + 2*x*z*y*y*y*x - 2*x*z*y*y*z - x*z*y*z*x*x - x*z*y*z*y + y*x*z*x*x*x*x*x - 4*y*x*z*x*x*z - 4*y*x*z*x*z*x + 4*y*x*z*y*x*x*x + 3*y*x*z*y*y*x - 4*y*x*z*y*z + y*y*x*x*x*x*z + y*y*x*x*x*z*x - 3*y*y*x*x*z*x*x - y*y*x*x*z*y + 5*y*y*x*z*x*x*x + 4*y*y*x*z*y*x - 4*y*y*y*x*x*z + 4*y*y*y*x*z*x + 3*y*y*y*y*z + 4*y*y*y*z*x*x + 6*y*y*y*z*y + y*y*z*x*x*x*x + y*y*z*x*z + 7*y*y*z*y*x*x + 7*y*y*z*y*y - 7*y*y*z*z*x - y*z*x*x*x*z - y*z*x*x*z*x + 3*y*z*x*z*x*x + y*z*x*z*y + y*z*y*x*x*x*x - 3*y*z*y*x*z + 7*y*z*y*y*x*x + 3*y*z*y*y*y - 3*y*z*y*z*x - 5*y*z*z*x*x*x - 4*y*z*z*y*x + 4*y*z*z*z - z*y*x*x*x*z - z*y*x*x*z*x - z*y*x*z*x*x - z*y*x*z*y + z*y*y*x*x*x*x - 3*z*y*y*x*z + 3*z*y*y*y*x*x + z*y*y*y*y - 3*z*y*y*z*x - z*y*z*x*x*x - 2*z*y*z*y*x + 2*z*y*z*z - z*z*x*x*x*x*x + 4*z*z*x*x*z + 4*z*z*x*z*x - 4*z*z*y*x*x*x - 3*z*z*y*y*x + 4*z*z*y*z + 4*z*z*z*x*x + 2*z*z*z*y) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field
>>> from sage.all import * >>> F = FreeAlgebra(QQ, implementation='letterplace',degrees=[Integer(1),Integer(2),Integer(3)], names=('x', 'y', 'z',)); (x, y, z,) = F._first_ngens(3) >>> I = F*[x*y+z-y*x,x*y*z-x**Integer(6)+y**Integer(3)]*F >>> I.groebner_basis(Infinity) Twosided Ideal (x*y - y*x + z, x*x*x*x*x*x - y*x*z - y*y*y + z*z, x*z*z - y*x*x*z + y*x*z*x + y*y*z + y*z*y + z*x*z + z*y*y - z*z*x, x*x*x*x*x*z + x*x*x*x*z*x + x*x*x*z*x*x + x*x*z*x*x*x + x*z*x*x*x*x + y*x*z*y - y*y*x*z + y*z*z + z*x*x*x*x*x - z*z*y, x*x*x*x*z*y*y + x*x*x*z*y*y*x - x*x*x*z*y*z - x*x*z*y*x*z + x*x*z*y*y*x*x + x*x*z*y*y*y - x*x*z*y*z*x - x*z*y*x*x*z - x*z*y*x*z*x + x*z*y*y*x*x*x + 2*x*z*y*y*y*x - 2*x*z*y*y*z - x*z*y*z*x*x - x*z*y*z*y + y*x*z*x*x*x*x*x - 4*y*x*z*x*x*z - 4*y*x*z*x*z*x + 4*y*x*z*y*x*x*x + 3*y*x*z*y*y*x - 4*y*x*z*y*z + y*y*x*x*x*x*z + y*y*x*x*x*z*x - 3*y*y*x*x*z*x*x - y*y*x*x*z*y + 5*y*y*x*z*x*x*x + 4*y*y*x*z*y*x - 4*y*y*y*x*x*z + 4*y*y*y*x*z*x + 3*y*y*y*y*z + 4*y*y*y*z*x*x + 6*y*y*y*z*y + y*y*z*x*x*x*x + y*y*z*x*z + 7*y*y*z*y*x*x + 7*y*y*z*y*y - 7*y*y*z*z*x - y*z*x*x*x*z - y*z*x*x*z*x + 3*y*z*x*z*x*x + y*z*x*z*y + y*z*y*x*x*x*x - 3*y*z*y*x*z + 7*y*z*y*y*x*x + 3*y*z*y*y*y - 3*y*z*y*z*x - 5*y*z*z*x*x*x - 4*y*z*z*y*x + 4*y*z*z*z - z*y*x*x*x*z - z*y*x*x*z*x - z*y*x*z*x*x - z*y*x*z*y + z*y*y*x*x*x*x - 3*z*y*y*x*z + 3*z*y*y*y*x*x + z*y*y*y*y - 3*z*y*y*z*x - z*y*z*x*x*x - 2*z*y*z*y*x + 2*z*y*z*z - z*z*x*x*x*x*x + 4*z*z*x*x*z + 4*z*z*x*z*x - 4*z*z*y*x*x*x - 3*z*z*y*y*x + 4*z*z*y*z + 4*z*z*z*x*x + 2*z*z*z*y) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field
Again, we can compute normal forms:
sage: (z*I.0-I.1).normal_form(I) 0 sage: (z*I.0-x*y*z).normal_form(I) -y*x*z + z*z
>>> from sage.all import * >>> (z*I.gen(0)-I.gen(1)).normal_form(I) 0 >>> (z*I.gen(0)-x*y*z).normal_form(I) -y*x*z + z*z
- groebner_basis(degbound=None)[source]#
Twosided Groebner basis with degree bound.
INPUT:
degbound
(optional integer, or Infinity): If it is provided, a Groebner basis at least out to that degree is returned. By default, the current degree bound of the underlying ring is used.
ASSUMPTIONS:
Currently, we can only compute Groebner bases for twosided ideals, and the ring of coefficients must be a field. A \(TypeError\) is raised if one of these conditions is violated.
Note
The result is cached. The same Groebner basis is returned if a smaller degree bound than the known one is requested.
If the degree bound
Infinity
is requested, it is attempted to compute a complete Groebner basis. But we cannot guarantee that the computation will terminate, since not all twosided homogeneous ideals of a free algebra have a finite Groebner basis.
EXAMPLES:
sage: F.<x,y,z> = FreeAlgebra(QQ, implementation='letterplace') sage: I = F*[x*y+y*z,x^2+x*y-y*x-y^2]*F
>>> from sage.all import * >>> F = FreeAlgebra(QQ, implementation='letterplace', names=('x', 'y', 'z',)); (x, y, z,) = F._first_ngens(3) >>> I = F*[x*y+y*z,x**Integer(2)+x*y-y*x-y**Integer(2)]*F
Since \(F\) was cached and since its degree bound cannot be decreased, it may happen that, as a side effect of other tests, it already has a degree bound bigger than 3. So, we cannot test against the output of
I.groebner_basis()
:sage: F.set_degbound(3) sage: I.groebner_basis() # not tested Twosided Ideal (y*y*y - y*y*z + y*z*y - y*z*z, y*y*x + y*y*z + y*z*x + y*z*z, x*y + y*z, x*x - y*x - y*y - y*z) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field sage: I.groebner_basis(4) Twosided Ideal (x*y + y*z, x*x - y*x - y*y - y*z, y*y*y - y*y*z + y*z*y - y*z*z, y*y*x + y*y*z + y*z*x + y*z*z, y*y*z*y - y*y*z*z + y*z*z*y - y*z*z*z, y*z*y*y - y*z*y*z + y*z*z*y - y*z*z*z, y*y*z*x + y*y*z*z + y*z*z*x + y*z*z*z, y*z*y*x + y*z*y*z + y*z*z*x + y*z*z*z) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field sage: I.groebner_basis(2) is I.groebner_basis(4) True sage: G = I.groebner_basis(4) sage: G.groebner_basis(3) is G True
>>> from sage.all import * >>> F.set_degbound(Integer(3)) >>> I.groebner_basis() # not tested Twosided Ideal (y*y*y - y*y*z + y*z*y - y*z*z, y*y*x + y*y*z + y*z*x + y*z*z, x*y + y*z, x*x - y*x - y*y - y*z) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field >>> I.groebner_basis(Integer(4)) Twosided Ideal (x*y + y*z, x*x - y*x - y*y - y*z, y*y*y - y*y*z + y*z*y - y*z*z, y*y*x + y*y*z + y*z*x + y*z*z, y*y*z*y - y*y*z*z + y*z*z*y - y*z*z*z, y*z*y*y - y*z*y*z + y*z*z*y - y*z*z*z, y*y*z*x + y*y*z*z + y*z*z*x + y*z*z*z, y*z*y*x + y*z*y*z + y*z*z*x + y*z*z*z) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field >>> I.groebner_basis(Integer(2)) is I.groebner_basis(Integer(4)) True >>> G = I.groebner_basis(Integer(4)) >>> G.groebner_basis(Integer(3)) is G True
If a finite complete Groebner basis exists, we can compute it as follows:
sage: I = F*[x*y-y*x,x*z-z*x,y*z-z*y,x^2*y-z^3,x*y^2+z*x^2]*F sage: I.groebner_basis(Infinity) Twosided Ideal (-y*z + z*y, -x*z + z*x, -x*y + y*x, x*x*z + x*y*y, x*x*y - z*z*z, x*x*x*z + y*z*z*z, x*z*z*z*z + y*y*z*z*z) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field
>>> from sage.all import * >>> I = F*[x*y-y*x,x*z-z*x,y*z-z*y,x**Integer(2)*y-z**Integer(3),x*y**Integer(2)+z*x**Integer(2)]*F >>> I.groebner_basis(Infinity) Twosided Ideal (-y*z + z*y, -x*z + z*x, -x*y + y*x, x*x*z + x*y*y, x*x*y - z*z*z, x*x*x*z + y*z*z*z, x*z*z*z*z + y*y*z*z*z) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field
Since the commutators of the generators are contained in the ideal, we can verify the above result by a computation in a polynomial ring in negative lexicographic order:
sage: P.<c,b,a> = PolynomialRing(QQ,order='neglex') sage: J = P*[a^2*b-c^3,a*b^2+c*a^2] sage: J.groebner_basis() [b*a^2 - c^3, b^2*a + c*a^2, c*a^3 + c^3*b, c^3*b^2 + c^4*a]
>>> from sage.all import * >>> P = PolynomialRing(QQ,order='neglex', names=('c', 'b', 'a',)); (c, b, a,) = P._first_ngens(3) >>> J = P*[a**Integer(2)*b-c**Integer(3),a*b**Integer(2)+c*a**Integer(2)] >>> J.groebner_basis() [b*a^2 - c^3, b^2*a + c*a^2, c*a^3 + c^3*b, c^3*b^2 + c^4*a]
Apparently, the results are compatible, by sending \(a\) to \(x\), \(b\) to \(y\) and \(c\) to \(z\).
- reduce(G)[source]#
Reduction of this ideal by another ideal, or normal form of an algebra element with respect to this ideal.
INPUT:
G
: A list or tuple of elements, an ideal, the ambient algebra, or a single element.
OUTPUT:
The normal form of
G
with respect to this ideal, ifG
is an element of the algebra.The reduction of this ideal by the elements resp. generators of
G
, ifG
is a list, tuple or ideal.The zero ideal, if
G
is the algebra containing this ideal.
EXAMPLES:
sage: F.<x,y,z> = FreeAlgebra(QQ, implementation='letterplace') sage: I = F*[x*y+y*z,x^2+x*y-y*x-y^2]*F sage: I.reduce(F) Twosided Ideal (0) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field sage: I.reduce(x^3) -y*z*x - y*z*y - y*z*z sage: I.reduce([x*y]) Twosided Ideal (y*z, x*x - y*x - y*y) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field sage: I.reduce(F*[x^2+x*y,y^2+y*z]*F) Twosided Ideal (x*y + y*z, -y*x + y*z) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field
>>> from sage.all import * >>> F = FreeAlgebra(QQ, implementation='letterplace', names=('x', 'y', 'z',)); (x, y, z,) = F._first_ngens(3) >>> I = F*[x*y+y*z,x**Integer(2)+x*y-y*x-y**Integer(2)]*F >>> I.reduce(F) Twosided Ideal (0) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field >>> I.reduce(x**Integer(3)) -y*z*x - y*z*y - y*z*z >>> I.reduce([x*y]) Twosided Ideal (y*z, x*x - y*x - y*y) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field >>> I.reduce(F*[x**Integer(2)+x*y,y**Integer(2)+y*z]*F) Twosided Ideal (x*y + y*z, -y*x + y*z) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field
- sage.algebras.letterplace.letterplace_ideal.poly_reduce(ring=None, interruptible=True, attributes=None, *args)[source]#
This function is an automatically generated C wrapper around the Singular function ‘NF’.
This wrapper takes care of converting Sage datatypes to Singular datatypes and vice versa. In addition to whatever parameters the underlying Singular function accepts when called, this function also accepts the following keyword parameters:
INPUT:
args
– a list of argumentsring
– a multivariate polynomial ringinterruptible
– ifTrue
pressing Ctrl + C during the execution of this function will interrupt the computation (default:True
)attributes
– a dictionary of optional Singular attributes assigned to Singular objects (default:None
)
If
ring
is not specified, it is guessed from the given arguments. If this is not possible, then a dummy ring, univariate polynomial ring overQQ
, is used.EXAMPLES:
sage: groebner = sage.libs.singular.function_factory.ff.groebner sage: P.<x, y> = PolynomialRing(QQ) sage: I = P.ideal(x^2-y, y+x) sage: groebner(I) [x + y, y^2 - y] sage: triangL = sage.libs.singular.function_factory.ff.triang__lib.triangL sage: P.<x1, x2> = PolynomialRing(QQ, order='lex') sage: f1 = 1/2*((x1^2 + 2*x1 - 4)*x2^2 + 2*(x1^2 + x1)*x2 + x1^2) sage: f2 = 1/2*((x1^2 + 2*x1 + 1)*x2^2 + 2*(x1^2 + x1)*x2 - 4*x1^2) sage: I = Ideal(Ideal(f1,f2).groebner_basis()[::-1]) sage: triangL(I, attributes={I:{'isSB':1}}) [[x2^4 + 4*x2^3 - 6*x2^2 - 20*x2 + 5, 8*x1 - x2^3 + x2^2 + 13*x2 - 5], [x2, x1^2], [x2, x1^2], [x2, x1^2]]
>>> from sage.all import * >>> groebner = sage.libs.singular.function_factory.ff.groebner >>> P = PolynomialRing(QQ, names=('x', 'y',)); (x, y,) = P._first_ngens(2) >>> I = P.ideal(x**Integer(2)-y, y+x) >>> groebner(I) [x + y, y^2 - y] >>> triangL = sage.libs.singular.function_factory.ff.triang__lib.triangL >>> P = PolynomialRing(QQ, order='lex', names=('x1', 'x2',)); (x1, x2,) = P._first_ngens(2) >>> f1 = Integer(1)/Integer(2)*((x1**Integer(2) + Integer(2)*x1 - Integer(4))*x2**Integer(2) + Integer(2)*(x1**Integer(2) + x1)*x2 + x1**Integer(2)) >>> f2 = Integer(1)/Integer(2)*((x1**Integer(2) + Integer(2)*x1 + Integer(1))*x2**Integer(2) + Integer(2)*(x1**Integer(2) + x1)*x2 - Integer(4)*x1**Integer(2)) >>> I = Ideal(Ideal(f1,f2).groebner_basis()[::-Integer(1)]) >>> triangL(I, attributes={I:{'isSB':Integer(1)}}) [[x2^4 + 4*x2^3 - 6*x2^2 - 20*x2 + 5, 8*x1 - x2^3 + x2^2 + 13*x2 - 5], [x2, x1^2], [x2, x1^2], [x2, x1^2]]
The Singular documentation for ‘NF’ is given below.
5.1.131 reduce -------------- `*Syntax:*' `reduce (' poly_expression`,' ideal_expression `)' `reduce (' poly_expression`,' ideal_expression`,' int_expression `)' `reduce (' poly_expression`,' poly_expression`,' ideal_expression `)' `reduce (' vector_expression`,' ideal_expression `)' `reduce (' vector_expression`,' ideal_expression`,' int_expression `)' `reduce (' vector_expression`,' module_expression `)' `reduce (' vector_expression`,' module_expression`,' int_expression `)' `reduce (' vector_expression`,' poly_expression`,' module_expression `)' `reduce (' ideal_expression`,' ideal_expression `)' `reduce (' ideal_expression`,' ideal_expression`,' int_expression `)' `reduce (' ideal_expression`,' matrix_expression`,' ideal_expression `)' `reduce (' module_expression`,' ideal_expression `)' `reduce (' module_expression`,' ideal_expression`,' int_expression `)' `reduce (' module_expression`,' module_expression `)' `reduce (' module_expression`,' module_expression`,' int_expression `)' `reduce (' module_expression`,' matrix_expression`,' module_expression `)' `reduce (' poly/vector/ideal/module`,' ideal/module`,' int`,' intvec `)' `reduce (' ideal`,' matrix`,' ideal`,' int `)' `reduce (' poly`,' poly`,' ideal`,' int `)' `reduce (' poly`,' poly`,' ideal`,' int`,' intvec `)' `*Type:*' the type of the first argument `*Purpose:*' reduces a polynomial, vector, ideal or module to its normal form with respect to an ideal or module represented by a standard basis. Returns 0 if and only if the polynomial (resp. vector, ideal, module) is an element (resp. subideal, submodule) of the ideal (resp. module). The result may have no meaning if the second argument is not a standard basis. The third (optional) argument of type int modifies the behavior: * 0 default * 1 consider only the leading term and do no tail reduction. * 2 tail reduction:n the local/mixed ordering case: reduce also with bad ecart * 4 reduce without division, return possibly a non-zero constant multiple of the remainder If a second argument `u' of type poly or matrix is given, the first argument `p' is replaced by `p/u'. This works only for zero dimensional ideals (resp. modules) in the third argument and gives, even in a local ring, a reduced normal form which is the projection to the quotient by the ideal (resp. module). One may give a degree bound in the fourth argument with respect to a weight vector in the fifth argument in order have a finite computation. If some of the weights are zero, the procedure may not terminate! `*Note_*' The commands `reduce' and `NF' are synonymous. `*Example:*' ring r1 = 0,(z,y,x),ds; poly s1=2x5y+7x2y4+3x2yz3; poly s2=1x2y2z2+3z8; poly s3=4xy5+2x2y2z3+11x10; ideal i=s1,s2,s3; ideal j=std(i); reduce(3z3yx2+7y4x2+yx5+z12y2x2,j); ==> -yx5+2401/81y14x2+2744/81y11x5+392/27y8x8+224/81y5x11+16/81y2x14 reduce(3z3yx2+7y4x2+yx5+z12y2x2,j,1); ==> -yx5+z12y2x2 // 4 arguments: ring rs=0,x,ds; // normalform of 1/(1+x) w.r.t. (x3) up to degree 5 reduce(poly(1),1+x,ideal(x3),5); ==> // ** _ is no standard basis ==> 1-x+x2 * Menu: See * division:: * ideal:: * module:: * poly operations:: * std:: * vector::
- sage.algebras.letterplace.letterplace_ideal.singular_twostd(ring=None, interruptible=True, attributes=None, *args)[source]#
This function is an automatically generated C wrapper around the Singular function ‘twostd’.
This wrapper takes care of converting Sage datatypes to Singular datatypes and vice versa. In addition to whatever parameters the underlying Singular function accepts when called, this function also accepts the following keyword parameters:
INPUT:
args
– a list of argumentsring
– a multivariate polynomial ringinterruptible
– ifTrue
pressing Ctrl + C during the execution of this function will interrupt the computation (default:True
)attributes
– a dictionary of optional Singular attributes assigned to Singular objects (default:None
)
If
ring
is not specified, it is guessed from the given arguments. If this is not possible, then a dummy ring, univariate polynomial ring overQQ
, is used.EXAMPLES:
sage: groebner = sage.libs.singular.function_factory.ff.groebner sage: P.<x, y> = PolynomialRing(QQ) sage: I = P.ideal(x^2-y, y+x) sage: groebner(I) [x + y, y^2 - y] sage: triangL = sage.libs.singular.function_factory.ff.triang__lib.triangL sage: P.<x1, x2> = PolynomialRing(QQ, order='lex') sage: f1 = 1/2*((x1^2 + 2*x1 - 4)*x2^2 + 2*(x1^2 + x1)*x2 + x1^2) sage: f2 = 1/2*((x1^2 + 2*x1 + 1)*x2^2 + 2*(x1^2 + x1)*x2 - 4*x1^2) sage: I = Ideal(Ideal(f1,f2).groebner_basis()[::-1]) sage: triangL(I, attributes={I:{'isSB':1}}) [[x2^4 + 4*x2^3 - 6*x2^2 - 20*x2 + 5, 8*x1 - x2^3 + x2^2 + 13*x2 - 5], [x2, x1^2], [x2, x1^2], [x2, x1^2]]
>>> from sage.all import * >>> groebner = sage.libs.singular.function_factory.ff.groebner >>> P = PolynomialRing(QQ, names=('x', 'y',)); (x, y,) = P._first_ngens(2) >>> I = P.ideal(x**Integer(2)-y, y+x) >>> groebner(I) [x + y, y^2 - y] >>> triangL = sage.libs.singular.function_factory.ff.triang__lib.triangL >>> P = PolynomialRing(QQ, order='lex', names=('x1', 'x2',)); (x1, x2,) = P._first_ngens(2) >>> f1 = Integer(1)/Integer(2)*((x1**Integer(2) + Integer(2)*x1 - Integer(4))*x2**Integer(2) + Integer(2)*(x1**Integer(2) + x1)*x2 + x1**Integer(2)) >>> f2 = Integer(1)/Integer(2)*((x1**Integer(2) + Integer(2)*x1 + Integer(1))*x2**Integer(2) + Integer(2)*(x1**Integer(2) + x1)*x2 - Integer(4)*x1**Integer(2)) >>> I = Ideal(Ideal(f1,f2).groebner_basis()[::-Integer(1)]) >>> triangL(I, attributes={I:{'isSB':Integer(1)}}) [[x2^4 + 4*x2^3 - 6*x2^2 - 20*x2 + 5, 8*x1 - x2^3 + x2^2 + 13*x2 - 5], [x2, x1^2], [x2, x1^2], [x2, x1^2]]
The Singular documentation for ‘twostd’ is given below.
5.1.155 system -------------- `*Syntax:*' `system (' string_expression `)' `system (' string_expression`,' expression `)' `*Type:*' depends on the desired function, may be none `*Purpose:*' interface to internal data and the operating system. The string_expression determines the command to execute. Some commands require an additional argument (second form) where the type of the argument depends on the command. See below for a list of all possible commands. `*Note_*' Not all functions work on every platform. `*Functions:*' `system("alarm",' int `)' abort the Singular process after computing for that many seconds (system+user cpu time). `system("absFact",' poly `)' absolute factorization of the polynomial (from a polynomial ring over a transzedental extension) Returns a list of the ideal of the factors, intvec of multiplicities, ideal of minimal polynomials and the number of factors. `system("blackbox")' list all blackbox data types. `system("browsers");' returns a string about available help browsers. *Note The online help system::. `system("bracket",' poly, poly `)' returns the Lie bracket [p,q]. `system("complexNearZero",' number_expression `)' checks for a small value for floating point numbers `system("contributors")' returns names of people who contributed to the SINGULAR kernel as string. `system("content",p)' returns p/content(p) for poly/vector `system("cpu")' returns the number of cpus as int (for creating multiple threads/processes). (see `system("--cpus")'). `system("denom_list")' returns the list of denominators (number) which occurred in the latest std computationi(s). Is reset to the empty list at ring changes or by this system call. `system("eigenvals",' matrix `)' returns the list of the eigenvalues of the matrix (as ideal, intvec). (see `system("hessenberg")'). `system("env",' ring `)' returns the enveloping algebra (i.e. R tensor R^opp) See `system("opp")'. `system("executable",' string `)' returns the path of the command given as argument or the empty string (for: not found) See `system("Singular")'. See `system("getenv","PATH")'. `system("getenv",' string_expression`)' returns the value of the shell environment variable given as the second argument. The return type is string. `system("getPrecDigits")' returns the precision for floating point numbers `system("gmsnf",' ideal, ideal, matrix,int, int `)' Gauss-Manin system: for gmspoly.lib, gmssing.lib `system("HC")' returns the degree of the "highest corner" from the last std computation (or 0). `system("hessenberg",' matrix `)' returns the Hessenberg matrix (via QR algorithm). `system("install",' s1, s2, p3, i4 `)' install a new method p3 for s2 for the newstruct type s1. s2 must be a reserved operator with i4 operands (i4 may be 1,2,3; use 4 for more than 3 or a varying number of arguments) See *Note Commands for user defined types::. `system("LLL",' B `)' B must be a matrix or an intmat. Interface to NTLs LLL (Exact Arithmetic Variant over ZZ). Returns the same type as the input. B is an m x n matrix, viewed as m rows of n-vectors. m may be less than, equal to, or greater than n, and the rows need not be linearly independent. B is transformed into an LLL-reduced basis. The first m-rank(B) rows of B are zero. More specifically, elementary row transformations are performed on B so that the non-zero rows of new-B form an LLL-reduced basis for the lattice spanned by the rows of old-B. `system("nblocks")' or `system("nblocks",' ring_name `)' returns the number of blocks of the given ring, or of the current basering, if no second argument is given. The return type is int. `system("nc_hilb",' ideal, int, [,...] `)' internal support for ncHilb.lib, return nothing `system("neworder",' ideal `)' string of the ring variables in an heurically good order for `char_series' `system("newstruct")' list all newstruct data types. `system("opp",' ring `)' returns the opposite ring. `system("oppose",' ring R, poly p `)' returns the opposite polynomial of p from R. `system("pcvLAddL",' list, list `)' `system("pcvPMulL",' poly, list `)' `system("pcvMinDeg",' poly `)' `system("pcvP2CV",' list, int, int `)' `system("pcvCV2P",' list, int, int `)' `system("pcvDim",' int, int `)' `system("pcvBasis",' int, int `)' internal for mondromy.lib `system("pid")' returns the process number as int (for creating unique names). `system("random")' or `system("random",' int `)' returns or sets the seed of the random generator. `system("reduce_bound",' poly, ideal, int `)' or `system("reduce_bound",' ideal, ideal, int `)' or `system("reduce_bound",' vector, module, int `)' or `system("reduce_bound",' module, module, int `)' returns the normalform of the first argument wrt. the second up to the given degree bound (wrt. total degree) `system("reserve",' int `)' reserve a port and listen with the given backlog. (see `system("reservedLink")'). `system("reservedLink")' accept a connect at the reserved port and return a (write-only) link to it. (see `system("reserve")'). `system("rref",' matrix ` )' return a reduced row echelon form of the constant matrix M (see `system("rref")'). `system("semaphore",' string, int `)' operations for semaphores: string may be `"init"', `"exists"', `"acquire"', `"try_acquire"', `"release"', `"get_value"', and int is the number of the semaphore. Returns -2 for wrong command, -1 for error or the result of the command. `system("semic",' list, list `)' or `system("semic",' list, list, int `)' computes from list of spectrum numbers and list of spectrum numbers the semicontinuity index (qh, if 3rd argument is 1). `system("setenv",'string_expression, string_expression`)' sets the shell environment variable given as the second argument to the value given as the third argument. Returns the third argument. Might not be available on all platforms. `system("sh"', string_expression `)' shell escape, returns the return code of the shell as int. The string is sent literally to the shell. `system("shrinktest",' poly, i2 `)' internal for shift algebra (with i2 variables): shrink the poly `system("Singular")' returns the absolute (path) name of the running SINGULAR as string. `system("SingularBin")' returns the absolute path name of directory of the running SINGULAR as string (ending in /) `system("SingularLib")' returns the colon separated library search path name as string. `system("spadd",' list, list `)' or `system("spadd",' list, list, int `)' computes from list of spectrum numbers and list of spectrum numbers the sum of the lists. `system("spectrum",' poly `)' or `system("spectrum",' poly, int `)' `system("spmul",' list, int `)' or `system("spmul",' list, list, int `)' computes from list of spectrum numbers the multiple of it. `system("std_syz",' module, int `)' compute a partial groebner base of a module, stop after the given column `system("tensorModuleMult",' int, module `)' internal for sheafcoh.lib (see id_TensorModuleMult) `system("twostd",' ideal `)' returns the two-sided standard basis of the two-sided ideal. `system("uname")' returns a string identifying the architecture for which SINGULAR was compiled. `system("verifyGB",' ideal_expression/module_expression `)' checks, if an ideal/module is a Groebner base `system("version")' returns the version number of SINGULAR as int. (Version a-b-c-d returns a*1000+b*100+c*10+d) `system("with")' without an argument: returns a string describing the current version of SINGULAR, its build options, the used path names and other configurations with a string argument: test for that feature and return an int. `system("--cpus")' returns the number of available cpu cores as int (for using multiple cores). (see `system("cpu")'). `system("'-`")' prints the values of all options. `system("'-long_option_name`")' returns the value of the (command-line) option long_option_name. The type of the returned value is either string or int. *Note Command line options::, for more info. `system("'-long_option_name`",' expression`)' sets the value of the (command-line) option long_option_name to the value given by the expression. Type of the expression must be string, or int. *Note Command line options::, for more info. Among others, this can be used for setting the seed of the random number generator, the used help browser, the minimal display time, or the timer resolution. `*Example:*' // a listing of the current directory: system("sh","ls"); // execute a shell, return to SINGULAR with exit: system("sh","sh"); string unique_name="/tmp/xx"+string(system("pid")); unique_name; ==> /tmp/xx4711 system("uname") ==> ix86-Linux system("getenv","PATH"); ==> /bin:/usr/bin:/usr/local/bin system("Singular"); ==> /usr/local/bin/Singular // report value of all options system("--"); ==> // --batch 0 ==> // --execute ==> // --sdb 0 ==> // --echo 1 ==> // --profile 0 ==> // --quiet 1 ==> // --sort 0 ==> // --random 12345678 ==> // --no-tty 1 ==> // --user-option ==> // --allow-net 0 ==> // --browser ==> // --cntrlc ==> // --emacs 0 ==> // --log ==> // --no-stdlib 0 ==> // --no-rc 1 ==> // --no-warn 0 ==> // --no-out 0 ==> // --no-shell 0 ==> // --min-time "0.5" ==> // --cpus 4 ==> // --threads 4 ==> // --flint-threads 1 ==> // --MPport ==> // --MPhost ==> // --link ==> // --ticks-per-sec 1 // set minimal display time to 0.02 seconds system("--min-time", "0.02"); // set timer resolution to 0.01 seconds system("--ticks-per-sec", 100); // re-seed random number generator system("--random", 12345678); // allow your web browser to access HTML pages from the net system("--allow-net", 1); // and set help browser to firefox system("--browser", "firefox"); ==> // ** No help browser 'firefox' available. ==> // ** Setting help browser to 'dummy'.