CoCalc Shared Filescode / wstein-delta.sagews
Authors: Harald Schilly, William A. Stein
%auto
A = ModularSymbols(1, weight=12, sign=-1)
def f(a, b):
return A([5, oo, a/b]).element()[0]
f(0, 1)

-5/12
m = 2003
N(log(m*abs(f(m-1, m)), euler_phi(m)))

10.3032570197013
pow(k) = k-2 + 1/2

float(pow(12))

10.5
def compute_dist_delta(d, m_max):
assert d%2 == 1
ms = [m for m in prime_range(3,m_max+1) if euler_phi(m) % d == 0]

print 'There are %s primes to use up to %s'%(len(ms), m_max)
print ms

k = 12

@parallel
def alphas(m):
assert d%2 == 1
assert euler_phi(m) % d == 0
R = Integers(m)
gen = R(primitive_root(m))
n = euler_phi(m)//d
b = gen
h = gen^d
denom = float((euler_phi(m))^(k-2 + 1/2))
v = []
for i in range(1, (d-1)//2 + 1):
s = 0
for j in range(n):
period = f((b^i * h^j).lift(), m)
s += period
v.append(s / denom)
return v

t0 = walltime()
print "Starting..."
i = 0
data = []
progress = len(ms) // 10 + 1
for result in alphas(ms):
i += 1
if i % progress == 0:
print 'X',; sys.stdout.flush()
data += result[1]
return stats.TimeSeries(data)

%time t = compute_dist_delta(3, 10000)

There are 611 primes to use up to 10000 [7, 13, 19, 31, 37, 43, 61, 67, 73, 79, 97, 103, 109, 127, 139, 151, 157, 163, 181, 193, 199, 211, 223, 229, 241, 271, 277, 283, 307, 313, 331, 337, 349, 367, 373, 379, 397, 409, 421, 433, 439, 457, 463, 487, 499, 523, 541, 547, 571, 577, 601, 607, 613, 619, 631, 643, 661, 673, 691, 709, 727, 733, 739, 751, 757, 769, 787, 811, 823, 829, 853, 859, 877, 883, 907, 919, 937, 967, 991, 997, 1009, 1021, 1033, 1039, 1051, 1063, 1069, 1087, 1093, 1117, 1123, 1129, 1153, 1171, 1201, 1213, 1231, 1237, 1249, 1279, 1291, 1297, 1303, 1321, 1327, 1381, 1399, 1423, 1429, 1447, 1453, 1459, 1471, 1483, 1489, 1531, 1543, 1549, 1567, 1579, 1597, 1609, 1621, 1627, 1657, 1663, 1669, 1693, 1699, 1723, 1741, 1747, 1753, 1759, 1777, 1783, 1789, 1801, 1831, 1861, 1867, 1873, 1879, 1933, 1951, 1987, 1993, 1999, 2011, 2017, 2029, 2053, 2083, 2089, 2113, 2131, 2137, 2143, 2161, 2179, 2203, 2221, 2239, 2251, 2269, 2281, 2287, 2293, 2311, 2341, 2347, 2371, 2377, 2383, 2389, 2437, 2467, 2473, 2503, 2521, 2539, 2551, 2557, 2593, 2617, 2647, 2659, 2671, 2677, 2683, 2689, 2707, 2713, 2719, 2731, 2749, 2767, 2791, 2797, 2803, 2833, 2851, 2857, 2887, 2917, 2953, 2971, 3001, 3019, 3037, 3049, 3061, 3067, 3079, 3109, 3121, 3163, 3169, 3181, 3187, 3217, 3229, 3253, 3259, 3271, 3301, 3307, 3313, 3319, 3331, 3343, 3361, 3373, 3391, 3433, 3457, 3463, 3469, 3499, 3511, 3517, 3529, 3541, 3547, 3559, 3571, 3583, 3607, 3613, 3631, 3637, 3643, 3673, 3691, 3697, 3709, 3727, 3733, 3739, 3769, 3793, 3823, 3847, 3853, 3877, 3889, 3907, 3919, 3931, 3943, 3967, 4003, 4021, 4027, 4051, 4057, 4093, 4099, 4111, 4129, 4153, 4159, 4177, 4201, 4219, 4231, 4243, 4261, 4273, 4297, 4327, 4339, 4357, 4363, 4423, 4441, 4447, 4483, 4507, 4513, 4519, 4549, 4561, 4567, 4591, 4597, 4603, 4621, 4639, 4651, 4657, 4663, 4723, 4729, 4759, 4783, 4789, 4801, 4813, 4831, 4861, 4903, 4909, 4933, 4951, 4957, 4969, 4987, 4993, 4999, 5011, 5023, 5059, 5077, 5101, 5107, 5113, 5119, 5167, 5179, 5197, 5209, 5227, 5233, 5281, 5323, 5347, 5407, 5413, 5419, 5431, 5437, 5443, 5449, 5479, 5503, 5521, 5527, 5557, 5563, 5569, 5581, 5623, 5641, 5647, 5653, 5659, 5683, 5689, 5701, 5737, 5743, 5749, 5779, 5791, 5821, 5827, 5839, 5851, 5857, 5869, 5881, 5923, 5953, 6007, 6037, 6043, 6067, 6073, 6079, 6091, 6121, 6133, 6151, 6163, 6199, 6211, 6217, 6229, 6247, 6271, 6277, 6301, 6337, 6343, 6361, 6367, 6373, 6379, 6397, 6421, 6427, 6451, 6469, 6481, 6529, 6547, 6553, 6571, 6577, 6607, 6619, 6637, 6661, 6673, 6679, 6691, 6703, 6709, 6733, 6763, 6781, 6793, 6823, 6829, 6841, 6871, 6883, 6907, 6949, 6961, 6967, 6991, 6997, 7027, 7039, 7057, 7069, 7129, 7159, 7177, 7207, 7213, 7219, 7237, 7243, 7297, 7309, 7321, 7333, 7351, 7369, 7393, 7411, 7417, 7459, 7477, 7489, 7507, 7537, 7549, 7561, 7573, 7591, 7603, 7621, 7639, 7669, 7681, 7687, 7699, 7717, 7723, 7741, 7753, 7759, 7789, 7867, 7873, 7879, 7927, 7933, 7951, 7963, 7993, 8011, 8017, 8053, 8059, 8089, 8101, 8161, 8167, 8179, 8191, 8209, 8221, 8233, 8263, 8269, 8287, 8293, 8311, 8317, 8329, 8353, 8377, 8389, 8419, 8431, 8443, 8461, 8467, 8521, 8527, 8539, 8563, 8581, 8599, 8623, 8629, 8641, 8647, 8677, 8689, 8707, 8713, 8719, 8731, 8737, 8761, 8779, 8803, 8821, 8839, 8863, 8887, 8893, 8923, 8929, 8941, 8971, 9001, 9007, 9013, 9043, 9049, 9067, 9091, 9103, 9109, 9127, 9133, 9151, 9157, 9181, 9187, 9199, 9241, 9277, 9283, 9319, 9337, 9343, 9349, 9391, 9397, 9403, 9421, 9433, 9439, 9463, 9511, 9547, 9601, 9613, 9619, 9631, 9643, 9649, 9661, 9679, 9697, 9721, 9733, 9739, 9769, 9781, 9787, 9811, 9817, 9829, 9859, 9871, 9883, 9901, 9907, 9931, 9949, 9967, 9973] Starting... X X X X X
Error in lines 1-1 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 "", line 30, in compute_dist_delta File "/projects/sage/sage-7.5/local/lib/python2.7/site-packages/sage/parallel/use_fork.py", line 149, in __call__ pid = os.wait()[0] File "src/cysignals/signals.pyx", line 252, in cysignals.signals.python_check_interrupt (build/src/cysignals/signals.c:2854) File "src/cysignals/signals.pyx", line 97, in cysignals.signals.sig_raise_exception (build/src/cysignals/signals.c:1303) KeyboardInterrupt
CPU time: 6.76 s, Wall time: 171.68 s
t
len(t)

[0.1459, 0.3877, 0.1885, 0.2256, 0.0780 ... -0.1225, 0.2802, 0.0588, -0.1247, -0.1691] 80
report(t)

kurtosis: 3.88942873582 mean: 0.057726233264 sd: 0.202315840214
plot_histogram(t, bins=50)

t.plot_histogram()

import scipy.stats.mstats
scipy.stats.mstats.normaltest(t.numpy())

NormaltestResult(statistic=4.7774186399416152, pvalue=0.091748024834293299)