Skip to content
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

points_of_bounded_height for projective space is incorrect #32686

Closed
bhutz opened this issue Oct 13, 2021 · 102 comments
Closed

points_of_bounded_height for projective space is incorrect #32686

bhutz opened this issue Oct 13, 2021 · 102 comments

Comments

@bhutz
Copy link
Contributor

bhutz commented Oct 13, 2021

The method for number fields iterates over the points of bounded height for each coordinate. This includes all the appropriate points, but includes some other points that are larger than the specified bound.

B=3
K.<v>=QuadraticField(3)
P.<x,y,z>=ProjectiveSpace(K,2)
for Q in P.points_of_bounded_height(bound=B):
    if exp(Q.global_height()) > B+0.001:
        print(Q,exp(Q.global_height()))

See also #31400

Depends on #34212

CC: @pfili @EnderWannabe @bhutz

Component: algebraic geometry

Keywords: gsoc2022

Author: Jing Guo

Branch/Commit: c053c2a

Reviewer: Alexander Galarraga, Ben Hutz

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

@bhutz bhutz added this to the sage-9.5 milestone Oct 13, 2021
@bhutz
Copy link
Contributor Author

bhutz commented Oct 13, 2021

comment:1

The simplest fix here is probably to check the height before yielding the point. This is not efficient, but would yield correct results, since every correct point does occur in this method.

If I don't hear another suggestion before I have time to fix this, I'll implement that (hopefully in the next week or two).

@bhutz bhutz self-assigned this Oct 13, 2021
@EnderWannabe
Copy link
Contributor

comment:3

