Ask Your Question
0

How does one get a list of Fourier coefficients from a q-series?

asked 2018-11-23 18:42:30 +0200

anonymous user

Anonymous

I'm new to working with SAGE, I need to check congruences with modular forms, this requires that I am able to construct a list of Fourier coefficients from the q series of a modular form, how does this work?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-11-26 12:44:38 +0200

dan_fulea gravatar image

Here is some example. Things are depending on the way the modular form is declared / constructed. Here i use the modular forms space constructor, ask for a basis, use its first element, get its $q$-series, then ask for the list of its coefficients.

sage: ModularForms?
sage: MF53_2 = ModularForms(Gamma0(53), 2 )
sage: f = MF53_2.basis()[0]
sage: f
q - 2/3*q^5 + O(q^6)
sage: f.q_expansion(20)
q - 2/3*q^5 - 1/3*q^6 + 1/3*q^7 - 2/3*q^8 + q^9 - q^10 - 1/3*q^11 - 2/3*q^12 + 1/3*q^13 - 5/3*q^15 - 5/3*q^16 - q^17 - 2*q^18 + 8/3*q^19 + O(q^20)
sage: list(f.q_expansion(20))
[0,
 1,
 0,
 0,
 0,
 -2/3,
 -1/3,
 1/3,
 -2/3,
 1,
 -1,
 -1/3,
 -2/3,
 1/3,
 0,
 -5/3,
 -5/3,
 -1,
 -2,
 8/3]

Note there is a "well-known" trap with this:

sage: fq = f.q_expansion(20)
sage: fq.coefficients()
[1, -2/3, -1/3, 1/3, -2/3, 1, -1, -1/3, -2/3, 1/3, -5/3, -5/3, -1, -2, 8/3]
sage: fq.coefficients?
Docstring:     
   Return the nonzero coefficients of self.

and the doc string continues. (I always fall into it, have no idea why such a function exists - at least i would expect an optional argument / flag that - when set - to insist in giving all coefficients, also the zero ones.)

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

1 follower

Stats

Asked: 2018-11-23 18:42:30 +0200

Seen: 717 times

Last updated: Nov 26 '18