Ask Your Question

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

asked 2020-03-23 12:36:44 -0500

updated 2020-03-25 10:22:05 -0500

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)
e = G.0
S = CuspForms(e, 3, prec=20)
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


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

vdelecroix gravatar imagevdelecroix ( 2020-03-24 14:07:11 -0500 )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 10:19:19 -0500 )edit

1 answer

Sort by » oldest newest most voted

answered 2020-03-24 13:18:39 -0500

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


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 10:21:06 -0500 )edit

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

FrédéricC gravatar imageFrédéricC ( 2020-03-25 12:21:18 -0500 )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-26 18:52:59 -0500 )edit

missing pair of parentheses after expansion

FrédéricC gravatar imageFrédéricC ( 2020-03-27 01:38:34 -0500 )edit

Your Answer

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

Add Answer

Question Tools


Asked: 2020-03-23 12:36:44 -0500

Seen: 40 times

Last updated: Mar 25