Ticket #11586: 11586.patch

File 11586.patch, 1.9 KB (added by roed, 12 years ago)
  • sage/rings/padics/padic_ZZ_pX_element.pyx

    # HG changeset patch
    # User David Roe <roed@math.harvard.edu>
    # Date 1310537833 25200
    # Node ID 0c83894159f3334dd922a58a827ebd16d6549919
    # Parent  45c2d3a5d11d5f7431a3283c6e5e1c6a7d69a0e2
    #11586: fix a bug in norms for unramified p-adic extensions.
    
    diff --git a/sage/rings/padics/padic_ZZ_pX_element.pyx b/sage/rings/padics/padic_ZZ_pX_element.pyx
    a b  
    377377           1 + 5^2 + O(5^5)
    378378           sage: ((1+2*w)).norm()^5
    379379           1 + 5^2 + O(5^5)
     380
     381        TESTS:
     382
     383        Check that #11586 has been resolved::
     384
     385            sage: R.<x> = QQ[]
     386            sage: f = x^2 + 3*x + 1
     387            sage: M.<a> = Qp(7).extension(f)
     388            sage: M(7).norm()
     389            7^2 + O(7^22)
     390            sage: b = 7*a + 35
     391            sage: b.norm()
     392            4*7^2 + 7^3 + O(7^22)
     393            sage: b*b.frobenius()
     394            4*7^2 + 7^3 + O(7^22)
    380395        """
    381396        if base is not None:
    382397            if base is self.parent():
     
    387402            return self.parent().ground_ring()(0)
    388403        elif self._is_inexact_zero():
    389404            return self.ground_ring(0, self.valuation())
    390         norm_of_uniformizer = (-1)**self.parent().degree() * self.parent().defining_polynomial()[0]
    391405        if self.valuation() == 0:
    392             return self.parent().ground_ring()(self.unit_part().matrix_mod_pn().det())
     406            return self.parent().ground_ring()(self.matrix_mod_pn().det())
    393407        else:
     408            if self.parent().e() == 1:
     409                norm_of_uniformizer = self.parent().ground_ring().uniformizer_pow(self.parent().degree())
     410            else:
     411                norm_of_uniformizer = (-1)**self.parent().degree() * self.parent().defining_polynomial()[0]
    394412            return self.parent().ground_ring()(self.unit_part().matrix_mod_pn().det()) * norm_of_uniformizer**self.valuation()
    395413
    396414    def trace(self, base = None):