def _repr_(self): """ Return a string representation of this system. EXAMPLE:: sage: P.<a,b,c,d> = PolynomialRing(GF(127)) sage: I = sage.rings.ideal.Katsura(P) sage: F = Sequence(I); F # indirect doctest [a + 2*b + 2*c + 2*d - 1, a^2 + 2*b^2 + 2*c^2 + 2*d^2 - a, 2*a*b + 2*b*c + 2*c*d - b, b^2 + 2*a*c + 2*b*d - c] If the system contains 20 or more polynomials, a short summary is printed:: sage: sr = mq.SR(allow_zero_inversions=True,gf2=True) sage: F,s = sr.polynomial_system(); F Polynomial Sequence with 36 Polynomials in 20 Variables """ if len(self) < 20: return Sequence_generic._repr_(self) else: return "Polynomial Sequence with %d Polynomials in %d Variables"%(len(self),self.nvariables())
def _repr_(self): """ Return a string representation of this system. EXAMPLE:: sage: P.<a,b,c,d> = PolynomialRing(GF(127)) sage: I = sage.rings.ideal.Katsura(P) sage: F = Sequence(I); F # indirect doctest [a + 2*b + 2*c + 2*d - 1, a^2 + 2*b^2 + 2*c^2 + 2*d^2 - a, 2*a*b + 2*b*c + 2*c*d - b, b^2 + 2*a*c + 2*b*d - c] If the system contains 20 or more polynomials, a short summary is printed:: sage: sr = mq.SR(allow_zero_inversions=True,gf2=True) sage: F,s = sr.polynomial_system(); F Polynomial Sequence with 56 Polynomials in 20 Variables """ if len(self) < 20: return Sequence_generic._repr_(self) else: return "Polynomial Sequence with %d Polynomials in %d Variables"%(len(self),self.nvariables())
def __init__(self, parts, ring, immutable=False, cr=False, cr_str=None): """ Construct a new system of multivariate polynomials. INPUT: - ``part`` - a list of lists with polynomials - ``ring`` - a multivariate polynomial ring - ``immutable`` - if ``True`` the sequence is immutable (default: ``False``) - ``cr`` - print a line break after each element (default: ``False``) - ``cr_str`` - print a line break after each element if 'str' is called (default: ``None``) EXAMPLES:: sage: P.<a,b,c,d> = PolynomialRing(GF(127),4) sage: I = sage.rings.ideal.Katsura(P) sage: Sequence([I.gens()], I.ring()) # indirect doctest [a + 2*b + 2*c + 2*d - 1, a^2 + 2*b^2 + 2*c^2 + 2*d^2 - a, 2*a*b + 2*b*c + 2*c*d - b, b^2 + 2*a*c + 2*b*d - c] If an ideal is provided, the generators are used.:: sage: Sequence(I) [a + 2*b + 2*c + 2*d - 1, a^2 + 2*b^2 + 2*c^2 + 2*d^2 - a, 2*a*b + 2*b*c + 2*c*d - b, b^2 + 2*a*c + 2*b*d - c] If a list of polynomials is provided, the system has only one part.:: sage: Sequence(I.gens(), I.ring()) [a + 2*b + 2*c + 2*d - 1, a^2 + 2*b^2 + 2*c^2 + 2*d^2 - a, 2*a*b + 2*b*c + 2*c*d - b, b^2 + 2*a*c + 2*b*d - c] """ Sequence_generic.__init__(self, sum(parts, tuple()), ring, check=False, immutable=immutable, cr=cr, cr_str=cr_str, use_sage_types=True) self._ring = ring self._parts = parts
def __init__(self, parts, ring, immutable=False, cr=False, cr_str=None): """ Construct a new system of multivariate polynomials. INPUT: - ``part`` - a list of lists with polynomials - ``ring`` - a multivariate polynomial ring - ``immutable`` - if ``True`` the sequence is immutable (default: ``False``) - ``cr`` - print a line break after each element (default: ``False``) - ``cr_str`` - print a line break after each element if 'str' is called (default: ``None``) EXAMPLES:: sage: P.<a,b,c,d> = PolynomialRing(GF(127),4) sage: I = sage.rings.ideal.Katsura(P) sage: Sequence([I.gens()], I.ring()) # indirect doctest [a + 2*b + 2*c + 2*d - 1, a^2 + 2*b^2 + 2*c^2 + 2*d^2 - a, 2*a*b + 2*b*c + 2*c*d - b, b^2 + 2*a*c + 2*b*d - c] If an ideal is provided, the generators are used.:: sage: Sequence(I) [a + 2*b + 2*c + 2*d - 1, a^2 + 2*b^2 + 2*c^2 + 2*d^2 - a, 2*a*b + 2*b*c + 2*c*d - b, b^2 + 2*a*c + 2*b*d - c] If a list of polynomials is provided, the system has only one part.:: sage: Sequence(I.gens(), I.ring()) [a + 2*b + 2*c + 2*d - 1, a^2 + 2*b^2 + 2*c^2 + 2*d^2 - a, 2*a*b + 2*b*c + 2*c*d - b, b^2 + 2*a*c + 2*b*d - c] """ Sequence_generic.__init__(self, sum(parts,tuple()), ring, check=False, immutable=immutable, cr=cr, cr_str=cr_str, use_sage_types=True) self._ring = ring self._parts = parts