trac #15218 first try : divide by K.number_of_roots_of_unity
trac #15218 added the doctest and correct parentheses
Fixed wrong power of species.
More doctests
trac #15793 review patch
trac #15793 final details
fix formula in comment
Trac #15793: Power of species is broken

Here is an example
{{{
    sage: S = species.SetSpecies()
    sage: S^3
    Sum of (Set species) and (Product of (Set species) and (Set
species))
}}}
I'd rather have:
{{{
    Product of (Set species) and (Product of (Set species) and (Set
species))
}}}
The problem was that the binary exponentiation algorithms was reducing
using
{{{operator.add}}} instead of {{{operator.mul}}} !!!

URL: http://trac.sagemath.org/15793
Reported by: hivert
Ticket author(s): Florent Hivert
Reviewer(s): Frédéric Chapoton
Trac #15218: incorrect degree of ring class fields

The degree function returns incorrect answers for ring class fields over
QQ(zeta_3) and QQ(i).

See also [https://groups.google.com/forum/#!topic/sage-nt/FncDnGsdSVI
The second part of this thread on sage-nt, the part with title
"Computing ring class fields"].

{{{
E=EllipticCurve("19a");
s = E.heegner_point(-3,2).ring_class_field().galois_group().complex_conj
ugation()
H=s.domain(); H.absolute_degree()
6
}}}
The output should be 2, since ZZ[sqrt(-3)] has trivial picard group.

The problem is that there is a bug in the degree function for these ring
class fields. The fields themselves seem to be correct.

In the method degree_over_H of the RingClassField class in
sage/schemes/elliptic_curves/heegner.py, the degree is calculated using
the following formula:

{{{
        # Let K_c be the ring class field.  We have by class field
theory that
        #           Gal(K_c / H) = (O_K/c*O_K)^* / (Z/cZ)^*.
}}}

However, one should also divide out by units in `O_K^*` other than {+/-
1}. This explains the factor 3 that the degree function is off for
K=QQ(sqrt(-3)). This is also exactly the difference between equation
(7.27) of Cox's book (Primes of the form ...) and exercise 7.30 of the
same book.

URL: http://trac.sagemath.org/15218
Reported by: mstreng
Ticket author(s): Frédéric Chapoton
Reviewer(s): Peter Bruin