Ticket #13766: trac13766_unit_group_conversion.patch

File trac13766_unit_group_conversion.patch, 1.7 KB (added by mderickx, 7 years ago)
  • sage/rings/number_field/number_field.py

    # HG changeset patch
    # User Maarten Derickx <m.derickx.student@gmail.com>
    # Date 1365419734 -7200
    # Node ID c1da09dac578322502e9f681d5371139edd6702e
    # Parent  99a6c4527bb9f7cf93eada1f63a08787d4e68cad
    add a doctest for conversion between numberfield and unit group elements in order to make sure that trac 13766 continues working
    
    diff --git a/sage/rings/number_field/number_field.py b/sage/rings/number_field/number_field.py
    a b  
    53025302            (u0, u1, u2, u3, u4, u5, u6, u7, u8)
    53035303            sage: U.gens_values()  # result not independently verified
    53045304            [-1, a^9 + a - 1, a^16 - a^15 + a^14 - a^12 + a^11 - a^10 - a^8 + a^7 - 2*a^6 + a^4 - 3*a^3 + 2*a^2 - 2*a + 1, 2*a^16 - a^14 - a^13 + 3*a^12 - 2*a^10 + a^9 + 3*a^8 - 3*a^6 + 3*a^5 + 3*a^4 - 2*a^3 - 2*a^2 + 3*a + 4, a^15 + a^14 + 2*a^11 + a^10 - a^9 + a^8 + 2*a^7 - a^5 + 2*a^3 - a^2 - 3*a + 1, a^16 + a^15 + a^14 + a^13 + a^12 + a^11 + a^10 + a^9 + a^8 + a^7 + a^6 + a^5 + a^4 + a^3 + a^2 - 2, 2*a^16 - 3*a^15 + 3*a^14 - 3*a^13 + 3*a^12 - a^11 + a^9 - 3*a^8 + 4*a^7 - 5*a^6 + 6*a^5 - 4*a^4 + 3*a^3 - 2*a^2 - 2*a + 4, a^15 - a^12 + a^10 - a^9 - 2*a^8 + 3*a^7 + a^6 - 3*a^5 + a^4 + 4*a^3 - 3*a^2 - 2*a + 2, 2*a^16 + a^15 - a^11 - 3*a^10 - 4*a^9 - 4*a^8 - 4*a^7 - 5*a^6 - 7*a^5 - 8*a^4 - 6*a^3 - 5*a^2 - 6*a - 7]
     5305       
     5306        We can also convert numberfield element to elements of the unit group.
     5307        This also tests that :trac:`13766`:: is fixed::
     5308
     5309            sage: L.<a> = CyclotomicField(7)
     5310            sage: a in L.unit_group()
     5311            True
     5312            sage: L.unit_group()(a)
     5313            u0^6
     5314           
    53055315        """
    53065316        try:
    53075317            return self._unit_group