I have the polynomials of a certain Eisenstein series. Those are given in the following way:
var('q','z');
K.<sqrt5> = QuadraticField(5);
d2 = [(0, 0, 1), (1/10sqrt5 + 1/2, 0, 30), (1/10sqrt5 + 1/2, -1/5sqrt5 - 1, 1), (1/10sqrt5 + 1/2, 1/5sqrt5 + 1, 1), (1/10sqrt5 + 1/2, -3/10sqrt5 - 1/2, 12), (1/10sqrt5 + 1/2, 3/10sqrt5 + 1/2, 12), (1/10sqrt5 + 1/2, -1/10sqrt5 - 1/2, 20), (1/10sqrt5 + 1/2, 1/10sqrt5 + 1/2, 20), (1/10sqrt5 + 1/2, 1/5sqrt5, 12), (1/10sqrt5 + 1/2, -1/5sqrt5, 12), (-1/10sqrt5 + 1/2, 0, 30), (-1/10sqrt5 + 1/2, -1/10sqrt5 - 1/2, 12), (-1/10sqrt5 + 1/2, 1/10sqrt5 + 1/2, 12), (-1/10sqrt5 + 1/2, 1/10sqrt5 - 1/2, 12), (-1/10sqrt5 + 1/2, -1/10sqrt5 + 1/2, 12), (-1/10sqrt5 + 1/2, 2/5sqrt5, 1), (-1/10sqrt5 + 1/2, -2/5sqrt5, 1), (-1/10sqrt5 + 1/2, 1/5sqrt5, 20), (-1/10sqrt5 + 1/2, -1/5sqrt5, 20), (-1/5sqrt5 + 1, 0, 60), (-1/5sqrt5 + 1, -1, 20), (-1/5sqrt5 + 1, 1, 20), (-1/5sqrt5 + 1, -3/10sqrt5 - 1/2, 20), (-1/5sqrt5 + 1, 3/10sqrt5 + 1/2, 20), (-1/5sqrt5 + 1, -1/10sqrt5 - 1/2, 60), (-1/5sqrt5 + 1, 1/10sqrt5 + 1/2, 60), (-1/5sqrt5 + 1, 1/10sqrt5 - 1/2, 60), (-1/5sqrt5 + 1, -1/10sqrt5 + 1/2, 60), (-1/5sqrt5 + 1, 3/10sqrt5 - 1/2, 20), (-1/5sqrt5 + 1, -3/10sqrt5 + 1/2, 20), (-1/5sqrt5 + 1, 2/5sqrt5, 30), (-1/5sqrt5 + 1, -2/5sqrt5, 30), (-1/5sqrt5 + 1, 1/5sqrt5, 60), (-1/5sqrt5 + 1, -1/5sqrt5, 60), (1/5sqrt5 + 1, 0, 60), (1/5sqrt5 + 1, -2/5sqrt5 - 1, 20), (1/5sqrt5 + 1, 2/5sqrt5 + 1, 20), (1/5sqrt5 + 1, -1/5sqrt5 - 1, 30), (1/5sqrt5 + 1, 1/5sqrt5 + 1, 30), (1/5sqrt5 + 1, 1/2sqrt5 + 1/2, 20), (1/5sqrt5 + 1, -1/2sqrt5 - 1/2, 20), (1/5sqrt5 + 1, -3/10sqrt5 - 1/2, 60), (1/5sqrt5 + 1, 3/10sqrt5 + 1/2, 60), (1/5sqrt5 + 1, -1/10sqrt5 - 1/2, 60), (1/5sqrt5 + 1, 1/10sqrt5 + 1/2, 60), (1/5sqrt5 + 1, 1/10sqrt5 - 1/2, 20), (1/5sqrt5 + 1, -1/10sqrt5 + 1/2, 20), (1/5sqrt5 + 1, 1/5sqrt5, 60), (1/5sqrt5 + 1, -1/5sqrt5, 60), (-2/5sqrt5 + 1, 0, 30), (-2/5sqrt5 + 1, 1/5sqrt5 - 1, 1), (-2/5sqrt5 + 1, -1/5sqrt5 + 1, 1), (-2/5sqrt5 + 1, 1/10sqrt5 - 1/2, 20), (-2/5sqrt5 + 1, -1/10sqrt5 + 1/2, 20), (-2/5sqrt5 + 1, 3/10sqrt5 - 1/2, 12), (-2/5sqrt5 + 1, -3/10sqrt5 + 1/2, 12), (-2/5sqrt5 + 1, 1/5sqrt5, 12), (-2/5sqrt5 + 1, -1/5sqrt5, 12), (-2/5sqrt5 + 1, 0, 30), (-2/5sqrt5 + 1, 1/5sqrt5 - 1, 1), (-2/5sqrt5 + 1, -1/5sqrt5 + 1, 1), (-2/5sqrt5 + 1, 1/10sqrt5 - 1/2, 20), (-2/5sqrt5 + 1, -1/10sqrt5 + 1/2, 20), (-2/5sqrt5 + 1, 3/10sqrt5 - 1/2, 12), (-2/5sqrt5 + 1, -3/10sqrt5 + 1/2, 12), (-2/5sqrt5 + 1, 1/5sqrt5, 12), (-2/5sqrt5 + 1, -1/5sqrt5, 12), (1, 0, 72), (1, -1/5sqrt5 - 1, 30), (1, 1/5sqrt5 + 1, 30), (1, -1, 12), (1, 1, 12), (1, 1/2sqrt5 + 1/2, 12), (1, -1/2sqrt5 - 1/2, 12), (1, -3/10sqrt5 - 1/2, 60), (1, 3/10sqrt5 + 1/2, 60), (1, -1/10sqrt5 - 1/2, 60), (1, 1/10sqrt5 + 1/2, 60), (1, 1/10sqrt5 - 1/2, 60), (1, -1/10sqrt5 + 1/2, 60), (1, 2/5sqrt5, 30), (1, -2/5sqrt5, 30), (1, 1/5sqrt5, 60), (1, -1/5sqrt5, 60)]
e2 = sum(factor * qexponent * zexp2 for exponent,exp2, factor in d2)
<end>
For example, the first entry in the list d2 would give me the entry 1q^0z^0 with the coefficient 1 and the index (0,0). Now I would like to filter these kind of polynomials to find the coefficients of a certain index.
My naive initial idea was to use the method (e2).coefficients() and then search via comparison.The problem that I am having is that I cannot "compare" the values of the index via "==" since the types are not compatible. So, this for example
type(p.coefficients()[1][1])
<end>
yields "<class 'sage.symbolic.expression.expression'="">" and I cannot compare this to an expression like "-2*sqrt(1/5) + 1".
Where is my mistake and is there an easy fix to this? Thanks in advance!