# Changes between Version 17 and Version 20 of Ticket #13213

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

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 The order of number field with specified embedding is not induced from the order of RR and CC. More precisely we have The order of quadratic field with specified embedding is not induced from the order of RR and CC. More precisely we have {{{ sage: K. = NumberField(x^2 - 2, 'sqrt2', embedding=1.4142) which is not compatible (!) with the order of CC. 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). The ticket implements the order for quadratic field (for which comparisons are made using only operations on integers). Note: * this patch is partly a duplicate because of #7160 * the modifications for quadratic field field modify the behavior of many commands (especially about output order). * the patch introduces a new attribute to NumberFieldElement_quadratic called standard_embedding (of type bint) ---- The lost of speed is about x10 for quadratic field and about x100 for generic real number field. There is no significant lost of speed as shown on the following timings. {{{ sage: K. = QuadraticField(2, 'sqrt2', embedding=1.4142) sage: b = (5*sqrt2 + 14)/5 sage: %timeit a < b 625 loops, best of 3: 4.32 µs per loop 1000000 loops, best of 3: 408 ns per loop sage: K. = QuadraticField(-2) sage: b = 5/7*s + 1/3 sage: %timeit a < b 625 loops, best of 3: 1.42 µs per loop sage: K. = NumberField(x^3-3, 's', embedding=1.26) sage: a = 3/15*s**2 - 4/7*s + 2/3 sage: b = -1/2*s**2 + s - 13/5 sage: %timeit a < b 625 loops, best of 3: 49.6 µs per loop 1000000 loops, best of 3: 352 ns per loop }}} Timings without the patch sage: b = (5*sqrt2 + 14)/5 sage: %timeit a < b 625 loops, best of 3: 491 ns per loop 1000000 loops, best of 3: 393 ns per loop sage: K. = QuadraticField(-2) sage: b = 5/7*s+1/3 sage: %timeit a < b 625 loops, best of 3: 488 ns per loop 1000000 loops, best of 3: 344 ns per loop }}} sage: K.=NumberField(x^3-3, 's',embedding=1.26) sage: a = 3/15*s**2 - 4/7*s + 2/3 sage: b = -1/2*s**2 + s - 13/5 sage: %timeit a < b 625 loops, best of 3: 845 ns per loop }}} Apply: * trac_13213-quadratic_field_comparison.patch