Open AndrewVSutherland opened 3 months ago
It would be great if someone who knows PariGP (e.g. @pascalmolin) and SageMath (e.g. @roed314) could give similar snippets for PariGP and SageMath.
These should be added to the code downloads, but might be too much to put into the snippets. We could just have the snippet be a comment that says "click the Download to blah link to get code that selects this newform". I think that would be better than having a line that uses what is likely the wrong index (this would avoid the confusion that led to #6059).
The code snippets/downloads for PariGP/SageMath/Magma that appear on newform pages currently split the relevant newspace and then include a line that simply grabs the first newform in the list returned (with a comment that the index might be incorrect). The ordering of the newforms returned doesn't necessarily match the ordering in the LMFDB and there is no way for us to know ahead of time what the correct index is (indeed, in some cases it is non-deterministic).
However, for each newspace we know exactly how many traces are needed to distinguish all the newforms in the space, and the traces of the newform in the page, so it would be easy to add a short block of code that selects the correct newform by checking traces. In many cases, the dimension (the trace of a_1(f)) is already enough and in any case this should be very quick and will save the user the hassle of doing this themselves (and the confusion of potentially not realizing they need to do it).
For example, for the newform 80.5.h.b mentioned in #6059, the following Magma code can be used to determine the correct index: