Changes between Version 9 and Version 17 of Ticket #13213


Ignore:
Timestamp:
08/08/12 15:31:40 (7 years ago)
Author:
vdelecroix
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #13213

    • Property Status changed from needs_work to needs_review
  • Ticket #13213 – Description

    v9 v17  
    1 The order of quadratic field is not induced from the order of RR and CC (when there is an embedding). More precisely we have
     1The order of number field with specified embedding is not induced from the order of RR and CC. More precisely we have
    22{{{
    33sage: K.<sqrt2> = NumberField(x^2 - 2, 'sqrt2', embedding=1.4142)
    44sage: sqrt2 < 100
     5False
     6
     7sage: K.<s> = NumberField(x^3 - 2, 's', embedding=1.26)
     8sage: s < 100
    59False
    610}}}
     
    1519which is not compatible (!) with the order of CC.
    1620
    17 There is a patch for quadratic field. Another will come for general number fields. Note that this patch is partly a duplicate because of #7160. The modifications for the order on complex number field modify the behavior of many commands (output order).
     21The ticket implements the order for quadratic field (for which comparisons are made using only operations on integers) and a patch for generic number fields with specified real embedding (for which comparisons are made using successive approximations).
    1822
    19 The lost of speed is about x5 for positive discriminant and almost nothing for negative ones
     23Note:
     24* this patch is partly a duplicate because of #7160
     25* the modifications for quadratic field field modify the behavior of many commands (especially about output order).
     26
     27----
     28
     29The lost of speed is about x10 for quadratic field and about x100 for generic real number field.
    2030{{{
    21 sage: K.<sqrt2> = QuadraticField(2,'sqrt2',embedding=1.4142)
     31sage: K.<sqrt2> = QuadraticField(2, 'sqrt2', embedding=1.4142)
    2232sage: a = (3*sqrt2 + 18)/7
    2333sage: b = (5*sqrt2 + 14)/5
    2434sage: %timeit a < b
    25 625 loops, best of 3: 2.36 µs per loop
     35625 loops, best of 3: 4.32 µs per loop
    2636
    2737sage: K.<s> = QuadraticField(-2)
    28 sage: a=3*s+2/4
    29 sage: b=5/7*s+1/3
     38sage: a = 3*s + 2/4
     39sage: b = 5/7*s + 1/3
    3040sage: %timeit a < b
    31 625 loops, best of 3: 600 ns per loop
     41625 loops, best of 3: 1.42 µs per loop
     42
     43sage: K.<s> = NumberField(x^3-3, 's', embedding=1.26)
     44sage: a = 3/15*s**2 - 4/7*s + 2/3
     45sage: b = -1/2*s**2 + s - 13/5
     46sage: %timeit a < b
     47625 loops, best of 3: 49.6 µs per loop
    3248}}}
    3349Timings without the patch
     
    4056
    4157sage: K.<s> = QuadraticField(-2)
    42 sage: a=3*s+2/4
    43 sage: b=5/7*s+1/3
     58sage: a = 3*s+2/4
     59sage: b = 5/7*s+1/3
    4460sage: %timeit a < b
    4561625 loops, best of 3: 488 ns per loop
     62
     63sage: K.<s>=NumberField(x^3-3, 's',embedding=1.26)
     64sage: a = 3/15*s**2 - 4/7*s + 2/3
     65sage: b = -1/2*s**2 + s - 13/5
     66sage: %timeit a < b
     67625 loops, best of 3: 845 ns per loop
    4668}}}