Opened 16 months ago
Closed 15 months ago
#31317 closed defect (fixed)
eclib interface uses bad default value for elliptic curve modular symbols
Reported by:  cremona  Owned by:  

Priority:  major  Milestone:  sage9.3 
Component:  elliptic curves  Keywords:  elliptic curve modular symbol 
Cc:  wuthrich  Merged in:  
Authors:  John Cremona  Reviewers:  Chris Wuthrich 
Report Upstream:  N/A  Work issues:  
Branch:  2ab86ef (Commits, GitHub, GitLab)  Commit:  2ab86ef72a3ddc7341ed76e4dc0dbd0ce7ee0162 
Dependencies:  Stopgaps: 
Description
This was reported to me by Chris Wuthrich in December 2019, and by Barry Mazur and Karl Rubin a few days ago. I originally thought that there was a bug in eclib, but it turns out that the only bug is that the default value of certain parameters is too small for the cases they were interested in. I will post a 2line patch to increase this. It has to be a 2line patch, not 1, since the current eclib interfae does not expose the relevant parameter to Sage at all currently.
Here are two example. Wuthrich's (takes a little while as the conductor is 87416):
sage: E = EllipticCurve([49,49]) sage: me = E.modular_symbol(implementation="eclib") sage: me(1/8) 10/17 sage: mn = E.modular_symbol(implementation="num") sage: mn(1/8) 1/2
and Mazur's:
sage: E = EllipticCurve('1590g1') sage: ms = E.modular_symbol() sage: [ms(a/5) for a in [1..4]] [1001/153, 1001/153, 1001/153, 1001/153] sage: ms = E.modular_symbol(implementation='num') sage: [ms(a/5) for a in [1..4]] [13/2, 13/2, 13/2, 13/2]
In both cases, after my patch the 'eclib' values agree with the numerical values.
Change History (9)
comment:1 Changed 16 months ago by
 Branch set to u/cremona/31317
 Commit set to da09de4681c411f9e01069de4273c328a8d33b8b
 Status changed from new to needs_review
comment:2 followup: ↓ 3 Changed 16 months ago by
Is there evidence that 1000 is the right bound for all curves? All for which it makes sense to use eclib. Maybe it should increase with the conductor. Probably 100*sqrt(N) or so is saver.
(sorry not to reply in full, busy with marking new semester etc)
comment:3 in reply to: ↑ 2 Changed 16 months ago by
 Status changed from needs_review to needs_work
Replying to wuthrich:
Is there evidence that 1000 is the right bound for all curves? All for which it makes sense to use eclib. Maybe it should increase with the conductor. Probably 100*sqrt(N) or so is safer.
Good point  though at the top level E.modular_symbol() used default nap=400 in this patch. As you know, for large conductor it will take a long time to make this construction, so I rather doubt it will be used much for N>10000 (say), so a default which works on this range seemed reasonable. On the other hand, compared with the time it takes to construct the modular symbol space, the time to compute more ap from the curve is negligible, suggesting that having a higher default is better.
I will be changing eclib's own default (which is 300 ap) anyway, probably to 1000, and the way the code works is that it sets a minimum value of nap (currently 300) so that whatever value the user gives is increased to this if less. (i.e., there is in effect the line nap=max(300,nap) in eclib's relevant function.)
I would be so much happier if it were possible to get this normalising factor another way than by taking rations of periods. It is *only* needed at all so that we get the right answers for nonoptima curves  when you give it an optimal curve it goes to all this trouble to compute the ratio as 1 (or in the example before the fix it computed it as 73/68 or something), but I know of no way to do that. It would be possible to change eclib so that it assumes that the curve is optimal by default, only computing the normalisation factors if the users specifically asks. Then on the Sage side we could decide to use the default if the curve's label ends in '1', or if the isogeny class consists of only one curve.
The current fix is designed to be easily implemented as it requires no change to eclib  which had no bugs in this regard, except possible the too low default value of 300.
But I will take your suggestion on board with a new patch, and while waiting for the review I'll test it as many curves as I can  the test being that 'eclib' and 'num' give the same answer for all small rationals.
(sorry not to reply in full, busy with marking new semester etc)
comment:4 Changed 16 months ago by
 Commit changed from da09de4681c411f9e01069de4273c328a8d33b8b to 2ab86ef72a3ddc7341ed76e4dc0dbd0ce7ee0162
Branch pushed to git repo; I updated commit sha1. New commits:
2ab86ef  #31317: more intelligent default for nap

comment:5 Changed 16 months ago by
 Status changed from needs_work to needs_review
I switched the default at at the top level to max(100*N.isqrt(),10000). I have started a test for all conductors up to (however far I get, but maybe) 10000. By comparison, even for conductors up to 500000 I was only computing 6000 ap when finding the curves, which requires far greater precision.
comment:6 Changed 16 months ago by
For all curves of conductor up to 1000, with the new code, the 'eclib' and 'num' results agree (at all rationals with numerator and denominator bounded by 5). I'll continue to test more, but noone need be in any doubt that this should be merged.
comment:7 followup: ↓ 8 Changed 16 months ago by
 Reviewers set to Chris Wuthrich
 Status changed from needs_review to positive_review
I agree with all that is said here and I checked the code and all tests pass etc.
comment:8 in reply to: ↑ 7 Changed 16 months ago by
Replying to wuthrich:
I agree with all that is said here and I checked the code and all tests pass etc.
Thanks. Although some patchbots are reporting test failures these have nothing to do with this patch, so are less than helpful. Perhaps patchbots should first run all tests without applying the patch, and only if those pass would they apply the patch and retest. That would take twice as long but would avoid spurious failures like this which probably have the effect that the release manager assumes something is actually wrong and the bugfix never gets merged.
comment:9 Changed 15 months ago by
 Branch changed from u/cremona/31317 to 2ab86ef72a3ddc7341ed76e4dc0dbd0ce7ee0162
 Resolution set to fixed
 Status changed from positive_review to closed
As well as adding the nap option to te interface itself I passed this up the chain so that users can see it too, with doctests. While there I tidied up the documentation a bit too.
New commits:
#31317 eclib elliptic curve modular symbols