Opened 10 years ago

Closed 8 years ago

# Bug in cuspidal/eisenstein decomposition of modular symbols mod p

Reported by: Owned by: Robert Harron David Loeffler major sage-duplicate/invalid/wontfix modular forms modular symbols, mod p, eisenstein N/A

### Description (last modified by Robert Harron)

The following code

```sage: ModularSymbols(Gamma0(46 * 47), 2, 1, GF(47)).eisenstein_subspace()
```

produces an ArithmeticError? saying "subspace is not invariant under matrix". In a presumably completely related example, the code

```sage: ModularSymbols(Gamma0(46 * 47), 2, 1, GF(47)).cuspidal_subspace().hecke_polynomial(47)
```

produces the exact same arithmetic error. I have computed examples like above where 46 is replaced by any N in the range 24 to 45 or 47 to 54 and where 47 is replaced with any prime p less than 50 (not dividing N) and have not encountered the problem.

Update: I get the same problem when N = 60 and p is 43 or 47.

### comment:1 Changed 10 years ago by Robert Harron

Description: modified (diff)

### comment:2 follow-up:  3 Changed 10 years ago by William Stein

What version of Sage are you using? Your examples work fine in every release of Sage since July..

```wstein@sage:~\$ sage
----------------------------------------------------------------------
| Sage Version 5.3, Release Date: 2012-09-08                         |
| Type "notebook()" for the browser-based notebook interface.        |
| Type "help()" for help.                                            |
----------------------------------------------------------------------
sage: ModularSymbols(Gamma0(46 * 47), 2, 1, GF(47)).eisenstein_subspace()
Modular Symbols subspace of dimension 7 of Modular Symbols space of dimension 292 for Gamma_0(2162) of weight 2 with sign 1 over Finite Field of size 47

sage: ModularSymbols(Gamma0(46 * 47), 2, 1, GF(47)).cuspidal_subspace().hecke_polynomial(47)

x^285 + x^284 + 41*x^283 + 41*x^282 + 42*x^281 + 42*x^280 + 20*x^279 + 20*x^278 + 38*x^277 + 38*x^276 + 18*x^275 + 18*x^274 + 23*x^273 + 23*x^272 + 22*x^271 + 22*x^270 + 31*x^269 + 31*x^268 + 19*x^267 + 19*x^266 + 2*x^265 + 2*x^264 + 43*x^263 + 43*x^262 + 17*x^261 + 17*x^260 + 34*x^259 + 34*x^258 + 16*x^257 + 16*x^256 + 26*x^255 + 26*x^254 + 33*x^253 + 33*x^252 + 6*x^251 + 6*x^250 + 8*x^249 + 8*x^248 + 8*x^247 + 8*x^246 + 22*x^245 + 22*x^244 + 19*x^243 + 19*x^242 + 15*x^241 + 15*x^240 + 26*x^239 + 26*x^238 + 21*x^237 + 21*x^236 + 16*x^235 + 16*x^234 + 27*x^233 + 27*x^232 + 23*x^231 + 23*x^230 + 20*x^229 + 20*x^228 + 34*x^227 + 34*x^226 + 34*x^225 + 34*x^224 + 36*x^223 + 36*x^222 + 9*x^221 + 9*x^220 + 16*x^219 + 16*x^218 + 26*x^217 + 26*x^216 + 8*x^215 + 8*x^214 + 25*x^213 + 25*x^212 + 46*x^211 + 46*x^210 + 40*x^209 + 40*x^208 + 23*x^207 + 23*x^206 + 11*x^205 + 11*x^204 + 20*x^203 + 20*x^202 + 19*x^201 + 19*x^200 + 24*x^199 + 24*x^198 + 4*x^197 + 4*x^196 + 22*x^195 + 22*x^194 + 45*x^191 + 45*x^190 + 12*x^189 + 12*x^188 + 10*x^187 + 10*x^186 + 7*x^185 + 7*x^184 + 18*x^183 + 18*x^182 + 11*x^181 + 11*x^180 + x^179 + x^178 + 3*x^177 + 3*x^176 + 32*x^175 + 32*x^174 + 9*x^173 + 9*x^172 + 43*x^171 + 43*x^170 + 8*x^169 + 8*x^168 + 13*x^167 + 13*x^166 + 26*x^165 + 26*x^164 + 15*x^163 + 15*x^162 + 42*x^161 + 42*x^160 + 28*x^159 + 28*x^158 + 35*x^157 + 35*x^156 + 31*x^155 + 31*x^154 + 31*x^153 + 31*x^152 + 3*x^151 + 3*x^150 + 9*x^149 + 9*x^148 + 17*x^147 + 17*x^146 + 42*x^145 + 42*x^144 + 5*x^143 + 5*x^142 + 15*x^141 + 15*x^140 + 40*x^139 + 40*x^138 + x^137 + x^136 + 7*x^135 + 7*x^134 + 26*x^133 + 26*x^132 + 26*x^131 + 26*x^130 + 22*x^129 + 22*x^128 + 29*x^127 + 29*x^126 + 15*x^125 + 15*x^124 + 42*x^123 + 42*x^122 + 31*x^121 + 31*x^120 + 44*x^119 + 44*x^118 + 2*x^117 + 2*x^116 + 14*x^115 + 14*x^114 + x^113 + x^112 + 25*x^111 + 25*x^110 + 7*x^109 + 7*x^108 + 9*x^107 + 9*x^106 + 46*x^105 + 46*x^104 + 39*x^103 + 39*x^102 + 3*x^101 + 3*x^100 + x^97 + x^96 + 41*x^95 + 41*x^94 + 42*x^93 + 42*x^92 + 20*x^91 + 20*x^90 + 38*x^89 + 38*x^88 + 18*x^87 + 18*x^86 + 23*x^85 + 23*x^84 + 22*x^83 + 22*x^82 + 31*x^81 + 31*x^80 + 19*x^79 + 19*x^78 + 2*x^77 + 2*x^76 + 43*x^75 + 43*x^74 + 17*x^73 + 17*x^72 + 34*x^71 + 34*x^70 + 16*x^69 + 16*x^68 + 26*x^67 + 26*x^66 + 33*x^65 + 33*x^64 + 6*x^63 + 6*x^62 + 8*x^61 + 8*x^60 + 8*x^59 + 8*x^58 + 22*x^57 + 22*x^56 + 19*x^55 + 19*x^54 + 15*x^53 + 15*x^52 + 26*x^51 + 26*x^50 + 21*x^49 + 21*x^48 + 16*x^47 + 16*x^46 + 27*x^45 + 27*x^44 + 23*x^43 + 23*x^42 + 20*x^41 + 20*x^40 + 34*x^39 + 34*x^38 + 34*x^37 + 34*x^36 + 36*x^35 + 36*x^34 + 9*x^33 + 9*x^32 + 16*x^31 + 16*x^30 + 26*x^29 + 26*x^28 + 8*x^27 + 8*x^26 + 25*x^25 + 25*x^24 + 46*x^23 + 46*x^22 + 40*x^21 + 40*x^20 + 23*x^19 + 23*x^18 + 11*x^17 + 11*x^16 + 20*x^15 + 20*x^14 + 19*x^13 + 19*x^12 + 24*x^11 + 24*x^10 + 4*x^9 + 4*x^8 + 22*x^7 + 22*x^6
```

