apply only this patch

• ## sage/modular/modform/constructor.py

```# HG changeset patch
# User Burcin Erocal <burcin@erocal.org>
# Date 1326173110 -3600
# Node ID f5e1f37e26b314c6af1c64519a7d61058b997d59
# Parent  638055501d7553a8f91383ffa97d3262202932db
trac 7160: compare quadratic number field elements using their embedding into CC

diff --git a/sage/modular/modform/constructor.py b/sage/modular/modform/constructor.py```
 a sage: f = M.T(2).charpoly('x'); f x^3 + (-2*zeta6 - 2)*x^2 - 2*zeta6*x + 14*zeta6 - 7 sage: f.factor() (x - 2*zeta6 - 1) * (x - zeta6 - 2) * (x + zeta6 + 1) (x - zeta6 - 2) * (x - 2*zeta6 - 1) * (x + zeta6 + 1) We can also create spaces corresponding to the groups `\Gamma_H(N)` intermediate between `\Gamma_0(N)` and `\Gamma_1(N)`::
• ## sage/modular/modform/eisenstein_submodule.py

`diff --git a/sage/modular/modform/eisenstein_submodule.py b/sage/modular/modform/eisenstein_submodule.py`
 a q + (-zeta6 - 1)*q^2 + (zeta6 + 2)*q^4 + (zeta6 - 5)*q^5 + O(q^6) ] sage: M.eisenstein_subspace().T(2).matrix().fcp() (x + zeta3 + 2) * (x + 2*zeta3 + 1) * (x - 2*zeta3 - 1)^2 * (x - zeta3 - 2)^2 (x + 2*zeta3 + 1) * (x + zeta3 + 2) * (x - zeta3 - 2)^2 * (x - 2*zeta3 - 1)^2 sage: ModularSymbols(e,2).eisenstein_subspace().T(2).matrix().fcp() (x + zeta3 + 2) * (x + 2*zeta3 + 1) * (x - 2*zeta3 - 1)^2 * (x - zeta3 - 2)^2 (x + 2*zeta3 + 1) * (x + zeta3 + 2) * (x - zeta3 - 2)^2 * (x - 2*zeta3 - 1)^2 sage: M.basis() [
• ## sage/modular/modsym/modsym.py

`diff --git a/sage/modular/modsym/modsym.py b/sage/modular/modsym/modsym.py`
 a sage: f = M.T(2).charpoly('x'); f x^4 + (-zeta6 - 1)*x^3 - 8*zeta6*x^2 + (10*zeta6 - 5)*x + 21*zeta6 - 21 sage: f.factor() (x - 2*zeta6 - 1) * (x - zeta6 - 2) * (x + zeta6 + 1)^2 (x - zeta6 - 2) * (x - 2*zeta6 - 1) * (x + zeta6 + 1)^2 We create a space with character over a larger base ring than the values of the character::
• ## sage/rings/arith.py

`diff --git a/sage/rings/arith.py b/sage/rings/arith.py`
 a sage: K. = QuadraticField(-1) sage: factor(122 - 454*i) (-1) * (-3*i - 2) * (-i - 4) * (i + 1)^3 * (-i - 2)^3 (-1) * (-i - 4) * (-3*i - 2) * (-i - 2)^3 * (i + 1)^3 To access the data in a factorization::

`diff --git a/sage/rings/number_field/number_field_element_quadratic.pyx b/sage/rings/number_field/number_field_element_quadratic.pyx`
 a sage: 2+a == a+2 True """ embedding = self.parent().coerce_embedding() if embedding is not None: try: l = embedding(self) return cmp(l, _right) except (TypeError, ValueError), exc: pass cdef NumberFieldElement_quadratic right = _right return not mpz_cmp(self.a, right.a)==0  \ or not mpz_cmp(self.b, right.b)==0  \
• ## sage/schemes/elliptic_curves/ell_number_field.py

`diff --git a/sage/schemes/elliptic_curves/ell_number_field.py b/sage/schemes/elliptic_curves/ell_number_field.py`
 a sage: K. = QuadraticField(-1) sage: EK = EllipticCurve(K,[0,0,0,0,-1]) sage: EK.torsion_points () [(-2 : -3*i : 1), (0 : -i : 1), (1 : 0 : 1), (0 : i : 1), (-2 : 3*i : 1), (0 : 1 : 0)] [(-2 : -3*i : 1), (-2 : 3*i : 1), (0 : -i : 1), (0 : i : 1), (0 : 1 : 0), (1 : 0 : 1)] """ T = self.torsion_subgroup() # make sure it is cached return sorted(T.points())           # these are also cached in T
• ## sage/schemes/elliptic_curves/ell_point.py

`diff --git a/sage/schemes/elliptic_curves/ell_point.py b/sage/schemes/elliptic_curves/ell_point.py`
 a sage: tor = E.torsion_points(); len(tor) 8 sage: [T.order() for T in tor] [4, 2, 4, 2, 4, 2, 4, 1] [2, 4, 4, 2, 1, 2, 4, 4] sage: all([T.is_divisible_by(3) for T in tor]) True sage: Set([T for T in tor if T.is_divisible_by(2)])
• ## sage/schemes/elliptic_curves/heegner.py

`diff --git a/sage/schemes/elliptic_curves/heegner.py b/sage/schemes/elliptic_curves/heegner.py`
 a sage: orb = sorted([g.alpha() for g in G]); orb # random (the sign depends on the database being installed or not) [1, 1/2*sqrt_minus_52 + 1, -1/2*sqrt_minus_52, 1/2*sqrt_minus_52 - 1] sage: [x^2 for x in orb] # this is just for testing [1, sqrt_minus_52 - 12, -13, -sqrt_minus_52 - 12] [-sqrt_minus_52 - 12, -13, 1, sqrt_minus_52 - 12] sage: K5 = heegner_points(389,-52,5).ring_class_field() sage: K1 = heegner_points(389,-52,1).ring_class_field() sage: orb = sorted([g.alpha() for g in G]); orb # random (the sign depends on the database being installed or not) [1, -1/2*sqrt_minus_52, 1/2*sqrt_minus_52 + 1, 1/2*sqrt_minus_52 - 1, 1/2*sqrt_minus_52 - 2, -1/2*sqrt_minus_52 - 2] sage: [x^2 for x in orb] # just for testing [1, -13, sqrt_minus_52 - 12, -sqrt_minus_52 - 12, -2*sqrt_minus_52 - 9, 2*sqrt_minus_52 - 9] [2*sqrt_minus_52 - 9, -2*sqrt_minus_52 - 9, -sqrt_minus_52 - 12, -13, 1, sqrt_minus_52 - 12] """ if self.__alpha is None:
• ## sage/stats/basic_stats.py

`diff --git a/sage/stats/basic_stats.py b/sage/stats/basic_stats.py`
 a sage: std([]) NaN sage: std([I, sqrt(2), 3/5]) sqrt(1/450*(-5*sqrt(2) + 10*I - 3)^2 + 1/450*(-5*sqrt(2) - 5*I + 6)^2 + 1/450*(10*sqrt(2) - 5*I - 3)^2) sqrt(1/450*(5*sqrt(2) + 5*I - 6)^2 + 1/450*(5*sqrt(2) - 10*I + 3)^2 + 1/450*(10*sqrt(2) - 5*I - 3)^2) sage: std([RIF(1.0103, 1.0103), RIF(2)]) 0.6998235813403261? sage: import numpy sage: variance([]) NaN sage: variance([I, sqrt(2), 3/5]) 1/450*(-5*sqrt(2) + 10*I - 3)^2 + 1/450*(-5*sqrt(2) - 5*I + 6)^2 + 1/450*(10*sqrt(2) - 5*I - 3)^2 1/450*(5*sqrt(2) + 5*I - 6)^2 + 1/450*(5*sqrt(2) - 10*I + 3)^2 + 1/450*(10*sqrt(2) - 5*I - 3)^2 sage: variance([RIF(1.0103, 1.0103), RIF(2)]) 0.4897530450000000? sage: import numpy