Changes between Version 9 and Version 17 of Ticket #13213
- Timestamp:
- 08/08/12 15:31:40 (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #13213
-
Property
Status
changed from
needs_work
toneeds_review
-
Property
Status
changed from
-
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 have1 The order of number field with specified embedding is not induced from the order of RR and CC. More precisely we have 2 2 {{{ 3 3 sage: K.<sqrt2> = NumberField(x^2 - 2, 'sqrt2', embedding=1.4142) 4 4 sage: sqrt2 < 100 5 False 6 7 sage: K.<s> = NumberField(x^3 - 2, 's', embedding=1.26) 8 sage: s < 100 5 9 False 6 10 }}} … … 15 19 which is not compatible (!) with the order of CC. 16 20 17 The re 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).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). 18 22 19 The lost of speed is about x5 for positive discriminant and almost nothing for negative ones 23 Note: 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 29 The lost of speed is about x10 for quadratic field and about x100 for generic real number field. 20 30 {{{ 21 sage: K.<sqrt2> = QuadraticField(2, 'sqrt2',embedding=1.4142)31 sage: K.<sqrt2> = QuadraticField(2, 'sqrt2', embedding=1.4142) 22 32 sage: a = (3*sqrt2 + 18)/7 23 33 sage: b = (5*sqrt2 + 14)/5 24 34 sage: %timeit a < b 25 625 loops, best of 3: 2.36µs per loop35 625 loops, best of 3: 4.32 µs per loop 26 36 27 37 sage: K.<s> = QuadraticField(-2) 28 sage: a =3*s+2/429 sage: b =5/7*s+1/338 sage: a = 3*s + 2/4 39 sage: b = 5/7*s + 1/3 30 40 sage: %timeit a < b 31 625 loops, best of 3: 600 ns per loop 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 32 48 }}} 33 49 Timings without the patch … … 40 56 41 57 sage: K.<s> = QuadraticField(-2) 42 sage: a =3*s+2/443 sage: b =5/7*s+1/358 sage: a = 3*s+2/4 59 sage: b = 5/7*s+1/3 44 60 sage: %timeit a < b 45 61 625 loops, best of 3: 488 ns per loop 62 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 46 68 }}}