Ask Your Question
3

How to do arithmetic with a basis element from modular forms space

asked 2020-03-23 18:36:44 +0100

FundamentalDomain gravatar image

updated 2020-03-25 16:22:05 +0100

Hi, I'm new to Sage and coding in general. I want to look at the 1-dim'l space CuspForms(Gamma0(7), 3) but with character. Here's my code for that

S = G = DirichletGroup(7, QQ)
list(G)
G.gens()
e = G.0
S = CuspForms(e, 3, prec=20)
print(S)
print(Gamma0(7).cusps())
print(S.basis())
g = S.0

Here, g is the only basis element for S. I want to do F = g*(L+4) where L is some eta-quotient of level 7. However, I get a long error with 'NoneType' object is not iterable at the end. So I'm thinking I need to define g in a different way, since it seems to be that g is not a q-series type object the way I've defined it?

edit retag flag offensive close merge delete

Comments

It would be helpful to have the complete code you used to produce L as well...

vdelecroix gravatar imagevdelecroix ( 2020-03-24 20:07:11 +0100 )edit

Yes, sorry. It's L = EtaProduct(7, {1:4, 7:-4}). I also mixed up the level on accident but edited to fix. It's 7.

FundamentalDomain gravatar imageFundamentalDomain ( 2020-03-25 16:19:19 +0100 )edit

2 Answers

Sort by » oldest newest most voted
4

answered 2020-03-24 19:18:39 +0100

FrédéricC gravatar image

You can get the associated formal power series as follows:

sage: g
q - 3*q^2 + 5*q^4 - 7*q^7 - 3*q^8 + 9*q^9 - 6*q^11 + 21*q^14 - 11*q^16 - 27*q^18 + O(q^20)
sage: parent(g)
Cuspidal subspace of dimension 1 of Modular Forms space of dimension 3, character [-1] and weight 3 over Rational Field
sage: g.q_expansion()
q - 3*q^2 + 5*q^4 - 7*q^7 - 3*q^8 + 9*q^9 - 6*q^11 + 21*q^14 - 11*q^16 - 27*q^18 + O(q^20)
sage: parent(_)
Power Series Ring in q over Rational Field
edit flag offensive delete link more

Comments

Yes, but if I try something like g*L.q_expansion() or g*L.qexp(20) or things like that I get that error.

FundamentalDomain gravatar imageFundamentalDomain ( 2020-03-25 16:21:06 +0100 )edit
1

Try g.q_expansion() * L.q_expansion()

FrédéricC gravatar imageFrédéricC ( 2020-03-25 18:21:18 +0100 )edit

It worked!!! So when I do print(g.q_expansion()*L.q_expansion) something goes wrong, but leaving out "print" seems to fix this... weird.

FundamentalDomain gravatar imageFundamentalDomain ( 2020-03-27 00:52:59 +0100 )edit

missing pair of parentheses after expansion

FrédéricC gravatar imageFrédéricC ( 2020-03-27 07:38:34 +0100 )edit
0

answered 2020-04-22 17:49:50 +0100

dan_fulea gravatar image

The answer of FrédéricC is already wonderful, here is maybe a way to make your own way in the next similar situation. First of all, let us consider the code:

G = DirichletGroup(7, QQ)                                                                                               
S = CuspForms(e, 3, prec=20)                                                                                            
g = S.gens()[0]                                                                                                         
print( f"g = {g}" )
R = g.qexp().parent()
print( f"R = {R}\nIts default precision is {R.default_prec()}" )
q = R.gen()

L = EtaProduct(7, {1:4, 7:-4})
print( f"L = {L}" )

The above gives

g = q - 3*q^2 + 5*q^4 - 7*q^7 - 3*q^8 + 9*q^9 - 6*q^11 + 21*q^14 - 11*q^16 - 27*q^18 + O(q^20)
R = Power Series Ring in q over Rational Field
Its default precision is 20
L = Eta product of level 7 : (eta_1)^4 (eta_7)^-4

Now i noted that the method L.qexp needs an argument. At least for me in my version. This can be seen / asked in the ipython interpreter for sage as follows...

sage: L.qexp?                                                                                                                 
Signature:      L.qexp(n)
Docstring:     
   Alias for "self.q_expansion()".

   EXAMPLES:

      sage: e = EtaProduct(36, {6:8, 3:-8})
      sage: e.qexp(10)
      q + 8*q^4 + 36*q^7 + O(q^10)
      sage: e.qexp(30) == e.q_expansion(30)
      True
Init docstring: Initialize self.  See help(type(self)) for accurate signature.
File:           /usr/lib/python3.8/site-packages/sage/modular/etaproducts.py
Type:           method
sage:

and the above L.qexp goes to the doc string of the method qexp in the class L is an instance for:

sage: L.__class__                                                                                                             
<class 'sage.modular.etaproducts.EtaGroupElement'>

So we really need an argument for it in my version.

sage: version()                                                                                                               
'SageMath version 9.0, Release Date: 2020-01-01'

In my case L.qexp() produces an error, since one argument is needed, but this is easily corrected, L.exp(20) would be ok. Since the precision of the series for $g$ is $20$, we should use the same precision... Well:

sage: L.qexp(20)                                                                                                              
q^-1 - 4 + 2*q + 8*q^2 - 5*q^3 - 4*q^4 - 10*q^5 + 12*q^6 - 7*q^7 + 8*q^8 + 46*q^9 - 36*q^10 - 26*q^11 - 44*q^12 + 46*q^13 - 28*q^14 + 42*q^15 + 188*q^16 - 132*q^17 - 96*q^18 + O(q^19)
sage: g.qexp()                                                                                                                
q - 3*q^2 + 5*q^4 - 7*q^7 - 3*q^8 + 9*q^9 - 6*q^11 + 21*q^14 - 11*q^16 - 27*q^18 + O(q^20)

and the series are stopping at the "multiplicative precision" equal to $20$. For $L$ we have an expression modulo $O(q^{19})$ (since it starts with $1/q$), for $g$ we have an expression modulo $O(q^{20})$ . This situation may lead to losing the initial precision.

Now i tried:

  • g + O(q^6), but it fails. (Although fL + O(q^6) works.)
  • g * fL, but it fails. (Although g(q) * fL works.)

To make things work, replace g by g(q)...


So finally, the following code does the job for me. Framework:

PREC = 20
G = DirichletGroup(7, QQ)
S = CuspForms(e, 3, prec=PREC)
g = S.gens()[0]
R = g.qexp().parent()
q = R.gen()

L = EtaProduct(7, {1:4, 7:-4})
fL = L.qexp(PREC)

g(q) * (fL + 4)(q) + O(q^6)

(Addition, multiplication, and truncation work.) Final result:

1 - 3*q + 2*q^2 + 7*q^3 - 29*q^4 + 21*q^5 + O(q^6)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2020-03-23 18:36:44 +0100

Seen: 996 times

Last updated: Apr 22 '20