Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

illustrations for RH book

Views: 1857
%load code.sage
%time %load code.sage %time draw() ︠5cee7c63-955c-4c55-bf31-df93d0fea32es︠ ['_'.join(x.split('_')[1:]) for x in globals() if x.startswith('fig_')]
['primegapdist', 'inverse_of_log', 'pi_riemann_gauss', 'moebius', 'log', 'li_pi_loginv', 'logXoverX', 'pure_tone', 'questions', 'zero_spacing', 'proportion_primes', 'prime_pi_aspect1', 'Psiprime', 'theta_C_intro', 'psi', 'Phi', 'waves', 'mini_phihat_even', 'phi', 'calculus', 'jump', 'primegap_race', 'phihat_even_all', 'prime_pi', 'primes_line', 'staircase_riemann_spectrum', 'simple_staircase', 'even_function', 'fourier_machine', 'mixed_tone', 'multpar', 'riemann_spectrum_gaps', 'aplusone', 'cesaro', 'random_walks', 'Rk', 'Psi', 'simrates', 'sieves', 'two_delta', 'sawtooth', 'dirac', 'prime_pi_nofill', 'oo_integral', 'theta_C', 'psi_waves', 'phihat_even', 'li_minus_pi', 'factor_tree', 'even_pi', 'gaussian_primes', 'erat']
for x in ['li_minus_pi', 'factor_tree', 'even_pi', 'gaussian_primes', 'erat']: %time draw(x) ︠d4106eed-9996-4cba-880a-9379a323db4es︠ %load code.sage draw('phi')
Drawing phi... (time = 22.0821690559 seconds)
%load code.sage draw('moebius')
Drawing moebius... (time = 7.25760006905 seconds)
reset() ︠4a2685c6-fdc3-4cb2-812b-d78f28917eb3s︠ %load code.sage draw("li_minus_pi")
Drawing li_minus_pi... (time = 39.5458168983 seconds)
%time %load code.sage draw('theta_C_intro')
Drawing theta_C_intro... (time = 8.55938410759 seconds) CPU time: 7.83 s, Wall time: 8.77 s
%load code.sage g = fig_pi_Li(0,0)
g
︠83dda20b-e4c9-4f8a-bc87-0e174ed8b0cb︠ %time %load code.sage draw('gaussian_primes')
Drawing gaussian_primes... (time = 18.4877309799 seconds) CPU time: 16.05 s, Wall time: 18.74 s
gaussian_primes(10)
[i + 1, i + 2, 2*i + 1, 3, 3*i + 2, 2*i + 3, i + 4, 4*i + 1, 5*i + 2, 2*i + 5, i + 6, 6*i + 1, 5*i + 4, 4*i + 5, 7, 7*i + 2, 2*i + 7, 6*i + 5, 5*i + 6, 3*i + 8, 8*i + 3, 8*i + 5, 5*i + 8, 9*i + 4, 4*i + 9, i + 10, 10*i + 1, 10*i + 3, 3*i + 10, 8*i + 7, 7*i + 8, 7*i + 10, 10*i + 7, 10*i + 9, 9*i + 10]
K.<i> = QuadraticField(-1)
i^2
-1
︠3b1dda8f-a711-462e-95b9-5e78e8a146c5︠ B = 10 %time v = K.primes_of_bounded_norm(2*B*B) w = [] for I in v: a = I.gens_reduced()[0] if abs(a[0])<=B and abs(a[1]) <= B: w.extend([a,-a,i*a,-i*a]) w = [z for z in w if z[0]>0 and z[1]>=0]
CPU time: 0.05 s, Wall time: 0.05 s
g.save? ︠1571ab06-a964-4d30-80a9-866cfb019b51︠ %time show(points(w, pointsize=90, zorder=10), aspect_ratio=1, svg=True, figsize=7, fontsize=16, gridlines=True, ticks=[[-1..B],[-1..B]], xmin=-.5, ymin=-.5)
CPU time: 0.30 s, Wall time: 0.72 s
B = 100 %time v = K.primes_of_bounded_norm(2*B*B) w = [] for I in v: a = I.gens_reduced()[0] if abs(a[0])<=B and abs(a[1]) <= B: w.extend([a,-a,i*a,-i*a]) w = [z for z in w if z[0]>0 and z[1]>=0]
CPU time: 2.71 s, Wall time: 2.71 s
cartesian_product([[1..3], [1..3]])
Error in lines 1-1 Traceback (most recent call last): File "/projects/54949eee-57da-4bd7-bb43-c2602b429f9a/.sagemathcloud/sage_server.py", line 873, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 1, in <module> File "/usr/local/sage/sage-6.5/local/lib/python2.7/site-packages/sage/categories/covariant_functorial_construction.py", line 218, in __call__ assert(all( hasattr(arg, self._functor_name) for arg in args)) AssertionError
p1 = points(w, pointsize=20, zorder=10) p2 = points(list(cartesian_product_iterator([[0..B],[0..B]])), pointsize=3, color='grey', zorder=15) %time show(p1+p2, aspect_ratio=1, svg=True, frame=True, axes=False, figsize=10)
CPU time: 4.57 s, Wall time: 9.05 s
︠e2f7abd7-d6ee-4117-8f71-bb5b038917bc︠ draw("cesaro")
Drawing cesaro... (time = 161.922121048 seconds)
draw('theta_C_intro')
Drawing theta_C_intro... (time = 41.996740818 seconds)
%load code.sage draw('psi')
Drawing psi... (time = 1.65290188789 seconds)
%load code.sage draw('waves')
Drawing waves... (time = 4.01206207275 seconds)
%load code.sage draw('sawtooth')
Drawing sawtooth... (time = 0.904992103577 seconds)
%load code.sage draw('pure_tone') draw('mixed_tone')
Drawing pure_tone... (time = 0.395801067352 seconds) Drawing mixed_tone... (time = 0.772159099579 seconds)
%load code.sage draw('prime_pi') draw('prime_pi_aspect1')
Drawing prime_pi... (time = 13.0921411514 seconds) Drawing prime_pi_aspect1... (time = 4.44406914711 seconds)
%load code.sage for a in 'aplusone calculus jump dirac two_delta'.split(): draw(a)
Drawing aplusone... (time = 0.605562925339 seconds) Drawing calculus... (time = 0.686944007874 seconds) Drawing jump... (time = 2.55016493797 seconds) Drawing dirac... (time = 0.0844738483429 seconds) Drawing two_delta... (time = 0.150384902954 seconds)
%load code.sage draw('simple_staircase')
Drawing simple_staircase... (time = 0.414288043976 seconds)
%load code.sage draw('even_function') draw('even_pi')
Drawing even_function... (time = 0.670686006546 seconds) Drawing even_pi... (time = 0.580007076263 seconds)
%load code.sage draw('mini_phihat_even'),draw('phihat_even')
Drawing mini_phihat_even... (time = 49.5483169556 seconds) Drawing phihat_even...
%load code.sage draw('theta_C_intro')
%load code.sage draw('zero_spacing')
plot? ︠1aee8e1e-a26f-45e2-a0e8-241a153aa917︠ ︠c81b67a4-6391-4bd3-a743-8c4ba24cd6ab︠ draw('Psiprime')
Drawing Psiprime... (time = 0.26216506958 seconds)
draw('riemann_spectrum_gaps')
Drawing riemann_spectrum_gaps... (time = 1.61334013939 seconds)
︠f24e5ccf-2b08-4404-af26-7e6b180919e4︠ ︠4402b7b7-4adc-4d16-bf55-1bf2faab6f21︠ def fig_Phi(): g = line([(0,0),(0,100)], rgbcolor='black') xmax = 20 ymax = 50 for n in [1..xmax]: if is_prime_power(n): if n == 1: h = log(2*pi) else: h = log(factor(n)[0][0]) h /= sqrt(n) h = float(h)*50 print h g += arrow((log(n),0),(log(n),h), width=1) g += arrow((-log(n),0),(-log(n),h), width=1) g += line([(log(n),0),(log(n),100)], color='black', thickness=.3) g += line([(-log(n),0),(-log(n),100)], color='black', thickness=.3) if n in [2, 5, 16]: g += text("log(%s)"%n, (log(n),-5), rgbcolor='black', fontsize=12) g += line([(log(n),-2), (log(n),0)], rgbcolor='black') g += text("log(%s)"%n, (-log(n),-5), rgbcolor='black', fontsize=12) g += line([(-log(n),-2), (-log(n),0)], rgbcolor='black') g += line([(-log(xmax)-1,0), (log(xmax)+1,0)], thickness=2) return g show(fig_Phi(), axes=False)
91.8938533205 24.5064535867 31.7142050299 17.328679514 35.9881257777 36.7742452005 12.2532267934 18.3102048111 36.1496313929 35.5694477973 8.664339757 34.3577584631 33.7750314621
︠8c58f170-89df-4317-9035-cb453164414a︠ %load code.sage
draw('zero_spacing')
Drawing zero_spacing... (time = 1.18501615524 seconds)
draw('Phi')
Drawing Phi... 91.8938533205 24.5064535867 31.7142050299 17.328679514 35.9881257777 36.7742452005 12.2532267934 18.3102048111 36.1496313929 35.5694477973 8.664339757 34.3577584631 33.7750314621 (time = 0.299562931061 seconds)
%time draw("theta_C_intro")
Drawing theta_C_intro... (time = 1.07501602173 seconds) CPU time: 1.08 s, Wall time: 1.06 s
draw("cesaro")
Drawing cesaro... (time = 3.174036026 seconds)
def f(B): v = prime_gap_distribution(10^B) z = [v[i] if i<len(v) else 0 for i in [2,4,6,8,100,252]] print "$10^{%s}$ & "%B + " & ".join([str(a) for a in z]) + r"\\\hline"
for B in [1..8]: f(B)
$10^{1}$ & 2 & 0 & 0 & 0 & 0 & 0\\\hline $10^{2}$ & 8 & 7 & 7 & 1 & 0 & 0\\\hline $10^{3}$ & 35 & 40 & 44 & 15 & 0 & 0\\\hline $10^{4}$ & 205 & 202 & 299 & 101 & 0 & 0\\\hline $10^{5}$ & 1224 & 1215 & 1940 & 773 & 0 & 0\\\hline $10^{6}$ & 8169 & 8143 & 13549 & 5569 & 2 & 0\\\hline $10^{7}$ & 58980 & 58621 & 99987 & 42352 & 36 & 0\\\hline $10^{8}$ & 440312 & 440257 & 768752 & 334180 & 878 & 0\\\hline
%time f(500*10^6)
[1840170, 1841265, 3257346, 1434059, 0] CPU time: 92.78 s, Wall time: 87.69 s
%time draw("theta_C")
Drawing theta_C... (time = 5.19401979446 seconds) CPU time: 5.19 s, Wall time: 5.05 s
%time draw("random_walks")
Drawing random_walks... (time = 67.0932559967 seconds) CPU time: 67.09 s, Wall time: 66.59 s
︠59430b3a-b0f2-46ba-93b8-8f51522a2f7b︠ p = area_under_inverse_log(30)
show(p, aspect_ratio='automatic', svg=True)
p.aspect_ratio()
1.0
a = p[0] + p[1] + sum(p[3:]); b = p[2]
a
b.set_aspect_ratio('automatic')
b.aspect_ratio()
'automatic'
a+b
polygon2d.options
{'aspect_ratio': 1.0, 'alpha': 1, 'fill': True, 'legend_label': None, 'rgbcolor': (0, 0, 1), 'thickness': None}
circle.options
{'edgecolor': 'blue', 'facecolor': 'blue', 'clip': True, 'legend_label': None, 'thickness': 1, 'zorder': 5, 'aspect_ratio': 1.0, 'alpha': 1, 'linestyle': 'solid', 'fill': False}