Ticket #12404: trac_12404_warning.patch

File trac_12404_warning.patch, 1.9 KB (added by saraedum, 10 years ago)

warning about inconsistency with squarefree_decomposition

  • sage/rings/polynomial/polynomial_element.pyx

    # HG changeset patch
    # User Julian Rueth <julian.rueth@gmail.com>
    Trac 12404: warning about inconsistency between is_squarefree() and squarefree_decomposition() of polynomials
    
    diff --git a/sage/rings/polynomial/polynomial_element.pyx b/sage/rings/polynomial/polynomial_element.pyx
    index d25c3df..5b250d1 100644
    a b cdef class Polynomial(CommutativeAlgebraElement): 
    56205620        Return False if this polynomial is not square-free, i.e., if there is a
    56215621        non-unit `g` in the polynomial ring such that `g^2` divides ``self``.
    56225622
     5623        .. WARNING::
     5624
     5625            This method is not consistent with
     5626            :meth:`.squarefree_decomposition` since the latter does not factor
     5627            the content of a polynomial. See the examples below.
     5628
    56235629        EXAMPLES::
    5624        
     5630
    56255631            sage: R.<x> = QQ[]
    56265632            sage: f = (x-1)*(x-2)*(x^2-5)*(x^17-3); f
    56275633            x^21 - 3*x^20 - 3*x^19 + 15*x^18 - 10*x^17 - 3*x^4 + 9*x^3 + 9*x^2 - 45*x + 30
    cdef class Polynomial(CommutativeAlgebraElement): 
    56685674            sage: R(t^2).is_squarefree()
    56695675            True
    56705676
     5677        This method is not consistent with :meth:`.squarefree_decomposition`::
     5678
     5679            sage: R.<x> = ZZ[]
     5680            sage: f = 4 * x
     5681            sage: f.is_squarefree()
     5682            False
     5683            sage: f.squarefree_decomposition()
     5684            (4) * x
     5685
     5686        If you want this method equally not to consider the content, you can
     5687        remove it as in the following example::
     5688
     5689            sage: c = f.content()
     5690            sage: (f/c).is_squarefree()
     5691            True
     5692
    56715693        """
    56725694        if self.parent().base_ring() not in sage.categories.principal_ideal_domains.PrincipalIdealDomains():
    56735695            raise NotImplementedError("is_squarefree() is only implemented for polynomials over principal ideal domains")