#12269: coercion and conversion for absolute_field
-----------------------------+----------------------------------------------
   Reporter:  mstreng        |          Owner:  davidloeffler                   
                                           
       Type:  defect         |         Status:  new                             
                                           
   Priority:  major          |      Milestone:  sage-5.0                        
                                           
  Component:  number fields  |       Keywords:  coercion conversion 
absolute_field number field structure relative absolute
Work_issues:                 |       Upstream:  N/A                             
                                           
   Reviewer:                 |         Author:                                  
                                           
     Merged:                 |   Dependencies:                                  
                                           
-----------------------------+----------------------------------------------
Description changed by mstreng:

Old description:

> {{{
> sage: x = var('x')
> sage: K1.<a1> = CyclotomicField(11)
> sage: K2.<a2> = K1.extension(x^2 - 3)
> sage: K3.<a3> = K2.extension(x^2 + 1) # Let's make a big relative number
> field
> sage: t=a1+6*a2+a3*a1                 # with a complicated element.
> sage: L = K3.absolute_field('b')
> sage: L(t)
> # The code at #11869 takes 12 seconds to compute roots of a
> # polynomial, and then doesn't use them.
> # TypeError: No compatible natural embeddings found for Number Field in b
> with .... and Complex Lazy Field
> sage: L.structure()                   # However, the correct conversion
> map is available and works almost instantly
> #(Isomorphism map:... , Isomorphism map: ...)
> sage: L.structure()[1](t)
> # big output
> sage: L.gen() + t                     # It would be good if one of the
> structure maps is a coercion, but they aren't at the moment
> # TypeError: unsupported operand parent(s) for '+': ....
> sage: K3(L.gen())                     # There are similar problems in the
> other direction
> # TypeError: Cannot coerce element into this number field
> sage: L.structure()[0](L.gen())       # for which the structure maps also
> work.
> # a3 - a2 + a1
> }}}
>
> So to do:
>
>  * make both structure maps into conversions
>  * make one of the structure maps into a coercion
>  * move the "compatible embedding" code of #12186 to the beginning of the
> method, to avoid unnecessary root-finding
>
> I guess the third item is unrelated to the first two, so could be a
> separate ticket.

New description:

 {{{
 sage: x = var('x')
 sage: K1.<a1> = CyclotomicField(11)
 sage: K2.<a2> = K1.extension(x^2 - 3)
 sage: K3.<a3> = K2.extension(x^2 + 1) # Let's make a big relative number
 field
 sage: t=a1+6*a2+a3*a1                 # with a complicated element.
 sage: L = K3.absolute_field('b')
 sage: L(t)
 # The code at #11800 takes 12 seconds to compute roots of a
 # polynomial, and then doesn't use them.
 # TypeError: No compatible natural embeddings found for Number Field in b
 with .... and Complex Lazy Field
 sage: L.structure()                   # However, the correct conversion
 map is available and works almost instantly
 #(Isomorphism map:... , Isomorphism map: ...)
 sage: L.structure()[1](t)
 # big output
 sage: L.gen() + t                     # It would be good if one of the
 structure maps is a coercion, but they aren't at the moment
 # TypeError: unsupported operand parent(s) for '+': ....
 sage: K3(L.gen())                     # There are similar problems in the
 other direction
 # TypeError: Cannot coerce element into this number field
 sage: L.structure()[0](L.gen())       # for which the structure maps also
 work.
 # a3 - a2 + a1
 }}}

 So to do:

  * make both structure maps into conversions
  * make one of the structure maps into a coercion
  * move the "compatible embedding" code of #11800 to the beginning of the
 method, to avoid unnecessary root-finding

 I guess the third item is unrelated to the first two, so could be a
 separate ticket.

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12269#comment:1>
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