| 1 | initial version |
If i am correctly understanding the question, the programming issue is related to finding a common ring to work in for the following objects:
Obviously, we should have the bridge $q=t^2$. Since $q$ can be algebraically obtained from $t$, but not conversely, we will work with $t$. So we work in the power series ring over $\Bbb Q$ in the variable $t$.
Here is a way to initialize the above objects, and work with them in a common world.
q_PREC = 8
t_PREC = 2*q_PREC
R.<t> = PowerSeriesRing(QQ, default_prec=t_PREC)
E4 = eisenstein_series_qexp(4, prec=q_PREC, var='q', normalization = 'constant')
RQ = E4.parent()
RQ.inject_variables() # this is defining the variable q used by default in E4
print(f'E4 = E4(q) is {E4}')
print(f'E4(t^2) is {E4(t^2)}')
Results:
Defining q
E4 = E4(q) is 1 + 240*q + 2160*q^2 + 6720*q^3 + 17520*q^4 + 30240*q^5 + 60480*q^6 + 82560*q^7 + O(q^8)
E4(t^2) is 1 + 240*t^2 + 2160*t^4 + 6720*t^6 + 17520*t^8 + 30240*t^10 + 60480*t^12 + 82560*t^14 + O(t^16)
I hope the way the programming strategy would work is now clear. Let us define in $\Bbb Q[[t]]$ (modulo $t^{2\cdot 8}$) the following objects:
E4t = E4(t^2) + O(t^t_PREC)
Theta3 = theta_qexp(q_PREC)(t^2) + O(t^t_PREC)
print(f'E4t * Theta3 is:\n{E4t * Theta3}')
g = E4t - Theta3
gdic = g.dict()
print(f'E4t - Theta3 is:\n{g}')
print(f'The coefficients of E4t - Theta3 are as in the dictionary:\n{gdic}')
print('The first coefficients are:')
for k in [0..10]:
print(f'Coefficient in degree {k} is {gdic.get(k, 0)}')
The results are:
E4t * Theta3 is:
1 + 242*t^2 + 2640*t^4 + 11040*t^6 + 30962*t^8 + 65760*t^10 + 125280*t^12 + 216960*t^14 + O(t^16)
E4t - Theta3 is:
238*t^2 + 2160*t^4 + 6720*t^6 + 17518*t^8 + 30240*t^10 + 60480*t^12 + 82560*t^14 + O(t^16)
The coefficients of E4t - Theta3 are as in the dictionary:
{2: 238, 4: 2160, 6: 6720, 8: 17518, 10: 30240, 12: 60480, 14: 82560}
The first coefficients are:
Coefficient in degree 0 is 0
Coefficient in degree 1 is 0
Coefficient in degree 2 is 238
Coefficient in degree 3 is 0
Coefficient in degree 4 is 2160
Coefficient in degree 5 is 0
Coefficient in degree 6 is 6720
Coefficient in degree 7 is 0
Coefficient in degree 8 is 17518
Coefficient in degree 9 is 0
Coefficient in degree 10 is 30240
The coefficients of a power series are not really obtained in a natural way. The method g.coefficients() shows them, but you have to guess the degrees. You can try [coeff for coeff in g] to have the coefficients quickly in a list.
sage: [coeff for coeff in g]
[0, 0, 238, 0, 2160, 0, 6720, 0, 17518, 0, 30240, 0, 60480, 0, 82560]
An other way is to associate the dictionary gdic as above, since for sparse power series it may be useful. For instance:
sage: theta2_qexp(300).dict()
{1: 1, 9: 1, 25: 1, 49: 1, 81: 1, 121: 1, 169: 1, 225: 1, 289: 1}
sage: theta2_qexp(300)(t^2).dict()
{2: 1, 18: 1, 50: 1, 98: 1, 162: 1, 242: 1, 338: 1, 450: 1, 578: 1}
Note that for missing degrees, we have to provide the default value, zero. For instance:
sage: th2_dic = theta2_qexp(300)(t^2).dict()
sage: th2_dic.get(18)
1
sage: th2_dic.get(19)
sage: type(th2_dic.get(19))
<class 'NoneType'>
sage: th2_dic.get(19, 0)
0
sage: type(th2_dic.get(19, 0))
<class 'sage.rings.integer.Integer'>
I hope the above way to proceed works for the purpose, good luck in your research projects!
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.