Ticket #7160: trac_7160-quadratic_number_field_element_comparison.patch

File trac_7160-quadratic_number_field_element_comparison.patch, 6.9 KB (added by mhansen, 9 years ago)

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 b  
    214214        sage: f = M.T(2).charpoly('x'); f
    215215        x^3 + (-2*zeta6 - 2)*x^2 - 2*zeta6*x + 14*zeta6 - 7
    216216        sage: f.factor()
    217         (x - 2*zeta6 - 1) * (x - zeta6 - 2) * (x + zeta6 + 1)
     217        (x - zeta6 - 2) * (x - 2*zeta6 - 1) * (x + zeta6 + 1)
    218218   
    219219    We can also create spaces corresponding to the groups `\Gamma_H(N)` intermediate
    220220    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 b  
    543543        q + (-zeta6 - 1)*q^2 + (zeta6 + 2)*q^4 + (zeta6 - 5)*q^5 + O(q^6)
    544544        ]
    545545        sage: M.eisenstein_subspace().T(2).matrix().fcp()
    546         (x + zeta3 + 2) * (x + 2*zeta3 + 1) * (x - 2*zeta3 - 1)^2 * (x - zeta3 - 2)^2
     546        (x + 2*zeta3 + 1) * (x + zeta3 + 2) * (x - zeta3 - 2)^2 * (x - 2*zeta3 - 1)^2
    547547        sage: ModularSymbols(e,2).eisenstein_subspace().T(2).matrix().fcp()
    548         (x + zeta3 + 2) * (x + 2*zeta3 + 1) * (x - 2*zeta3 - 1)^2 * (x - zeta3 - 2)^2
     548        (x + 2*zeta3 + 1) * (x + zeta3 + 2) * (x - zeta3 - 2)^2 * (x - 2*zeta3 - 1)^2
    549549
    550550        sage: M.basis()
    551551        [
  • sage/modular/modsym/modsym.py

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

    diff --git a/sage/rings/arith.py b/sage/rings/arith.py
    a b  
    23402340
    23412341        sage: K.<i> = QuadraticField(-1)
    23422342        sage: factor(122 - 454*i)
    2343         (-1) * (-3*i - 2) * (-i - 4) * (i + 1)^3 * (-i - 2)^3
     2343        (-1) * (-i - 4) * (-3*i - 2) * (-i - 2)^3 * (i + 1)^3
    23442344
    23452345    To access the data in a factorization::
    23462346   
  • sage/rings/number_field/number_field_element_quadratic.pyx

    diff --git a/sage/rings/number_field/number_field_element_quadratic.pyx b/sage/rings/number_field/number_field_element_quadratic.pyx
    a b  
    921921            sage: 2+a == a+2
    922922            True
    923923        """
     924        embedding = self.parent().coerce_embedding()
     925        if embedding is not None:
     926            try:
     927                l = embedding(self)
     928                return cmp(l, _right)
     929            except (TypeError, ValueError), exc:
     930                pass
    924931        cdef NumberFieldElement_quadratic right = _right
    925932        return not mpz_cmp(self.a, right.a)==0  \
    926933            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 b  
    16071607            sage: K.<i> = QuadraticField(-1)
    16081608            sage: EK = EllipticCurve(K,[0,0,0,0,-1])
    16091609            sage: EK.torsion_points ()
    1610             [(-2 : -3*i : 1), (0 : -i : 1), (1 : 0 : 1), (0 : i : 1), (-2 : 3*i : 1), (0 : 1 : 0)]
     1610            [(-2 : -3*i : 1), (-2 : 3*i : 1), (0 : -i : 1), (0 : i : 1), (0 : 1 : 0), (1 : 0 : 1)]
    16111611         """
    16121612        T = self.torsion_subgroup() # make sure it is cached
    16131613        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 b  
    831831            sage: tor = E.torsion_points(); len(tor)
    832832            8
    833833            sage: [T.order() for T in tor]
    834             [4, 2, 4, 2, 4, 2, 4, 1]
     834            [2, 4, 4, 2, 1, 2, 4, 4]
    835835            sage: all([T.is_divisible_by(3) for T in tor])
    836836            True
    837837            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 b  
    14341434            sage: orb = sorted([g.alpha() for g in G]); orb # random (the sign depends on the database being installed or not)
    14351435            [1, 1/2*sqrt_minus_52 + 1, -1/2*sqrt_minus_52, 1/2*sqrt_minus_52 - 1]
    14361436            sage: [x^2 for x in orb] # this is just for testing
    1437             [1, sqrt_minus_52 - 12, -13, -sqrt_minus_52 - 12]
     1437            [-sqrt_minus_52 - 12, -13, 1, sqrt_minus_52 - 12]
    14381438
    14391439            sage: K5 = heegner_points(389,-52,5).ring_class_field()
    14401440            sage: K1 = heegner_points(389,-52,1).ring_class_field()
     
    14421442            sage: orb = sorted([g.alpha() for g in G]); orb # random (the sign depends on the database being installed or not)
    14431443            [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]
    14441444            sage: [x^2 for x in orb] # just for testing
    1445             [1, -13, sqrt_minus_52 - 12, -sqrt_minus_52 - 12, -2*sqrt_minus_52 - 9, 2*sqrt_minus_52 - 9]
     1445            [2*sqrt_minus_52 - 9, -2*sqrt_minus_52 - 9, -sqrt_minus_52 - 12, -13, 1, sqrt_minus_52 - 12]
    14461446
    14471447        """
    14481448        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 b  
    165165        sage: std([])
    166166        NaN
    167167        sage: std([I, sqrt(2), 3/5])
    168         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)
     168        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)
    169169        sage: std([RIF(1.0103, 1.0103), RIF(2)])
    170170        0.6998235813403261?
    171171        sage: import numpy
     
    230230        sage: variance([])                     
    231231        NaN
    232232        sage: variance([I, sqrt(2), 3/5])       
    233         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
     233        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
    234234        sage: variance([RIF(1.0103, 1.0103), RIF(2)])
    235235        0.4897530450000000?
    236236        sage: import numpy