### comment:3 in reply to:  2 ; follow-up:  4 Changed 10 years ago by Robert Harron

Ah, I see. I'm using version 5.2 released near the end of July. I had wanted to wait until upgrading (to 5.4) before posting this bug, but then I didn't see anything merged in 5.3 that seemed at all related to it. Thanks.

### comment:4 in reply to:  3 Changed 10 years ago by William Stein

Ah, I see. I'm using version 5.2 released near the end of July. I had wanted to wait until upgrading (to 5.4) before posting this bug, but then I didn't see anything merged in 5.3 that seemed at all related to it. Thanks.

This input works fine for me with Sage-5.2 on 64-bit OS X. Do you have the problem from a fresh start? Please post a complete session log, starting with typing "sage" at the terminal, e.g.,

```blastoff:~ wstein\$ uname -a
Darwin blastoff.local 11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64
blastoff:~ wstein\$ sage
----------------------------------------------------------------------
| Sage Version 5.2, Release Date: 2012-07-25                         |
| Type "notebook()" for the browser-based notebook interface.        |
| Type "help()" for help.                                            |
----------------------------------------------------------------------
sage: ModularSymbols(Gamma0(46 * 47), 2, 1, GF(47)).eisenstein_subspace()
Modular Symbols subspace of dimension 7 of Modular Symbols space of dimension 292 for Gamma_0(2162) of weight 2 with sign 1 over Finite Field of size 47
sage: ModularSymbols(Gamma0(46 * 47), 2, 1, GF(47)).cuspidal_subspace().hecke_polynomial(47)
x^285 + x^284 + 41*x^283 + 41*x^282 + 42*x^281 + 42*x^280 + 20*x^279 + 20*x^278 + 38*x^277 + 38*x^276 + 18*x^275 + 18*x^274 + 23*x^273 + 23*x^272 + 22*x^271 + 22*x^270 + 31*x^269 + 31*x^268 + 19*x^267 + 19*x^266 + 2*x^265 + 2*x^264 + 43*x^2 ...
```

