Changes between Initial Version and Version 1 of Ticket #8327, comment 99


Ignore:
Timestamp:
04/01/12 14:27:12 (10 years ago)
Author:
davidloeffler
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #8327, comment 99

    initial v1  
    11I'm sorry, please pardon my earlier outburst -- it was uncalled for, your message just caught me at a bad time.
    22
    3 See [http://www.sagemath.org/doc/reference/coercion.html#methods-to-implement]. The magic routines here are {{{ _element_constructor_}}} and {{{ _coerce_map_from_ }}}.
     3See [http://www.sagemath.org/doc/reference/coercion.html#methods-to-implement]. The magic routines here are {{{ _element_constructor_}}} and {{{ _coerce_map_from_ }}}. In this case, you can make {{{ UCF._coerce_map_from_(K) }}} return the natural morphism from K to self whenever K is a cyclotomic field (but you need to watch out for cyclotomic fields with non-standard embeddings).
    44
    55In practice I find it is easiest to make {{{ _element_constructor_ }}} always return either True or False; if it returns True, then when necessary the coercion framework will just call {{{ _element_constructor_ }}} and assume that this has the extra properties a coercion is required to have (i.e. all diagrams commute modulo numerical precision). Any actual work required to convert elements of other parents can then be handled by {{{ _element_constructor_}}}.