Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
166 views
var_string = "" deg = 4 for i in range(deg): var_string += "a" var_string += str(i) var_string += ", " var_string += "a" var_string += str(deg) a = var(var_string) RRR.<x,y> = SR['x,y'] f = sum([a[i] * x^(deg-i) * y^i for i in range(deg+1)]) A, B, C = var('A, B, C') QF = A*x^2 + B*x*y + C*y^2 Lap_f = C*derivative(f,x,2) - B * derivative(f,x,y) + A * derivative(f,y,2) mat_var = matrix([[Lap_f.coefficients()[j].coefficient(a[i]) for i in range(deg+1)] for j in range(3)]) mat_var #Choose values for the quadratic form here. N is the discriminant. AA = 1 BB = 0 CC = 5 N = (BB^2 - 4*AA*CC).abs() #Redefining values. Before, we computed using symbolic expressions. Now, will work in rational polynomials in x and y. mat = mat_var.subs(A==AA, B==BB, C==CC) A = AA B = BB C = CC P.<x, y> = QQ['x,y'] QF = A*x^2 + B*x*y + C*y^2 ]
[12*C -3*B 2*A 0 0] [ 0 6*C -4*B 6*A 0] [ 0 0 2*C -3*B 12*A] mat mat
cand_mod cand_mod_coeffs len(cand_mod_coeffs) print"\n" B[0] mod_bas_list[0] len(mod_bas_list[0])
Mprec = ModularForms(Gamma1(N), 1+deg, prec = 2*bound) Bprec = Mprec.basis() is_modprec = sum([is_mod_Bcoeffs[i] * Bprec[i] for i in range(len(B))]) cand_modprec = sum([ sum( [ QQ(f(x=a,y=b)) * q^(A*a^2 + B*a*b + C*b^2) for a in range(-2*lim,2*lim) ] ) for b in range(-2*lim,2*lim) ] ) + O(q^(2*bound)) [is_modprec.padded_list(nbound)[i] - cand_modprec.list()[0:nbound][i] for i in range(nbound)]
Error in lines 4-12 Traceback (most recent call last): File "/projects/sage/sage-7.6/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 995, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 7, in <module> File "sage/rings/integer.pyx", line 1594, in sage.rings.integer.Integer.__add__ (/projects/sage/sage-7.6/src/build/cythonized/sage/rings/integer.c:11059) return coercion_model.bin_op(left, right, operator.add) File "sage/structure/coerce.pyx", line 1104, in sage.structure.coerce.CoercionModel_cache_maps.bin_op (/projects/sage/sage-7.6/src/build/cythonized/sage/structure/coerce.c:10499) raise bin_op_exception(op, x, y) TypeError: unsupported operand parent(s) for +: 'Integer Ring' and '<type 'list'>'
a = 1 b = 1 A
bound = 20 F = RealField(10) A = 1 B = 1 blim = (F(bound*4 * A/N).sqrt()).ceil() def alims(y): ans = [] ans.append(F(-(bound/A).sqrt() - (B/(2*A))*y).floor()) ans.append(F((bound/A).sqrt() - (B/(2*A)*y)).floor()) return ans def alims2(y): ans = [] ans.append(F(-(bound/A).sqrt() - (B/2*A)*y).floor()) ans.append(F((bound/A).sqrt() - (B/2*A)*y).floor()) return ans alims(5)
Error in lines 6-10 Traceback (most recent call last): File "/projects/sage/sage-7.6/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 995, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "<string>", line 5 return ans ^ SyntaxError: invalid syntax
nbound = 150 nlim = nbound Mprec = ModularForms(Gamma1(N), 1+deg, prec=nbound) basprec = Mprec.basis() is_modprec = sum([is_mod_Bcoeffs[i] * basprec[i] for i in range(len(basprec))]) cand_modprec = sum([sum([QQ(f(x=a,y=b)) * q^(A*a^2 + B*a*b + C*b^2) for a in range(-nlim,nlim)]) for b in range(-nlim,nlim)]) + O(q^nbound) is_modprec print"\n" cand_modprec [is_modprec.padded_list(nbound)[i] - cand_modprec.list()[0:nbound][i] for i in range(nbound)]