Changes between Version 17 and Version 20 of Ticket #13213


Ignore:
Timestamp:
05/10/13 09:42:07 (6 years ago)
Author:
vdelecroix
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #13213

    • Property Summary changed from Comparisons in real number field to Comparisons in quadratic number field
  • Ticket #13213 – Description

    v17 v20  
    1 The order of number field with specified embedding is not induced from the order of RR and CC. More precisely we have
     1The order of quadratic 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)
     
    1919which is not compatible (!) with the order of CC.
    2020
    21 The 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).
     21The ticket implements the order for quadratic field (for which comparisons are made using only operations on integers).
    2222
    2323Note:
    2424* this patch is partly a duplicate because of #7160
    2525* the modifications for quadratic field field modify the behavior of many commands (especially about output order).
     26* the patch introduces a new attribute to NumberFieldElement_quadratic called standard_embedding (of type bint)
    2627
    2728----
    2829
    29 The lost of speed is about x10 for quadratic field and about x100 for generic real number field.
     30There is no significant lost of speed as shown on the following timings.
    3031{{{
    3132sage: K.<sqrt2> = QuadraticField(2, 'sqrt2', embedding=1.4142)
     
    3334sage: b = (5*sqrt2 + 14)/5
    3435sage: %timeit a < b
    35 625 loops, best of 3: 4.32 µs per loop
     361000000 loops, best of 3: 408 ns per loop
    3637
    3738sage: K.<s> = QuadraticField(-2)
     
    3940sage: b = 5/7*s + 1/3
    4041sage: %timeit a < b
    41 625 loops, best of 3: 1.42 µs per loop
    42 
    43 sage: K.<s> = NumberField(x^3-3, 's', embedding=1.26)
    44 sage: a = 3/15*s**2 - 4/7*s + 2/3
    45 sage: b = -1/2*s**2 + s - 13/5
    46 sage: %timeit a < b
    47 625 loops, best of 3: 49.6 µs per loop
     421000000 loops, best of 3: 352 ns per loop
    4843}}}
    4944Timings without the patch
     
    5348sage: b = (5*sqrt2 + 14)/5
    5449sage: %timeit a < b
    55 625 loops, best of 3: 491 ns per loop
     501000000 loops, best of 3: 393 ns per loop
    5651
    5752sage: K.<s> = QuadraticField(-2)
     
    5954sage: b = 5/7*s+1/3
    6055sage: %timeit a < b
    61 625 loops, best of 3: 488 ns per loop
     561000000 loops, best of 3: 344 ns per loop
     57}}}
    6258
    63 sage: K.<s>=NumberField(x^3-3, 's',embedding=1.26)
    64 sage: a = 3/15*s**2 - 4/7*s + 2/3
    65 sage: b = -1/2*s**2 + s - 13/5
    66 sage: %timeit a < b
    67 625 loops, best of 3: 845 ns per loop
    68 }}}
     59Apply:
     60
     61* trac_13213-quadratic_field_comparison.patch