#11770: Add ability to detect CM number fields and take complex conjugate of
their
elements
------------------------------+---------------------------------------------
Reporter: robharron | Owner: tba
Type: enhancement | Status: needs_work
Priority: minor | Milestone: sage-4.7.2
Component: number fields | Keywords: CM field
Work_issues: | Upstream: N/A
Reviewer: Francis Clarke | Author: Robert Harron
Merged: | Dependencies:
------------------------------+---------------------------------------------
Changes (by fwclarke):
* status: needs_review => needs_work
* reviewer: => Francis Clarke
Comment:
This is a useful enhancement which seems to work well. I have one
suggestion for improving the code and a few minor niggles.
It seems to me that rather than computing the conjugate of elements of a
CM field by doing a separate calculation for each element, it would be
better to define the conjugation automorphism of the field. The following
draft code seems to do the job:
{{{
def conjugation(self):
"""
Returns the conjugation automorphism for a CM field.
"""
if self.is_absolute():
K = self
else:
K = self.absolute_field('z')
phi = [phi for F, phi, _ in K.subfields(K.degree()/2) if
F.is_totally_real()][0]
K_rel = K.relativize(phi, 'z')
z0 = K_rel.gen()
z0_conj = -z0 - K_rel.defining_polynomial()[1]
z0_conj_abs = K_rel.structure()[0](z0_conj)
if self.is_absolute():
return End(self)([z0_conj_abs])
else:
return End(self)(K.hom([K.structure()[0](z0_conj_abs)]))
}}}
The above draft is, of course, lacking
* doctests,
* caching,
* checking that `self` is indeed a CM field, and
* dealing with the special cases of totally real, quadratic and
cyclotomic fields.
If `conjugation` is defined, `conjugate` could be defined as:
{{{
def conjugate(self):
return self.parent().conjugation()(self)
}}}
A number of other, minor things:
In the docstring for `is_CM`
{{{
The following is a non-cyclotomic CM field.
::
sage: M.<a> = NumberField(x^4 - x^3 + x^2 - x + 1)
}}}
the wording is a bit misleading since `M` is (isomorphic to) a cyclotomic
field.
The lines
{{{
sage: P.<y> = PolynomialRing(E_0)
sage: E.<b> = E_0.extension(P(y^2 + 1))
}}}
can be more simply written as
{{{
sage: E.<b> = E_0.extension(x^2 + 1)
}}}
Similarly for the `K.<j>` example in `conjugate`
In the code for `is_CM`, the lines
{{{
try:
return self.__is_CM
except:
pass
}}}
ought to be
{{{
try:
return self.__is_CM
except Attribute_Error:
pass
}}}
see
[http://www.sagemath.org/doc/developer/coding_in_python.html#exceptions
Developer's Guide].
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11770#comment:2>
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.