# Revision history [back]

Here is a piece of code that pushes the computations as far as possible.

import traceback
from sage.modular.pollack_stevens.space import ps_modsym_from_simple_modsym_space

p = 5
prec = 2
precmore = 8

A = ModularSymbols(35, 2, 1).cuspidal_submodule().new_subspace().decomposition()[1]

phi = ps_modsym_from_simple_modsym_space(A)
# sage: phi
# Modular symbol of level 35 with values in
#     Sym^0(Number Field in alpha with defining polynomial x^2 + x - 4)^2

ap         = phi.Tq_eigenvalue(p, prec)    # this is 1 in QQ
phi1, psi1 = phi.completions  (p, precmore)

R    = psi1.codomain()
eps  = 1
poly = PolynomialRing(R, 'x')( [p ** (k + 1) * eps, -ap, 1] )
v0, v1 = poly.roots( multiplicities=False )

if v0.valuation():
v0, v1 = v1, v0
alpha = v0

try:
phi1p = \
phi1.p_stabilize_and_lift(
p
, prec
, ap = psi1(ap)
, alpha = alpha
, check = False
, new_base_ring = R )

except Exception:
traceback.print_exc()


The above code delivers now the following error:

Traceback (most recent call last):
File "<ipython-input-945-35e0bb0e7888>", line 34, in <module>
, new_base_ring = R )
File "/usr/lib/python2.7/site-packages/sage/modular/pollack_stevens/modsym.py", line 1495, in p_stabilize_and_lift
new_base_ring=new_base_ring, check=check)
File "/usr/lib/python2.7/site-packages/sage/modular/pollack_stevens/modsym.py", line 1043, in p_stabilize
V = self.parent()._p_stabilize_parent_space(p, new_base_ring)
File "/usr/lib/python2.7/site-packages/sage/modular/pollack_stevens/space.py", line 557, in _p_stabilize_parent_space
raise ValueError("the level is not prime to p")
ValueError: the level is not prime to p


And looking inside the module with the error, /usr/lib/python2.7/site-packages/sage/modular/pollack_stevens/space.py there is an intentioned check that the prime does not divide the level:

    N = self.level()
if N % p == 0:
raise ValueError("the level is not prime to p")


Explicitly, the road to the error is as follows. We submit phi1 to the method p_stabilize_and_lift . After some steps, the code lands in the method p_stabilize of this instance of the class class PSModularSymbolElement_symk(PSModularSymbolElement) (the instance is phi1).

This method builds the space

    V = self.parent()._p_stabilize_parent_space(p, new_base_ring)


and we land in the module space.py. To see the error, we type explicitly with our data:

sage: phi1
Modular symbol of level 35 with values in Sym^0 (5-adic Unramified Extension Field in a defined by x^2 + x - 4)^2
sage: phi1.parent()
Space of modular symbols for Congruence Subgroup Gamma0(35) with sign 1 and values in Sym^0 (5-adic Unramified Extension Field in a defined by x^2 + x - 4)^2
sage: phi1.parent().level()
35


Note: It is hard to say more, some details on the mathematical part are needed. (It happens to me that finding programming errors becomes easy first after understanding the special cases. From the examples in the method giving the final error, all levels are coprime w.r.t. the submitted prime numbers.) It's all i have. Parts of the code above are adapted to the given example. Guessing the new_base_ring is not good enough in the given situation, also the alpha had to be declared explicitly. But the space construction was explicitly prohibited and i decided to stop here. (There are too few comments, book / web references in the code, i really have no more chance.)