-
-
Notifications
You must be signed in to change notification settings - Fork 673
approximate imaginary-quadratic class numbers using analytic class number formula #40907
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
base: develop
Are you sure you want to change the base?
Conversation
Documentation preview for this PR (built with commit 814eab3; changes) is ready! 🎉 |
…ing class numbers of negative fundamental discriminants
c0a616a
to
5430772
Compare
h = pari.qfbclassno(disc) | ||
return ZZ(h) | ||
|
||
def quadratic_order_approximate_class_number(disc, *, bound=10**4): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
putting it here is rather undiscoverable though. How about making it (also) a member of QuadraticField
? (or is the construction of QuadraticField
expensive? We can still put it in both places for discoverability though)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was even tempted to add it as an algorithm=
option to the existing .class_number()
method, but that seems questionable. Perhaps it would be enough to mention the existence of this function in the documentation of .class_number()
? It is a rather obscure feature that most users will never require, after all...
sage: h = round(quadratic_order_approximate_class_number(-p, bound=10**5)); h | ||
848... | ||
sage: RR(h / hreal) | ||
0.999... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at least the formula should be deterministic so there shouldn't be a flaky test issue here, but for your information there's # abs tol 1e-3
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I'm unsure what's the best thing to do here. Does it make sense to simply hardcode the current output? It may change (slightly) with things like the choice of floating-point precision, so the value you get is not automatically deterministic just because the formula is. Hardcode the current output with some tolerance? Hardcode the actual class number with enough tolerance to make the approximation pass the test? (I think the last one would potentially mislead any human readers of the doctest.)
Co-authored-by: user202729 <25191436+user202729@users.noreply.github.com>
This patch adds a simple function to approximate class numbers of imaginary-quadratic fields using the analytic class number formula. This approximation is accurate to a relative error factor of$<2$ even with comparatively low precision, making it useful in the context of class-group computations.
An obvious next step would be to generalize it to non-fundamental and/or positive discriminants. This is left for future work.