Changes between Version 1 and Version 2 of Ticket #8327, comment 99
 Timestamp:
 04/01/12 14:27:28 (10 years ago)
Legend:
 Unmodified
 Added
 Removed
 Modified

Ticket #8327, comment 99
v1 v2 2 2 3 3 See [http://www.sagemath.org/doc/reference/coercion.html#methodstoimplement]. 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 nonstandard embeddings). 4 5 In 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_}}}.