Changes between Version 17 and Version 20 of Ticket #13213
- Timestamp:
- 05/10/13 09:42:07 (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #13213
-
Property
Summary
changed from
Comparisons in real number field
toComparisons in quadratic number field
-
Property
Summary
changed from
-
Ticket #13213 – Description
v17 v20 1 The order of numberfield with specified embedding is not induced from the order of RR and CC. More precisely we have1 The order of quadratic 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) … … 19 19 which is not compatible (!) with the order of CC. 20 20 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).21 The ticket implements the order for quadratic field (for which comparisons are made using only operations on integers). 22 22 23 23 Note: 24 24 * this patch is partly a duplicate because of #7160 25 25 * 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) 26 27 27 28 ---- 28 29 29 The lost of speed is about x10 for quadratic field and about x100 for generic real number field.30 There is no significant lost of speed as shown on the following timings. 30 31 {{{ 31 32 sage: K.<sqrt2> = QuadraticField(2, 'sqrt2', embedding=1.4142) … … 33 34 sage: b = (5*sqrt2 + 14)/5 34 35 sage: %timeit a < b 35 625 loops, best of 3: 4.32 µs per loop36 1000000 loops, best of 3: 408 ns per loop 36 37 37 38 sage: K.<s> = QuadraticField(-2) … … 39 40 sage: b = 5/7*s + 1/3 40 41 sage: %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 42 1000000 loops, best of 3: 352 ns per loop 48 43 }}} 49 44 Timings without the patch … … 53 48 sage: b = (5*sqrt2 + 14)/5 54 49 sage: %timeit a < b 55 625 loops, best of 3: 491ns per loop50 1000000 loops, best of 3: 393 ns per loop 56 51 57 52 sage: K.<s> = QuadraticField(-2) … … 59 54 sage: b = 5/7*s+1/3 60 55 sage: %timeit a < b 61 625 loops, best of 3: 488 ns per loop 56 1000000 loops, best of 3: 344 ns per loop 57 }}} 62 58 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 }}} 59 Apply: 60 61 * trac_13213-quadratic_field_comparison.patch