Skip to content

Commit 7e9b35f

Browse files
committed
better fix and conversion
1 parent 5e80d88 commit 7e9b35f

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

lmfdb/lfunctions/Lfunction.py

+10-7
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,8 @@ def apply_coeff_info(L, coeff_info):
364364
the format in the database to algebraic and analytic form
365365
"""
366366

367-
def convert_coefficient(an, base_power_int):
367+
base_power_int = int(coeff_info[0][2:-3])
368+
def convert_coefficient(an):
368369
"""
369370
this is only meant for dirichlet L-functions, and
370371
converts the format in the database to algebraic and analytic form
@@ -397,19 +398,21 @@ def convert_coefficient(an, base_power_int):
397398
res = arithmetic, analytic
398399
return res[0], CDF(res[1])
399400

400-
base_power_int = int(coeff_info[0][2:-3])
401401
fix = None
402-
for n, an in enumerate(L.dirichlet_coefficients_arithmetic):
403-
L.dirichlet_coefficients_arithmetic[n], L.dirichlet_coefficients[n] = convert_coefficient(an, base_power_int)
402+
for n, an in enumerate(L.dirichlet_coefficients_arithmetic[:]):
403+
L.dirichlet_coefficients_arithmetic[n], L.dirichlet_coefficients[n] = convert_coefficient(an)
404404
# checks if we need to fix the Euler factors
405405
if is_prime(n+1) and L.dirichlet_coefficients_arithmetic[n] != 0:
406406
p = n + 1
407+
idx = prime_pi(p)-1
408+
ap = L.dirichlet_coefficients[p-1]
409+
ef_ap = -convert_coefficient(L.localfactors[idx][1])[1]
407410
if fix is None:
408-
fix = L.dirichlet_coefficients_arithmetic[p-1] == L.localfactors[prime_pi(p)-1][1]
409-
assert L.dirichlet_coefficients_arithmetic[p-1] == (1 if fix else -1)*L.localfactors[prime_pi(p)-1][1]
411+
fix = (ap - ef_ap).abs() > 1e-5
412+
assert (ap - (-1 if fix else 1)*ef_ap).abs() < 1e-5
410413

411414
def convert_euler_Lpoly(poly_coeffs):
412-
Fp = [convert_coefficient(c, base_power_int)[1] for c in poly_coeffs]
415+
Fp = [convert_coefficient(c)[1] for c in poly_coeffs]
413416
# WARNING: the data in the database is wrong!
414417
# it lists Fp(-T) instead of Fp(T)
415418
# this is a temporary fix

0 commit comments

Comments
 (0)