#19001: Conic morphism creation fails on some base fields
--------------------------------------+-------------------
       Reporter:  lackermans          |        Owner:
           Type:  defect              |       Status:  new
       Priority:  major               |    Milestone:
      Component:  algebraic geometry  |   Resolution:
       Keywords:                      |    Merged in:
        Authors:                      |    Reviewers:
Report Upstream:  N/A                 |  Work issues:
         Branch:                      |       Commit:
   Dependencies:                      |     Stopgaps:
--------------------------------------+-------------------
Changes (by mstreng):

 * priority:  minor => major


Old description:

> The function
> `sage.schemes.plane_conics.con_field.ProjectiveConic_field.hom()` with
> codomain argument `Y` given fails on base fields for which sage doesn't
> know how to simplify fractions of polynomials. Consequently
> `diagonalization()` fails for cases that I need to implement #6881.
>
> My current workaround is to, in case of characteristic 0, convert the
> fraction `q` to a symbolic expression and back. I'm not sure if this is
> mathematically okay, and this still leaves infinite fields of positive
> characteristic.
>
> But is it really necessary for `diagonalization()` to check if the found
> matrix transformation gives the required morphism?
>
> '''Example:'''
>
> {{{
> #!python
> sage: K = FractionField(PolynomialRing(QQ, 't')); (t,) = K.gens(); C =
> Conic(K, [1/2,0, 1, 2, 0, 3])
> sage: C.diagonalization()
> ---------------------------------------------------------------------------
> ValueError                                Traceback (most recent call
> last)
> <ipython-input-2-c3844e29eb5c> in <module>()
> ----> 1 C.diagonalization()
>
> /home/lennart/sage-build/sage-6.7/local/lib/python2.7/site-
> packages/sage/schemes/plane_conics/con_field.pyc in diagonalization(self,
> names)
>     339         D, T = self.diagonal_matrix()
>     340         con = Conic(D, names = names)
> --> 341         return con, con.hom(T, self), self.hom(T.inverse(), con)
>     342
>     343     def gens(self):
>
> /home/lennart/sage-build/sage-6.7/local/lib/python2.7/site-
> packages/sage/schemes/plane_conics/con_field.pyc in hom(self, x, Y)
>     656                     raise ValueError("The matrix x (= %s) does
> not define a " \
>     657                                       "map from self (= %s) to Y
> (= %s)" % \
> --> 658                                       (x, self, Y))
>     659             x = Sequence(x*vector(self.ambient_space().gens()))
>     660             return self.Hom(Y)(x, check = False)
>
> ValueError: The matrix x (= [ 1  0 -1]
> [ 0  1  0]
> [ 0  0  1]) does not define a map from self (= Projective Conic Curve
> over Fraction Field of Univariate Polynomial Ring in t over Rational
> Field defined by 1/2*x^2 + 2*y^2 + 5/2*z^2) to Y (= Projective C
> onic Curve over Fraction Field of Univariate Polynomial Ring in t over
> Rational Field defined by 1/2*x^2 + 2*y^2 + x*z + 3*z^2)
> }}}

New description:

 The function
 `sage.schemes.plane_conics.con_field.ProjectiveConic_field.hom(x, Y)` with
 `x` a matrix and codomain argument `Y` given fails on base fields for
 which sage does not simplify fractions of multivariate polynomials. It
 raises a `ValueError` for perfectly valid input.

 {{{
 sage: C = Conic(QQ, [1,0,0,1,0,1])
 sage: D = Conic(QQ, [1,0,-2,1,0,2])
 sage: T = Matrix([[1,0,1],[0,1,0],[0,0,1]])
 sage: C.hom(T, D) # works fine over QQ
 Scheme morphism:
   From: Projective Conic Curve over Rational Field defined by x^2 + y^2 +
 z^2
   To:   Projective Conic Curve over Rational Field defined by x^2 + y^2 -
 2*x*z + 2*z^2
   Defn: Defined on coordinates by sending (x : y : z) to
         (x + z : y : z)
 sage: K = FractionField(PolynomialRing(QQ, 't'))
 sage: CK = C.base_extend(K)
 sage: DK = D.base_extend(K)
 sage: TK = T.base_extend(K)
 sage: CK.hom(TK).codomain() == DK # works fine when the codomain is not
 specified
 True
 sage: CK.hom(TK, DK) # fails over K when the codomain is specified
 ---------------------------------------------------------------------------
 ValueError                                Traceback (most recent call
 last)
 <ipython-input-65-08845d23f389> in <module>()
 ----> 1 CK.hom(TK, DK)

 /Users/marcostreng/sage_builds/sage/local/lib/python2.7/site-
 packages/sage/schemes/plane_conics/con_field.pyc in hom(self, x, Y)
     656                     raise ValueError("The matrix x (= %s) does not
 define a " \
     657                                       "map from self (= %s) to Y
 (= %s)" % \
 --> 658                                       (x, self, Y))
     659             x = Sequence(x*vector(self.ambient_space().gens()))
     660             return self.Hom(Y)(x, check = False)

 ValueError: The matrix x (= [1 0 1]
 [0 1 0]
 [0 0 1]) does not define a map from self (= Projective Conic Curve over
 Fraction Field of Univariate Polynomial Ring in t over Rational Field
 defined by x^2 + y^2 + z^2) to Y (= Projective Conic Curve over Fraction
 Field of Univariate Polynomial Ring in t over Rational Field defined by
 x^2 + y^2 + (-2)*x*z + 2*z^2)
 }}}

 Here is the code that raises the `ValueError`. It should test whether q is
 constant, but instead tests whether its numerator and denominator are
 constant.
 {{{
                 q = Y.defining_polynomial()/im.defining_polynomial()
                 if not (q.numerator().is_constant()
                         and q.denominator().is_constant()):
                     raise ValueError("The matrix x (= %s) does not define
 a " \
                                       "map from self (= %s) to Y (= %s)" %
 \
                                       (x, self, Y))
 }}}

 Here is a less direct example, which shows that consequently
 `diagonalization()` fails for such base fields.

 '''Example:'''

 {{{
 #!python
 sage: K = FractionField(PolynomialRing(QQ, 't')); (t,) = K.gens(); C =
 Conic(K, [1/2,0, 1, 2, 0, 3])
 sage: C.diagonalization()
 ---------------------------------------------------------------------------
 ValueError                                Traceback (most recent call
 last)
 <ipython-input-2-c3844e29eb5c> in <module>()
 ----> 1 C.diagonalization()

 /home/lennart/sage-build/sage-6.7/local/lib/python2.7/site-
 packages/sage/schemes/plane_conics/con_field.pyc in diagonalization(self,
 names)
     339         D, T = self.diagonal_matrix()
     340         con = Conic(D, names = names)
 --> 341         return con, con.hom(T, self), self.hom(T.inverse(), con)
     342
     343     def gens(self):

 /home/lennart/sage-build/sage-6.7/local/lib/python2.7/site-
 packages/sage/schemes/plane_conics/con_field.pyc in hom(self, x, Y)
     656                     raise ValueError("The matrix x (= %s) does not
 define a " \
     657                                       "map from self (= %s) to Y
 (= %s)" % \
 --> 658                                       (x, self, Y))
     659             x = Sequence(x*vector(self.ambient_space().gens()))
     660             return self.Hom(Y)(x, check = False)

 ValueError: The matrix x (= [ 1  0 -1]
 [ 0  1  0]
 [ 0  0  1]) does not define a map from self (= Projective Conic Curve over
 Fraction Field of Univariate Polynomial Ring in t over Rational Field
 defined by 1/2*x^2 + 2*y^2 + 5/2*z^2) to Y (= Projective C
 onic Curve over Fraction Field of Univariate Polynomial Ring in t over
 Rational Field defined by 1/2*x^2 + 2*y^2 + x*z + 3*z^2)
 }}}

--

Comment:

 This is a serious bug in `hom`, giving incorrect information to the user.
 That needs to be fixed, independently of what it means for the
 diagonalization method, and for all fields once and for all. I removed the
 workaround (which only works for certain fields) from the ticket
 description.

 As a temporary workaround: avoid giving `Y` to `hom` in conics, and use
 `diagonal_matrix()` directly instead of `diagonalization()`.

--
Ticket URL: <http://trac.sagemath.org/ticket/19001#comment:3>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to