Opened 4 years ago
Closed 4 years ago
#17299 closed defect (fixed)
Bug in LaTeX of modular symbols
Reported by:  was  Owned by:  haochen_uw 

Priority:  critical  Milestone:  sage6.9 
Component:  modular forms  Keywords:  
Cc:  Merged in:  
Authors:  Hao Chen, David Loeffler  Reviewers:  David Loeffler, Frédéric Chapoton 
Report Upstream:  N/A  Work issues:  
Branch:  a1c545f (Commits)  Commit:  a1c545f7ec4ce085d23221aeca50dc9889305f2c 
Dependencies:  Stopgaps: 
Description (last modified by )
I almost just got in trouble doing some research due to the following rather serious bug in modular symbols:
/scratch/wstein/sage6.4.rc1$ ./sage │ Sage Version 6.4.rc1, Release Date: 20141101 │ sage: x = EllipticCurve('64a1').modular_symbol_space(sign=1).basis()[0] sage: x.modular_symbol_rep() {1/3, 1/4}  {1/5, 1/4} sage: latex(x.modular_symbol_rep()) \left\{\frac{1}{3}, \frac{1}{4}\right\}
Notice that the latex representation completely omits the second summand. I was using show(x) to typeset output nicely, and getting massively misled.
Change History (15)
comment:1 Changed 4 years ago by
 Branch set to u/haochen_uw/latexrepbug
 Owner changed from (none) to haochen_uw
comment:2 Changed 4 years ago by
 Commit set to 35081a653922bc15298651161d307d8e9700bb80
comment:3 Changed 4 years ago by
 Description modified (diff)
comment:4 Changed 4 years ago by
 Priority changed from major to critical
This is really a bug in latex printing, not modular symbols, hence very, very critical. I think it will produce mathematically incorrect results in a lot of situations, potentially. So raising the priority to critical.
Hao's patch as I write this isn't correct, but I've emailed him about what to do.
This bug is my fault: I introduced it in 2009.
comment:5 Changed 4 years ago by
Something like this seems to work.

src/sage/misc/latex.py
a b def repr_lincomb(symbols, coeffs): 2349 2349 s += " + %s"%b 2350 2350 else: 2351 2351 coeff = coeff_repr(c) 2352 if coeff == "1": 2353 coeff = "" 2352 2354 if first: 2353 2355 coeff = str(coeff) 2354 2356 else: … … def repr_lincomb(symbols, coeffs): 2359 2361 try: 2360 2362 if bv in CC: 2361 2363 s += "%s\cdot %s"%(coeff, b) 2364 else: 2365 s += "%s%s"%(coeff, b) 2362 2366 except Exception: 2363 2367 s += "%s%s"%(coeff, b) 2364 2368 first = False
comment:6 Changed 4 years ago by
 Commit changed from 35081a653922bc15298651161d307d8e9700bb80 to 6f7efb844ae91bfdc5a4f109bc8fe809b27a1bdb
Branch pushed to git repo; I updated commit sha1. New commits:
6f7efb8  second try. Add doctests.

comment:7 Changed 4 years ago by
 Summary changed from nasty bug in modular symbols, which is likely very easy to fix. to Bug in LaTeX of modular symbols
comment:8 Changed 4 years ago by
Is this ready for review? It looks like a complete solution to me. If so, please set the "status" to "needs_review" (and enter an author name).
comment:9 Changed 4 years ago by
 Status changed from new to needs_review
comment:10 Changed 4 years ago by
 Status changed from needs_review to needs_work
Replace trac ticket 17299(latex representation of modular symbols)
by :trac:`17299`
.
comment:11 Changed 4 years ago by
 Branch changed from u/haochen_uw/latexrepbug to u/davidloeffler/latexrepbug
comment:12 Changed 4 years ago by
 Commit changed from 6f7efb844ae91bfdc5a4f109bc8fe809b27a1bdb to 3451807c651ce4df163532490ee04fe914756ada
 Status changed from needs_work to needs_review
New commits:
3451807  Trac 17299: formatting fix

comment:13 Changed 4 years ago by
 Branch changed from u/davidloeffler/latexrepbug to public/ticket/17299
 Commit changed from 3451807c651ce4df163532490ee04fe914756ada to a1c545f7ec4ce085d23221aeca50dc9889305f2c
 Reviewers set to David Loeffler, Frédéric Chapoton
 Status changed from needs_review to positive_review
Looks good to me. The patchbot is green, and this ticket has been waiting for too long.
As I made only cosmetic formatting of code, I allow myself to put this to positive review.
New commits:
2ad88bb  Merge branch 'u/davidloeffler/latexrepbug' into 6.9.b6

a1c545f  trac #17299 cosmetic formatting of code

comment:14 Changed 4 years ago by
 Milestone changed from sage6.4 to sage6.9
comment:15 Changed 4 years ago by
 Branch changed from public/ticket/17299 to a1c545f7ec4ce085d23221aeca50dc9889305f2c
 Resolution set to fixed
 Status changed from positive_review to closed
Branch pushed to git repo; I updated commit sha1. New commits:
fixed latex representations of FormalSum objects bug.