Ticket #5482: trac_5482.patch

File trac_5482.patch, 1.5 KB (added by Alex Ghitza, 13 years ago)

apply this patch only

  • sage/rings/polynomial/polynomial_quotient_ring.py

    # HG changeset patch
    # User Alexandru Ghitza <aghitza@alum.mit.edu>
    # Date 1258288300 -39600
    # Node ID 9f9295c0ff6eba83da22b6b4bcc971cea4838e4e
    # Parent  e4812c5582dd1bd18cb33a852b5af0109f023aba
    trac 5482: quotient ring is created without generator names
    
    diff -r e4812c5582dd -r 9f9295c0ff6e sage/rings/polynomial/polynomial_quotient_ring.py
    a b  
    139139        sage: f = x^2 + 1
    140140        sage: R.quotient(f)
    141141        Univariate Quotient Polynomial Ring in xbar over Integer Ring with modulus x^2 + 1
     142
     143    This shows that the issue at trac 5482 is solved::
     144
     145        sage: R.<x> = PolynomialRing(QQ)
     146        sage: f = x^2-1
     147        sage: R.quotient_by_principal_ideal(f)
     148        Univariate Quotient Polynomial Ring in xbar over Rational Field with modulus x^2 - 1
    142149    """
    143150    if not isinstance(ring, PolynomialRing_commutative):
    144151        raise TypeError, "ring must be a polynomial ring"
     
    149156    c = polynomial.leading_coefficient()
    150157    if not c.is_unit():
    151158        raise TypeError, "polynomial must have unit leading coefficient"
     159    if names is None:
     160        names = tuple([x + 'bar' for x in ring.variable_names()])
     161    else:
     162        names = sage.structure.parent_gens.normalize_names(ring.ngens(), names)
    152163    R = ring.base_ring()
    153164    if isinstance(R, sage.rings.integral_domain.IntegralDomain):
    154165        try: