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

PARI-backed LaurentSeries truncates exact polynomials to default precision #33224

Closed
yyyyx4 opened this issue Jan 24, 2022 · 10 comments
Closed

Comments

@yyyyx4
Copy link
Member

yyyyx4 commented Jan 24, 2022

On 9.5.rc3:

sage: R.<z> = LaurentSeriesRing(QQ, implementation='pari')
sage: z^-2
z^-2 + O(z^18)

This happens because construct_from_pari in power_series_pari.pyx expands all t_RFRAC elements to a power series using the parent ring's default precision (usually 20). However, this needlessly reduces the precision when the t_RFRAC has denominator one, i.e., is actually a polynomial and can therefore be represented exactly as a power series. The fix is very simple: Check if the denominator equals 1.

(This behaviour was identified as the root cause for the following loss of precision:)

sage: E = EllipticCurve(GF(257^2), [5,5])
sage: E.weierstrass_p(prec=50, algorithm='fast')
z^-2 + 256*z^2 + 36*z^4 + 86*z^6 + 107*z^8 + 126*z^10 + 119*z^12 + 4*z^14 + 54*z^16 + 216*z^18 + 212*z^20 + 185*z^22 + 100*z^24 + 85*z^26 + 3*z^28 + 10*z^30 + 53*z^32 + 26*z^34 + 163*z^36 + 144*z^38 + 176*z^40 + 121*z^42 + 163*z^44 + 241*z^46 + 82*z^48 + O(z^50)
sage: E.weierstrass_p(prec=50, algorithm='pari')
z^-2 + 256*z^2 + 36*z^4 + 86*z^6 + 107*z^8 + 126*z^10 + 119*z^12 + 4*z^14 + 54*z^16 + O(z^18)
sage: E.weierstrass_p(prec=50, algorithm='quadratic')
z^-2 + 256*z^2 + 36*z^4 + 86*z^6 + 107*z^8 + 126*z^10 + 119*z^12 + 4*z^14 + 54*z^16 + O(z^18)

Component: algebra

Author: Lorenz Panny

Branch/Commit: 9eb2145

Reviewer: Frédéric Chapoton

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

@yyyyx4 yyyyx4 added this to the sage-9.6 milestone Jan 24, 2022
@yyyyx4

This comment has been minimized.

@yyyyx4
Copy link
Member Author

yyyyx4 commented Jan 24, 2022

Commit: 542ab86

@yyyyx4
Copy link
Member Author

yyyyx4 commented Jan 24, 2022

Author: Lorenz Panny

@yyyyx4
Copy link
Member Author

yyyyx4 commented Jan 24, 2022

Branch: public/33224

@yyyyx4
Copy link
Member Author

yyyyx4 commented Jan 24, 2022

New commits:

d27cdc7keep infinite precision when computation is exact
542ab86add test for #33224

@yyyyx4 yyyyx4 changed the title loss of precision in EllipticCurve_field.weierstrass_p() with some algorithms PARI-backed LaurentSeries truncates exact polynomials to default precision Jan 24, 2022
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 28, 2022

Changed commit from 542ab86 to 9eb2145

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 28, 2022

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

9eb2145we should take the denominator of the input, not its type :|

@fchapoton
Copy link
Contributor

Reviewer: Frédéric Chapoton

@fchapoton
Copy link
Contributor

comment:6

ok, looks good enough

@vbraun
Copy link
Member

vbraun commented Mar 3, 2022

Changed branch from public/33224 to 9eb2145

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

3 participants