Ask Your Question

# Series expansion for theta function of even lattice

I am new to sage and trying to figure out how to calculate the series expansion of the theta function for an even lattice $L$, i.e. $$\Theta_L(q)=\sum_{x\in L} q^{\langle x,x\rangle/2}$$

I tried the following code for the $A_2$ lattice, but I doesn't really do what its supposed to do

Q=QuadraticForm(QQ,2,[2,-1,2]); Q
Q.theta_series(20)


I found the following code on https://oeis.org/A004016 (OEIS), which gives the correct result:

ModularForms( Gamma1(3), 1, prec=81).0

edit retag close merge delete

## 2 Answers

Sort by » oldest newest most voted

Please let me answer using an epic style, since it reflects my experience with these objects.

Let $A$ be the quadratic form from the above post...

sage: A = QuadraticForm( QQ, 2, [2, -1, 2] )
sage: A
Quadratic form in 2 variables over Rational Field with coefficients:
[ 2 -1 ]
[ * 2 ]


A longer time i thought this is the quadratic form corresponding to the symmetrically extended matrix with those entries, i.e. to...

sage: MA = matrix( QQ, 2, 2, [ 2, -1, -1, 2] )
sage: MA
[ 2 -1]
[-1  2]


since what else should be the star?! ...till i got an error, then searching for it was typing something like...

sage: A
Quadratic form in 2 variables over Rational Field with coefficients:
[ 2 -1 ]
[ * 2 ]
sage: A.matrix()    # oh, there is a matrix method!
[ 4 -1]
[-1  4]
sage: MA = matrix( QQ, 2, 2, [ 2, -1, -1, 2] )
sage: MA
[ 2 -1]
[-1  2]

sage: v = vector( [100, 10] )
sage: A(v)
19200
sage: 2 * 100^2 - 2*100*10 + 10^2
18100
sage: 2 * 100^2 -   100*10 + 10^2
19100
sage: ( v * A.matrix() * v.column() ) / 2
(19200)
sage: ( v * MA         * v.column() ) / 2
(9100)
sage: ( v * MA         * v.column() )
(18200)


And the quadratic form A is not quite reflected by the symmetic matrix MA. What is going on here? I think, the answer to the question is already here, despite of the fact that there is only one more question...

In the given posted situation with the Q, i suspect the quadratic form written for the above matrix MA instead is needed / intended, the one which maps the vector $x$ with components $s,t$ to $$q_A(x)=\frac 12\langle x,x\rangle_A =\frac 12(2s^2-2st+t^2) = x^2-xy+y^2\ .$$

Since the expected theta series is an other one, let us consider "the other quadratic form", and the theta series associated to it...

sage: B = QuadraticForm( QQ, 2, [1, -1, 1] )
sage: B
Quadratic form in 2 variables over Rational Field with coefficients:
[ 1 -1 ]
[ * 1 ]
sage: B.theta_series( 20 )
1 + 6*q + 6*q^3 + 6*q^4 + 12*q^7 + 6*q^9 + 6*q^12 + 12*q^13 + 6*q^16 + 12*q^19 + O(q^20)


...is in agreement with

sage: ModularForms( Gamma1(3), 1, prec=20 ).0
1 + 6*q + 6*q^3 + 6*q^4 + 12*q^7 + 6*q^9 + 6*q^12 + 12*q^13 + 6*q^16 + 12*q^19 + O(q^20)


and in fact the first $1000$ coefficients do coincide... For this we may try successively to get them (right):

sage: b = B.theta_series( 1000 )
sage: m = ModularForms( Gamma1(3), 1, prec=20 ).0

sage: b.coefficients()[:20]    # !only non zero coefficients shown
[1, 6, 6, 6, 12, 6, 6, 12, 6, 12, 12, 6, 6, 12, 12, 6, 12, 12, 12, 6]
sage: m.coefficients( 1000 )[:20]   # !first coeff is not shown
[6, 0, 6, 6, 0, 0, 12, 0, 6, 0, 0, 6, 12, 0, 0, 6, 0, 0, 12, 0]

sage: b.coefficients()[:20]    # !only non zero coefficients shown
[1, 6, 6, 6, 12, 6, 6, 12, 6, 12, 12, 6, 6, 12, 12, 6, 12, 12, 12, 6]
sage: b.polynomial().coeffs()[:20]
[1, 6, 0, 6, 6, 0, 0, 12, 0, 6, 0, 0, 6, 12, 0, 0, 6, 0, 0, 12]
sage: m.coefficients(1000)[:20]    # !first coefficient, the starting one, not shown
[6, 0, 6, 6, 0, 0, 12, 0, 6, 0, 0, 6, 12, 0, 0, 6, 0, 0, 12, 0]

sage: b.polynomial().coeffs()[1:20] == m.coefficients(1000)[:19]
True
sage: b.polynomial().coeffs()[1:1000] == m.coefficients(1000)[:999]
True


I hope we are both at home now, know which maths object is which sage object.

more

## Comments

Very interesting. Do you think that the documentation for QuadraticForm needs updating to make all this clearer?

( 2017-06-23 04:41:18 +0200 )edit

The present documentation is strong enough. But because many people in all ages, countries, and target fields are using the software, some of them will always be confused at some point.

In this case, one could for instance...

• set a 0 instead of each subdiagonal star in the print (in the __str__ or __repr__ method) of the quadratic form
• or even better mention its discriminant in it,
• give some examples at the top of the doc that eliminates this misleading point... (In my course, immediately after introducing a quadratic form, the matrix for it was defined and assumed to be symmetric. There was no discussion about how to initialize it best in a software. And so it is on my own HD.)
• and also give some examples (with a special count in low degrees) for the theta_series method.
( 2017-06-23 23:45:36 +0200 )edit

Thanks a lot. I figured this in the meanwhile and wrote my own answer which i guess needed moderating. I definitely think the documentation should be updated. Or an example like $A_2$ should be given.

( 2017-06-24 01:19:12 +0200 )edit

@dan_fulea, can you open a ticket since you understand this better?

( 2017-06-24 16:30:12 +0200 )edit

I am rather new in the sage community, how can i do this? (Open a ticket, implement - in this case rather only add documentation in the doc string of some modules, some examples for instance, then commit changes, etc.) Is there a page or a mailing list i could subscribe to?! Thanks!

( 2017-07-28 18:52:09 +0200 )edit

There is a simpler explanation, which is that the quadratic form

[ 2 -1 ]
[ *  2 ]


Maps to the matrix

[ 2 -1 ]
[ 0  2 ]


Which is equivalent to the symmetric matrix

[2    -1/2]
[-1/2    2]


Which can be gotten with A.Gram_matrix().

The A.matrix() function listed in the answer above is the Hessian, which is double the Gram matrix.

The documentation for Gram matrix gives as an example a Quadratic form with diagonal matrix. Should probably be updated to include off-diagonal terms to make this clearer.

more

## Your Answer

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

Add Answer

## Stats

Asked: 2017-06-22 02:45:53 +0200

Seen: 647 times

Last updated: Jun 22 '17