#4276: [with patch, needs review] move number fields to new coercion, implement
embeddings
----------------------+-----------------------------------------------------
 Reporter:  robertwb  |        Owner:  robertwb  
     Type:  defect    |       Status:  new       
 Priority:  major     |    Milestone:  sage-3.2.2
Component:  coercion  |   Resolution:            
 Keywords:            |  
----------------------+-----------------------------------------------------
Comment (by ncalexan):

 I just discovered _populate_coercion_lists_(embedding=), and I am now a
 lot happier.  (Still not thrilled, because it caches aggressively and if
 you do any arithmetic before changing the embedding it might not take.)

 This is what I want to be able to do:  (The composite fields call needs
 new code of mine, to be posted shortly.)

 {{{
 sage: Q1 = NumberField(x^3 + 2, 'a')
 sage: Q2 = NumberField(x^3 + 3, 'a')
 sage: Q3 = Q1.composite_fields(Q2)[0]
 sage: Q3, Q1_into_Q3, Q2_into_Q3, _ = Q1.composite_fields(Q2,
 both_maps=True)[0]
 sage: Q1._populate_coercion_lists_(embedding=Q1_into_Q3)
 sage: Q2._populate_coercion_lists_(embedding=Q2_into_Q3)
 sage: Q3(Q1.gen())
 2/45*a0^7 + 7/45*a0^4 + 311/45*a0
 sage: Q3(Q2.gen())
 2/45*a0^7 + 7/45*a0^4 + 356/45*a0
 sage: Q1.gen() + Q2.gen()
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)

 /Users/ncalexan/Documents/School/cmvar/cm_field.py in <module>()
 ----> 1
       2
       3
       4
       5

 /Users/ncalexan/sage-3.2.1.alpha1/local/lib/python2.5/site-
 packages/sage/structure/element.so in
 sage.structure.element.ModuleElement.__add__
 (sage/structure/element.c:5721)()
     647
     648
 --> 649
     650
     651

 /Users/ncalexan/sage-3.2.1.alpha1/local/lib/python2.5/site-
 packages/sage/structure/coerce.so in
 sage.structure.coerce.CoercionModel_cache_maps.bin_op
 (sage/structure/coerce.c:5808)()
     695
     696
 --> 697
     698
     699

 TypeError: unsupported operand parent(s) for '+': 'Number Field in a with
 defining polynomial x^3 + 2' and 'Number Field in a with defining
 polynomial x^3 + 3'
 }}}

 I also want to assert an embedding of L into CLF and have the coercion
 model discover that I can convert Q1 -> L -> CLF and Q2 -> L -> CLF.  Then
 we'll be getting somewhere.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4276#comment:29>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of 
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
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