CoCalc Shared Filescode / twistedlseries.sagews
import psage.helloworld
import psage.number_fields.sqrt5.prime

from psage.lseries.eulerprod import LSeriesEllipticCurveSqrt5

LSeriesEllipticCurveSqrt5

<class 'psage.lseries.eulerprod.LSeriesEllipticCurveSqrt5'>
def rep(alpha, primes):
vals = []
for p in primes:
vals += [p.ideallog(alpha)[0]]
return vals

class NFChar():
def __init__(self, factored_conductor, rootlist, order, zeta = None):
assert all(p.is_prime() for p in factored_conductor), "factored_conductor contains an element that is not prime"
self._factored_conductor = factored_conductor
self._primes_conductor = [p.smallest_integer() for p in factored_conductor]
self._rootlist = rootlist
assert gcd(rootlist+[d])==1, "the order of the character is not %s"%(order)
self._order = order
if zeta is None:
self._zeta = CC.zeta(d)
else:
#assert zeta**d==1
self._zeta = zeta

K = factored_conductor[0].number_field()
assert K.class_number()==1

for g in K.unit_group().gens():
assert self._call_nf_elt(K(g)) == 1, " character is not 1 on units"

def __call__(self, p):
return self._call_nf_elt(p.gens_reduced()[0])

def _call_nf_elt(self,alpha):
fact = self._factored_conductor
rootlist = self._rootlist

for p,q in zip(self._primes_conductor,fact):
if p.divides(alpha.norm()) and alpha in q:
return 0
#return m.ideallog(p.gens_reduced()[0])
reps = rep(alpha, [prime for prime in fact])

return self._zeta**(sum([rootlist[i]*reps[i] for i in range(len(rootlist))]) % self._order)

def is_primitive(self):
return all(i%self._order != 0 for i in self._rootlist)

def conductor(self):
return prod(self._factored_conductor).norm()

def order(self):
return self._order

#K.<phi>=NumberField(x^2 -x-1)
E = EllipticCurve(F, [1, a + 1, a, a, 0])
m = F.prime_above(29)#*K.prime_above(3) #* K.prime_above(13) * K.prime_above(5) * K.prime_above(23)
m.norm()
d = 2
fact = [prime for (prime, i) in m.factor()]

29
E

Elliptic Curve defined by y^2 + x*y + a*y = x^3 + (a+1)*x^2 + a*x over Number Field in a with defining polynomial x^2 - x - 1
L = LSeriesEllipticCurveSqrt5(E)

L.anlist(100)



foundlist = d*[1]
for t in Integers(d)^len(m.factor()):
try:
if 0 in list(t):
continue
rootlist = list(t.lift())
chi = NFChar(fact,rootlist,d)
foundlist = rootlist

print rootlist
except:
pass

[1]
newchi = NFChar(fact, foundlist, d)
newchi(F.prime_above(3))
L = LSeriesEllipticCurve(E)
L = LSeriesEllipticCurveSqrt5(E)
print "done1"
LEchi =  LSeriesTwist(L, newchi, epsilon='solve', conductor=ZZ(5^2*E.conductor().norm()*(newchi.conductor()^2)))
print E.conductor().norm()
print newchi.conductor()
print 5^2*E.conductor().norm()*(newchi.conductor()^2)
LEchi
print "done2"

-1.00000000000000 done1 31 29 651775 Twist of L-series of Elliptic Curve defined by y^2 + x*y + a*y = x^3 + (a+1)*x^2 + a*x over Number Field in a with defining polynomial x^2 - x - 1 by <__builtin__.NFChar instance at 0x7fd01a963680> done2
LEchi.anlist(100)
L.conductor()
L.epsilon()
L.number_of_coefficients(2)
L.degree()
L.hodge_numbers()
L(3/2)
LEchi.conductor()
LEchi.number_of_coefficients(5)
LEchi.degree()
LEchi.hodge_numbers()
#LEchi(ComplexField(5)(3/2))

