#8327: Implement the universal cyclotomic field, using Zumbroich basis
-----------------------------------------------------+----------------------
Reporter: nthiery | Owner:
Type: enhancement | Status:
needs_work
Priority: major | Milestone: sage-5.0
Component: number fields | Resolution:
Keywords: Cyclotomic field, Zumbroich basis | Work issues:
Report Upstream: N/A | Reviewers:
Authors: Christian Stump, Simon King | Merged in:
Dependencies: #4539 #10771 #7980 | Stopgaps:
-----------------------------------------------------+----------------------
Comment (by stumpc5):
Replying to [comment:95 davidloeffler]:
> Replying to [comment:94 stumpc5]:
> Oh, I don't know, maybe the same behaviour as every other parent object
in the Sage library? The default {{{ __call__ }}} calls {{{
_element_constructor_ }}}, which you should override, in order to create
an element of self from the given arguments. This includes checking
whether the given arguments are reasonable, and raising a !TypeError
otherwise.
The idea is that one should *not* construct elements of the universal
cyclotomic field using {{{UCF(arg)}}} but only through the function
{{{E}}}, e.g., {{{E(5)}}}. So {{{UCF(arg)}}} should only be called for
coercion.
I could overwrite {{{_element_constructor_}}} by
{{{
def _element_constructor_(self,arg):
raise TypeError, "No coercion found for %s"%str(arg)
}}}
This would prevent {{{UCF}}} from ever constructing any element, and only
using the coercion model to coerce objects if possible.
> You should also set the attribute wrapped_class for your element class
to something other than the default (which is "object"), so the {{{
__init__}}} it inherits from !ElementWrapper knows what it's supposed to
be wrapping and doesn't wrap obviously bogus objects as in the examples
above.
Do I see it right that this would then also be obsolete?
> >
> > how can I get a coerce from `CyclotomicField(n)` for all `n`?
> >
>
> I don't quite understand the question, but if you're going to implement
a class and call it "universal cyclotomic field", surely it had better
satisfy a universal property with respect to cyclotomic fields?
Let me define one coercion:
{{{
sage: from sage.rings.number_field.number_field_morphisms import
NumberFieldEmbedding
sage: n = 5
sage: X = CyclotomicField(n)
sage: f = NumberFieldEmbedding(X,UCF,E(n))
sage: UCF.register_coercion(f)
sage: x = X.gen()
sage: UCF(x)
E(5)
}}}
First, how can I register this coercion for all {{{n}}}? Second, are there
further number fields I should have a coercion from?
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8327#comment:96>
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.