### comment:5 Changed 10 years ago by Robert Harron

Here it is: (I'm running an up-to-date MacBook? Pro with OS X 10.6.8)

```Last login: Sun Oct 21 23:22:21 on console
dyn-72-33-202-250:~ rharron\$ uname -a
Darwin dyn-72-33-202-250.uwnet.wisc.edu 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386
dyn-72-33-202-250:~ rharron\$ sage
----------------------------------------------------------------------
| Sage Version 5.2, Release Date: 2012-07-25                         |
| Type "notebook()" for the browser-based notebook interface.        |
| Type "help()" for help.                                            |
----------------------------------------------------------------------
sage: ModularSymbols(Gamma0(46 * 47), 2, 1, GF(47)).eisenstein_subspace()
---------------------------------------------------------------------------
ArithmeticError                           Traceback (most recent call last)

/Users/rharron/<ipython console> in <module>()

/Users/rharron/sage/local/lib/python2.7/site-packages/sage/modular/modsym/space.pyc in eisenstein_subspace(self)
289             6
290         """
--> 291         return self.eisenstein_submodule()
292
293     def dimension_of_associated_cuspform_space(self):

/Users/rharron/sage/local/lib/python2.7/site-packages/sage/modular/modsym/ambient.pyc in eisenstein_submodule(self)
1535             return self.__eisenstein_submodule
1536         except AttributeError:
-> 1537             self.__eisenstein_submodule = self.cuspidal_submodule().complement()
1538             return self.__eisenstein_submodule
1539

/Users/rharron/sage/local/lib/python2.7/site-packages/sage/misc/cachefunc.so in sage.misc.cachefunc.CachedMethodCaller.__call__ (sage/misc/cachefunc.c:6565)()

/Users/rharron/sage/local/lib/python2.7/site-packages/sage/misc/cachefunc.so in sage.misc.cachefunc.CachedMethod._instance_call (sage/misc/cachefunc.c:9044)()

/Users/rharron/sage/local/lib/python2.7/site-packages/sage/modular/hecke/submodule.pyc in complement(self, bound)
366                 while N % p == 0: p = arith.next_prime(p)
367             misc.verbose("using T_%s"%p)
--> 368             f = self.hecke_polynomial(p)
369             T = A.hecke_matrix(p)
370             g = T.charpoly('x')

/Users/rharron/sage/local/lib/python2.7/site-packages/sage/modular/hecke/module.pyc in hecke_polynomial(self, n, var)
1458             x^3 - 2*x^2 - 7*x - 4
1459         """
-> 1460         return self.hecke_operator(n).charpoly(var)
1461
1462     def is_simple(self):

/Users/rharron/sage/local/lib/python2.7/site-packages/sage/modular/hecke/hecke_operator.pyc in charpoly(self, var)
272             x^6 - 14*x^5 + 29*x^4 + 172*x^3 - 124*x^2 - 320*x + 256
273         """
--> 274         return self.matrix().charpoly(var)
275
276     def decomposition(self):

/Users/rharron/sage/local/lib/python2.7/site-packages/sage/modular/hecke/hecke_operator.pyc in matrix(self, *args, **kwds)
745             return self.__matrix
746         except AttributeError:
--> 747             self.__matrix = self.parent().hecke_matrix(self.__n, *args, **kwds)
748             return self.__matrix
749

/Users/rharron/sage/local/lib/python2.7/site-packages/sage/modular/hecke/algebra.pyc in hecke_matrix(self, n, *args, **kwds)
587             [4860    0 2049]
588         """
--> 589         return self.__M.hecke_matrix(n, *args, **kwds)
590
591     def diamond_bracket_matrix(self, d):

/Users/rharron/sage/local/lib/python2.7/site-packages/sage/modular/hecke/module.pyc in hecke_matrix(self, n)
1349             raise IndexError, "n must be positive."
1350         if not self._hecke_matrices.has_key(n):
-> 1351             T = self._compute_hecke_matrix(n)
1352             T.set_immutable()
1353             self._hecke_matrices[n] = T

/Users/rharron/sage/local/lib/python2.7/site-packages/sage/modular/hecke/submodule.pyc in _compute_hecke_matrix(self, n)
237         A = self.ambient_hecke_module().hecke_matrix(n)
238         check = arith.gcd(self.level(), n) != 1
--> 239         return A.restrict(self.free_module(), check=check)
240
241     def _compute_diamond_matrix(self, d):

/Users/rharron/sage/local/lib/python2.7/site-packages/sage/matrix/matrix2.so in sage.matrix.matrix2.Matrix.restrict (sage/matrix/matrix2.c:23432)()

ArithmeticError: subspace is not invariant under matrix
sage: ModularSymbols(Gamma0(46 * 47), 2, 1, GF(47)).cuspidal_subspace().hecke_polynomial(47)
---------------------------------------------------------------------------
ArithmeticError                           Traceback (most recent call last)

/Users/rharron/<ipython console> in <module>()

/Users/rharron/sage/local/lib/python2.7/site-packages/sage/modular/hecke/module.pyc in hecke_polynomial(self, n, var)
1458             x^3 - 2*x^2 - 7*x - 4
1459         """
-> 1460         return self.hecke_operator(n).charpoly(var)
1461
1462     def is_simple(self):

/Users/rharron/sage/local/lib/python2.7/site-packages/sage/modular/hecke/hecke_operator.pyc in charpoly(self, var)
272             x^6 - 14*x^5 + 29*x^4 + 172*x^3 - 124*x^2 - 320*x + 256
273         """
--> 274         return self.matrix().charpoly(var)
275
276     def decomposition(self):

/Users/rharron/sage/local/lib/python2.7/site-packages/sage/modular/hecke/hecke_operator.pyc in matrix(self, *args, **kwds)
745             return self.__matrix
746         except AttributeError:
--> 747             self.__matrix = self.parent().hecke_matrix(self.__n, *args, **kwds)
748             return self.__matrix
749

/Users/rharron/sage/local/lib/python2.7/site-packages/sage/modular/hecke/algebra.pyc in hecke_matrix(self, n, *args, **kwds)
587             [4860    0 2049]
588         """
--> 589         return self.__M.hecke_matrix(n, *args, **kwds)
590
591     def diamond_bracket_matrix(self, d):

/Users/rharron/sage/local/lib/python2.7/site-packages/sage/modular/hecke/module.pyc in hecke_matrix(self, n)
1349             raise IndexError, "n must be positive."
1350         if not self._hecke_matrices.has_key(n):
-> 1351             T = self._compute_hecke_matrix(n)
1352             T.set_immutable()
1353             self._hecke_matrices[n] = T

/Users/rharron/sage/local/lib/python2.7/site-packages/sage/modular/hecke/submodule.pyc in _compute_hecke_matrix(self, n)
237         A = self.ambient_hecke_module().hecke_matrix(n)
238         check = arith.gcd(self.level(), n) != 1
--> 239         return A.restrict(self.free_module(), check=check)
240
241     def _compute_diamond_matrix(self, d):

/Users/rharron/sage/local/lib/python2.7/site-packages/sage/matrix/matrix2.so in sage.matrix.matrix2.Matrix.restrict (sage/matrix/matrix2.c:23432)()

ArithmeticError: subspace is not invariant under matrix
```

### comment:6 Changed 10 years ago by Robert Harron

Also, there appears to be a related problem at Trac 13445. There, if I run S.hecke_polynomial(29), I get a "RuntimeError?: maximum recursion depth exceeded in cmp".

### comment:7 Changed 10 years ago by William Stein

You appear to be using a pre-made binary built for (and on) OS X 10.6 or 10.7 on your OS X 10.8 computer. This is probably the source of your problems, since though this variations on OS X tend to sort of be more or less compatible, then aren't really, at least for software that requires absolute correctness (e.g., math software).

There is a recent thread on sage-devel called "When will OS X 10.8 be supported, officially?"

Running #13445 in Sage-5.2 does not yield a RuntimeError? for a properly built version of sage.

### comment:8 follow-up:  9 Changed 10 years ago by Robert Harron

Wait, but no, I don't have OS X 10.8, I have 10.6. And I built sage from the source on this computer.

### comment:9 in reply to:  8 Changed 10 years ago by William Stein

Wait, but no, I don't have OS X 10.8, I have 10.6. And I built sage from the source on this computer.

I was confused by seeing `uname -a --> Darwin dyn-72-33-202-250.uwnet.wisc.edu 10.8.0 Darwin Kernel Version`; I forgot how confusing OS X's versioning is -- "10.8" doesn't mean "10.8", it means "10.6", and I guess "12.x" would mean 10.8?

Anyway, your problem is OS X 10.6. With OS X 10.7, exactly the same version(s) of Sage work fine. With 10.6, I also get the error's you're seeing. There is a sage-devel thread called " OSX10.7 (Lion)'s blas is REALLY BUGGY: Fwd: cvxopt on MacOSX 10.7", which has quotes like "just wow. So should we not trust matlab or mathematica on Lion either? ... you can't trust Apple's lapack/blas on OSX 10.6 either. Here is a short Fortran code calling blas, which crashes on 10.6 and 10.7 http://trac.sagemath.org/sage_trac/ticket/12011#comment:31 And this has been known by Apple for years, apparently... Have they all but abandoned anything to do with high-performance computing?"

I never do any serious research math computation using OS X. Linux is much more reliable.

Wow!

### comment:11 Changed 9 years ago by Jeroen Demeyer

Milestone: sage-5.11 → sage-5.12

### comment:12 Changed 9 years ago by For batch modifications

Milestone: sage-6.1 → sage-6.2

### comment:13 Changed 8 years ago by Alex Ghitza

Status: new → needs_review

The discussion above seems to indicate that this is an issue that's very specific to OS X 10.6.

I suggest that we close the ticket as "worksforme".

### comment:14 Changed 8 years ago by For batch modifications

Milestone: sage-6.2 → sage-6.3

### comment:15 Changed 8 years ago by Ralf Stephan

Milestone: sage-6.3 → sage-duplicate/invalid/wontfix needs_review → positive_review

### comment:16 Changed 8 years ago by Volker Braun

Resolution: → worksforme positive_review → closed
Note: See TracTickets for help on using tickets.