[0, 1, -0.000000000000000, -0.000000000000000, -3.00000000000000, 2.00000000000000, 0.000000000000000, -0.000000000000000, -0.000000000000000, 2.00000000000000, -0.000000000000000, -8.00000000000000, 0.000000000000000, 0, 0.000000000000000, -0.000000000000000, 5.00000000000000, 0, -0.000000000000000, -8.00000000000000, -6.00000000000000, 0.000000000000000, 0.000000000000000, 0, 0.000000000000000, -1.00000000000000, 0.000000000000000, -0.000000000000000, 0.000000000000000, 2.00000000000000, 0.000000000000000, 9.00000000000000, -0.000000000000000, 0.000000000000000, 0.000000000000000, -0.000000000000000, -6.00000000000000, 0, 0.000000000000000, 0.000000000000000, -0.000000000000000, 0.000000000000000, 0.000000000000000, 0, 24.0000000000000, 4.00000000000000, 0.000000000000000, 0, -0.000000000000000, 2.00000000000000, 0.000000000000000, 0.000000000000000, 0.000000000000000, 0, 0.000000000000000, -16.0000000000000, 0.000000000000000, 0.000000000000000, -0.000000000000000, -8.00000000000000, 0.000000000000000, 8.00000000000000, -0.000000000000000, -0.000000000000000, -3.00000000000000, 0.000000000000000, 0.000000000000000, 0, 0.000000000000000, 0.000000000000000, 0.000000000000000, 8.00000000000000, -0.000000000000000, 0, 0.000000000000000, 0.000000000000000, 24.0000000000000, 0.000000000000000, 0.000000000000000, -16.0000000000000, 10.0000000000000, -5.00000000000000, 0.000000000000000, 0, 0.000000000000000, 0.000000000000000, 0.000000000000000, -0.000000000000000, 0.000000000000000, -16.0000000000000, 0.000000000000000, 0.000000000000000, 0.000000000000000, -0.000000000000000, 0.000000000000000, -16.0000000000000, 0.000000000000000, 0, -0.000000000000000, -16.0000000000000, 3.00000000000000] 775 1 534 2 [0, 0, 1, 1]
Error in lines 7-7 Traceback (most recent call last): File "/projects/sage/sage-7.5/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 1, in <module> File "./psage/lseries/eulerprod.py", line 1300, in __call__ return self._function(prec(s))(s) File "sage/misc/cachefunc.pyx", line 2038, in sage.misc.cachefunc.CachedMethodCaller.__call__ (/projects/sage/sage-7.5/src/build/cythonized/sage/misc/cachefunc.c:10792) w = self._instance_call(*args, **kwds) File "sage/misc/cachefunc.pyx", line 1914, in sage.misc.cachefunc.CachedMethodCaller._instance_call (/projects/sage/sage-7.5/src/build/cythonized/sage/misc/cachefunc.c:10238) return self.f(self._instance, *args, **kwds) File "./psage/lseries/eulerprod.py", line 1410, in _function return self._dokchitser(prec, eps, T=T) File "./psage/lseries/eulerprod.py", line 1455, in _dokchitser X = self.anlist(n, prec) File "./psage/lseries/eulerprod.py", line 1176, in anlist self._precompute_local_factors(bound+1, prec=prec) File "./psage/lseries/eulerprod.py", line 1957, in _precompute_local_factors from psage.ellcurve.lseries.aplist_sqrt5 import aplist File "/projects/sage/sage-7.5/local/lib/python2.7/site-packages/pyximport/pyximport.py", line 445, in load_module language_level=self.language_level) File "/projects/sage/sage-7.5/local/lib/python2.7/site-packages/pyximport/pyximport.py", line 234, in load_module exec("raise exc, None, tb", {'exc': exc, 'tb': tb}) File "/projects/sage/sage-7.5/local/lib/python2.7/site-packages/pyximport/pyximport.py", line 216, in load_module inplace=build_inplace, language_level=language_level) File "/projects/sage/sage-7.5/local/lib/python2.7/site-packages/pyximport/pyximport.py", line 192, in build_module reload_support=pyxargs.reload_support) File "/projects/sage/sage-7.5/local/lib/python2.7/site-packages/pyximport/pyxbuild.py", line 102, in pyx_to_dll dist.run_commands() File "/projects/sage/sage-7.5/local/lib/python/distutils/dist.py", line 953, in run_commands self.run_command(cmd) File "/projects/sage/sage-7.5/local/lib/python/distutils/dist.py", line 972, in run_command cmd_obj.run() File "/projects/sage/sage-7.5/local/lib/python2.7/site-packages/Cython/Distutils/old_build_ext.py", line 185, in run _build_ext.build_ext.run(self) File "/projects/sage/sage-7.5/local/lib/python/distutils/command/build_ext.py", line 340, in run self.build_extensions() File "/projects/sage/sage-7.5/local/lib/python2.7/site-packages/Cython/Distutils/old_build_ext.py", line 193, in build_extensions self.build_extension(ext) File "/projects/sage/sage-7.5/local/lib/python/distutils/command/build_ext.py", line 499, in build_extension depends=ext.depends) File "/projects/sage/sage-7.5/local/lib/python/distutils/ccompiler.py", line 574, in compile self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts) File "/projects/sage/sage-7.5/local/lib/python/distutils/unixccompiler.py", line 126, in _compile raise CompileError, msg ImportError: Building module psage.ellcurve.lseries.aplist_sqrt5 failed: ["CompileError: command 'gcc' failed with exit status 1\n"]