#813: forced coercion vs. automatic coercion
------------------------+---------------------------------------------------
   Reporter:  nbruin    |          Owner:  roed        
       Type:  defect    |         Status:  needs_review
   Priority:  major     |      Milestone:  sage-4.7.1  
  Component:  coercion  |       Keywords:              
Work_issues:            |       Upstream:  N/A         
   Reviewer:            |         Author:  Simon King  
     Merged:            |   Dependencies:  #9944       
------------------------+---------------------------------------------------
Changes (by newvalueoldvalue):

  * status:  new => needs_review
  * dependencies:  => #9944
  * author:  => Simon King


Comment:

 I think I was able to solve the problem. With my patch applied on top of
 sage-4.7.1.rc1, all tests seem to pass, and one can do
 {{{
             sage: P = QQ['x','y']
             sage: Q = Frac(QQ['x'])['y']
             sage: Q.has_coerce_map_from(P)
             True
             sage: P.0+Q.0
             y + x
 }}}

 In order to avoid bidirectional coercions (that would break a lot of
 tests), I have
 {{{
             sage: Q = QQ['x']['y']
             sage: Q.has_coerce_map_from(P)
             False
             sage: Q.base_ring() is P.remove_var(Q.variable_name())
             True
 }}}

 The rule is: If `Q.base_ring() is P.remove_var(Q.variable_name())` then
 there can not be a coercion from the multivariate ring P to the univariate
 ring Q; in fact, there is a coercion in the opposite direction. But
 otherwise, there is a coercion if `Q.base_ring()` has a coercion from
 `P.remove_var(Q.variable_name())`.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/813#comment:12>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to