Opened 7 years ago
Closed 6 years ago
#13256 closed enhancement (fixed)
abs floor ceil for quadratic number field
Reported by: | vdelecroix | Owned by: | vdelecroix |
---|---|---|---|
Priority: | major | Milestone: | sage-5.11 |
Component: | number fields | Keywords: | absolute value, floor, ceiling, number field, quadratic |
Cc: | mhansen, berocal | Merged in: | sage-5.11.beta0 |
Authors: | Vincent Delecroix | Reviewers: | Frédéric Chapoton |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | #13213 | Stopgaps: |
Description (last modified by )
Implementation of absolute value (abs), floor (floor) and ceiling (ceil) function for elements in quadratic number field.
The implementation uses only manipulation of (mpz) integers.
The function abs depends on the function sign implemented in ticket #13213.
Attachments (2)
Change History (12)
comment:1 Changed 7 years ago by
- Description modified (diff)
- Status changed from new to needs_review
comment:2 follow-up: ↓ 3 Changed 6 years ago by
comment:3 in reply to: ↑ 2 Changed 6 years ago by
Replying to kcrisman:
Does the removal of
K.<a> = NumberField(x^2+1, embedding=CDF.gen())as an example mean that one couldn't use this syntax at all any more?
This syntax is still available. The patch only aims to implement methods abs, floor and ceil for quadratic elements. As an example
sage: K.<sqrt2> = QuadraticField(2) sage: sqrt2.floor() 1
It is yet possible (without the patch) to do
sage: K.<sqrt2> = QuadraticField(2) sage: floor(sqrt2) 1
But there is a simpler and faster way to do it compared to what floor does (using the real interval field with finer and finer approximations). Note that if the method .floor is present, the the function floor will use it!
Would number fields from quadratics not automatically be quadratic fields (when mathematically appropriate, I'm excluding
x^2-1
and the like) and inherit these methods, or would that simply not work now?
Yes, it is the way it is
sage: type(NumberField(x^2 + 1, 'a')) <class 'sage.rings.number_field.number_field.NumberField_quadratic_with_category'>
comment:4 Changed 6 years ago by
- Dependencies changed from #7160, #13213 to #13213
- Description modified (diff)
Changed 6 years ago by
comment:5 Changed 6 years ago by
The patch now takes care of the new doctest framework (ie replace "..." by "....:" for multiline tests).
comment:6 Changed 6 years ago by
I have made a short review patch, with correct links to trac and raise statements.
Changed 6 years ago by
comment:7 follow-up: ↓ 8 Changed 6 years ago by
- Reviewers set to Frédéric Chapoton
- Status changed from needs_review to positive_review
ok, looks good to me. Positive review.
comment:8 in reply to: ↑ 7 Changed 6 years ago by
comment:9 Changed 6 years ago by
- Milestone changed from sage-5.10 to sage-5.11
comment:10 Changed 6 years ago by
- Merged in set to sage-5.11.beta0
- Resolution set to fixed
- Status changed from positive_review to closed
Does the removal of
as an example mean that one couldn't use this syntax at all any more? Would number fields from quadratics not automatically be quadratic fields (when mathematically appropriate, I'm excluding
x^2-1
and the like) and inherit these methods, or would that simply not work now?