There is a paper on by David Krumm on the topic (https://arxiv.org/pdf/1403.6501.pdf). He says in Section 7 that he implemented his algorithm in Sage for demonstration purposes. I'll write to him to ask for the code, and then perhaps we can fit his algorithm into Sage.

It might be worth it to implement a temporary fix in the mean time.

@bhutz
Copy link
Contributor Author

bhutz commented Nov 4, 2021

comment:4

The Doyle-Krumm algorithm for points of bounded height in number fields is what is implemented in Sage for number field elements. The issue here is that the points of bounded height in projective space is simply taking the bound for each coordinate and that returns some points with too large a height. I don't think Doyle-Krumm address points in projective space in their paper.

@EnderWannabe
Copy link
Contributor

comment:5

The above paper isn't Doyle Krumm 2011, it's a follow up paper - Krumm 2014. It seems to be about projective space specifically, as it is titled "Computing Points of Bounded Height in Projective Space over a Number Field."

@bhutz
Copy link
Contributor Author

bhutz commented Nov 4, 2021

comment:6

Sorry, you're right, I had the wrong paper. Taking a quick look, I think we should fix the "wrong" output problem with the simple fix here and then make an enhancement ticket to run the faster algorithm from David.

@EnderWannabe
Copy link
Contributor

Branch: u/gh-EnderWannabe/32686

@EnderWannabe
Copy link
Contributor

comment:8

I agree, the algorithm from Krumm will take some time. He sent me his code - which at first glance works beautifully - so the majority of the work will be to write documentation and review the changes.

I've pushed a branch with the quick fix.


New commits:

e80d04232686: added check to height of point before yielding + test

@EnderWannabe
Copy link
Contributor

Commit: e80d042

@bhutz
Copy link
Contributor Author

bhutz commented Nov 5, 2021

comment:10

Shouldn't this be <= in the check?

btw, can you send me the Krumm code (off-line).

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 5, 2021

Changed commit from e80d042 to a753459

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 5, 2021

Branch pushed to git repo; I updated commit sha1. New commits:

a75345932686: fixed inequality

@EnderWannabe
Copy link
Contributor

Author: Alexander Galarraga

@bhutz
Copy link
Contributor Author

bhutz commented Nov 5, 2021

comment:13

This looks fine. Let's let the patchbot pick it up for the full library test.

@bhutz
Copy link
Contributor Author

bhutz commented Nov 5, 2021

comment:14

There are at least a couple doc test errors. Here is one.

File "src/sage/schemes/projective/projective_rational_point.py", line 190, in sage.schemes.projective.projective_rational_point.enum_projective_number_field
Failed example:
    enum_projective_number_field(X(K), bound=RR(5^(1/3)), prec=2^10)
Expected:
    [(0 : 0 : 1), (-1 : -1 : 1), (1 : 1 : 1), (-1/5*v^2 : -1/5*v^2 : 1), (-v : -v : 1),
    (1/5*v^2 : 1/5*v^2 : 1), (v : v : 1), (1 : 1 : 0)]
Got:
    [(0 : 0 : 1),
     (-1 : -1 : 1),
     (1 : 1 : 1),
     (-1/5*v^2 : -1/5*v^2 : 1),
     (1/5*v^2 : 1/5*v^2 : 1),
     (1 : 1 : 0)]

I think the new result is the one that is wrong with those two points having height exactly equal to the bound. Please double check.

@bhutz
Copy link
Contributor Author

bhutz commented Nov 5, 2021

comment:15

Do you need to pass prec to the global_height call as this is probably a numerical issue somewhere...

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 7, 2021

Changed commit from a753459 to e39611d

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 7, 2021

Branch pushed to git repo; I updated commit sha1. New commits:

e39611d32686: changed check on global height before yielding

@EnderWannabe
Copy link
Contributor

comment:17

I think you are right. Taking a look at the point (v : v : 1), we have

sage: X(P([v,v,1])).global_height() - log((RR(5^(1/3))))
1.11022302462516e-16

I think the right fix here is not to just check inequality, but to also check that the difference between the bounds is less than tolerance? Taking a look at the documentation for the points of bounded height function on number fields, it seems to yield all points that are within the tolerance, so maybe we should too.

I think the error in projective_homset.py isn't actually an error - before the fix we were yielding points with height above the bound.

@mkoeppe
Copy link
Contributor

mkoeppe commented Dec 18, 2021

comment:18

Stalled in needs_review or needs_info; likely won't make it into Sage 9.5.

@mkoeppe mkoeppe modified the milestones: sage-9.5, sage-9.6 Dec 18, 2021
@guojing0
Copy link
Contributor

comment:19

Has the Krumm code been integrated into the Sage code?

@mkoeppe mkoeppe modified the milestones: sage-9.6, sage-9.7 May 3, 2022
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 22, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

ff89c6e32686: Correct doc and add an example

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 22, 2022

Branch pushed to git repo; I updated commit sha1. This was a forced push. Last 10 new commits:

31d058732686: Change some example outputs
8afc29232686: Debug `IQ_points_of_bounded_height`
b3b05c832686: Change example outputs
5958fc632686: Improve doc and return points in `self`
1c8086432686: Change `self` to `K` in non-rational points_of_bounded_height
5ec496e32686: Add `PN` to args of non-rational points_bdd
2adb10132686: Correct tests
a23735232686: Improve doc
00af5c732686: Correct doc and add an example
98a467632686: Correct example

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 22, 2022

Changed commit from ff89c6e to 98a4676

@EnderWannabe
Copy link
Contributor

comment:58

Looks good!

@fchapoton
Copy link
Contributor

comment:59

reviewer full name is missing

@EnderWannabe
Copy link
Contributor

Changed author from Alexander Galarraga, Jing Guo to Jing Guo

@EnderWannabe
Copy link
Contributor

Reviewer: Alexander Galarraga, Ben Hutz

@vbraun
Copy link
Member

vbraun commented Oct 5, 2022

comment:61

See patchbot for failures

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 6, 2022

Changed commit from 98a4676 to c4aab9f

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 6, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

c4aab9f32686: Remove unused imports and variables

@guojing0
Copy link
Contributor

guojing0 commented Oct 6, 2022

comment:63

Let the patch bot run.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 7, 2022

Changed commit from c4aab9f to 10df9a6

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 7, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

10df9a632686: Correct example outputs in various files

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 7, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

c053c2a32686: Format according to lint result

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 7, 2022

Changed commit from 10df9a6 to c053c2a

@vbraun
Copy link
Member

vbraun commented Oct 16, 2022

Changed branch from u/gh-guojing0/points to c053c2a

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

6 participants