Skip to content

abs floor ceil for quadratic number field #13256

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
videlec opened this issue Jul 14, 2012 · 13 comments
Closed

abs floor ceil for quadratic number field #13256

videlec opened this issue Jul 14, 2012 · 13 comments

Comments

@videlec
Copy link
Contributor

videlec commented Jul 14, 2012

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.

Depends on #13213

CC: @mwhansen @burcin

Component: number fields

Keywords: absolute value, floor, ceiling, quadratic

Author: Vincent Delecroix

Reviewer: Frédéric Chapoton

Merged: sage-5.11.beta0

Issue created by migration from https://trac.sagemath.org/ticket/13256

@videlec videlec added this to the sage-5.10 milestone Jul 14, 2012
@videlec videlec self-assigned this Jul 14, 2012
@videlec

This comment has been minimized.

@kcrisman
Copy link
Member

comment:2

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? 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?

@videlec
Copy link
Contributor Author

videlec commented May 10, 2013

comment:3

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'>

@videlec
Copy link
Contributor Author

videlec commented May 10, 2013

Changed dependencies from #7160, #13213 to #13213

@videlec

This comment has been minimized.

@videlec
Copy link
Contributor Author

videlec commented May 18, 2013

@videlec
Copy link
Contributor Author

videlec commented May 18, 2013

comment:5

The patch now takes care of the new doctest framework (ie replace "..." by "....:" for multiline tests).

@fchapoton
Copy link
Contributor

comment:6

I have made a short review patch, with correct links to trac and raise statements.

@fchapoton
Copy link
Contributor

Attachment: trac_13256_details-review.patch.gz

@fchapoton
Copy link
Contributor

Reviewer: Frédéric Chapoton

@fchapoton
Copy link
Contributor

comment:7

ok, looks good to me. Positive review.

@videlec
Copy link
Contributor Author

videlec commented May 31, 2013

comment:8

Replying to @fchapoton:

ok, looks good to me. Positive review.

Cool. Thanks Frédéric.

@jdemeyer jdemeyer modified the milestones: sage-5.10, sage-5.11 Jun 3, 2013
@jdemeyer
Copy link
Contributor

jdemeyer commented Jun 6, 2013

Merged: sage-5.11.beta0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants