{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# How to plot Riemann zeta zero spikes by fourier (mellin) transform of von Mangoldt function\n",
"Yasuaki Honda at google dot com\n",
"\n",
"[1] Wikipedia von Mangoldt function, https://en.wikipedia.org/wiki/Von_Mangoldt_function\n",
"\n",
"[2] Conrey, The Riemann Hypothesis https://www.ams.org/notices/200303/fea-conrey-web.pdf\n",
"\n",
"[3] https://stackoverflow.com/questions/8934125/how-plot-the-riemann-zeta-zero-spectrum-with-the-fourier-transform-in-mathematic/8975710#8975710\n",
"\n",
"[4] The LMFDB Collaboration, The L-functions and Modular Forms Database, \n",
"home page of the Zeros of zeta(s),\n",
"https://www.lmfdb.org/zeros/zeta/?limit=200&N=1, 2020 , [Online; accessed 10 October 2020]."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"\\[\\tag{${\\it \\%o}_{1}$}1000000\\]"
],
"text/plain": [
"(%o1) 1000000"
],
"text/x-maxima": [
"1000000"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"scale:1000000;"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"\\[\\tag{${\\it \\%o}_{2}$}{\\it mangoldt}\\left(n\\right)=\\left(\\mathbf{if}\\;n=1\\;\\mathbf{then}\\;1\\;\\mathbf{elseif}\\;n=p^{k}\\;\\mathbf{then}\\;\\log p\\;\\mathbf{else}\\;0\\right)\\]"
],
"text/plain": [
" k\n",
"(%o2) mangoldt(n) = (if n = 1 then 1 elseif n = p then log(p) else 0)"
],
"text/x-maxima": [
"mangoldt(n) = (if n = 1 then 1 elseif n = p^k then log(p) else 0)"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mangoldt(n)='if n=1 then 1 elseif n=p^k then log(p) else 0;"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"mangoldt_c(n):=if floor(n)<2 then 0 else block([ifc:ifactors(floor(n))],if length(ifc)=1 then log(ifc[1][1]) else 0)$\n",
"(matchdeclare(n,numberp),tellsimp(mangoldt(n),mangoldt_c(n)))$"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"\\[\\tag{${\\it \\%o}_{5}$}{\\it psi}\\left(x\\right)=\\sum_{n=1}^{\\left \\lfloor x \\right \\rfloor}{{\\it mangoldt}\\left(n\\right)}\\]"
],
"text/plain": [
" floor(x)\n",
" ====\n",
" \\\n",
"(%o5) psi(x) = > mangoldt(n)\n",
" /\n",
" ====\n",
" n = 1"
],
"text/x-maxima": [
"'psi(x) = 'sum(mangoldt(n),n,1,floor(x))"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'psi(x)=sum(mangoldt(n),n,1,floor(x));"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"kill(psi_c)$\n",
"psi_c[n]:=if n=1 then float(mangoldt(1)) else psi_c[n-1]+float(mangoldt(n))$\n",
"psi(x):=psi_c[floor(x)]$\n",
"for i:1 thru scale do psi(i)$"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"\\[\\tag{${\\it \\%o}_{10}$}\\int_{0}^{{\\it scale}}{x^{i\\,t-\\frac{1}{2}}\\,\\left({\\it psi}\\left(x\\right)-x\\right)\\;dx}\\]"
],
"text/plain": [
" scale\n",
" /\n",
" [ %i t - 1/2\n",
"(%o10) I x (psi(x) - x) dx\n",
" ]\n",
" /\n",
" 0"
],
"text/x-maxima": [
"'integrate(x^(%i*t-1/2)*('psi(x)-x),x,0,scale)"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'integrate(('psi(x)-x)*x^(-1/2+%i*t),x,0,'scale);"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"\\[\\tag{${\\it \\%o}_{13}$}60\\]"
],
"text/plain": [
"(%o13) 60"
],
"text/x-maxima": [
"60"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"text/latex": [
"\\[\\tag{${\\it \\%o}_{14}$}0.1\\]"
],
"text/plain": [
"(%o14) 0.1"
],
"text/x-maxima": [
"0.1"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"xres:0.002$\n",
"xlist:exp(makelist(i,i,0,float(log(scale)),xres))$\n",
"tmax:60;\n",
"tres:0.1;\n",
"psilist: map(psi,xlist)-xlist$"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"warning: encountered undefined variable psi_c in translation.\n",
"warning: encountered undefined variable xlist in translation.\n",
"warning: encountered undefined variable tres in translation.\n",
"warning: encountered undefined variable tmax in translation.\n",
"warning: encountered undefined variable psilist in translation.\n"
]
},
{
"data": {
"text/latex": [
"\\[\\tag{${\\it \\%o}_{19}$}\\left[ {\\it mangoldt\\_c} , \\psi , {\\it innerproduct} , {\\it xxlist} , {\\it primepeek} \\right] \\]"
],
"text/plain": [
"(%o19) [mangoldt_c, psi, innerproduct, xxlist, primepeek]"
],
"text/x-maxima": [
"[mangoldt_c,psi,innerproduct,xxlist,primepeek]"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"innerproduct(list1,list2):=if not(length(list1)=length(list2)) then error(\"length of arg1 and arg2 does not match.\") else\n",
" block([c:length(list1),total:0,t1,t2],\n",
" for i:1 thru c do (t1:pop(list1),t2:pop(list2),total:total+t1*t2),\n",
" return(total))$\n",
"xxlist(t):=imagpart(xlist^(-0.5+%i*t))$\n",
"primepeek():=block([res:[],c:0],for t:0 step tres thru tmax do (\n",
" if mod(c,100)=0 then print(t), c:c+1,\n",
" res:append(res,[innerproduct(xxlist(t),psilist)])),return(res))$\n",
"compile(all);\n"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0 \n",
"9.99999999999998 \n",
"20.00000000000001 \n",
"30.00000000000016 \n",
"40.0000000000003 \n",
"50.00000000000044 \n"
]
}
],
"source": [
"errlist:primepeek()$"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"\n",
"\n",
"\n"
],
"text/plain": [
"/tmp/maxplot.svg"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/latex": [
"\\[\\tag{${\\it \\%o}_{29}$}\\left[ \\mbox{ /tmp/maxout93.gnuplot } , \\mbox{ /tmp/maxplot.svg } \\right] \\]"
],
"text/plain": [
"(%o29) [/tmp/maxout93.gnuplot, /tmp/maxplot.svg]"
],
"text/x-maxima": [
"[\"/tmp/maxout93.gnuplot\",\"/tmp/maxplot.svg\"]"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"plot2d([discrete,makelist(i*tres,i,0,length(errlist)-1),errlist/length(xlist)]);"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [],
"source": [
"/*\n",
"The LMFDB Collaboration, The L-functions and Modular Forms Database, \n",
"home page of the Zeros of zeta(s),\n",
"https://www.lmfdb.org/zeros/zeta/?limit=200&N=1, 2020 , [Online; accessed 10 October 2020].\n",
"*/\n",
"img_rho:[\n",
"14.1347251417346937904572519835625,\n",
"21.0220396387715549926284795938969,\n",
"25.0108575801456887632137909925628,\n",
"30.4248761258595132103118975305840,\n",
"32.9350615877391896906623689640747,\n",
"37.5861781588256712572177634807053,\n",
"40.9187190121474951873981269146334,\n",
"43.3270732809149995194961221654068,\n",
"48.0051508811671597279424727494277,\n",
"49.7738324776723021819167846785638,\n",
"52.9703214777144606441472966088808,\n",
"56.4462476970633948043677594767060,\n",
"59.3470440026023530796536486749922\n",
"]$\n",
"/* The rest 187 zeros are omitted as we draw graph up to 1/2+60*%i. */"
]
},
{
"cell_type": "code",
"execution_count": 49,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"\n",
"\n",
"\n"
],
"text/plain": [
"/tmp/maxplot.svg"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/latex": [
"\\[\\tag{${\\it \\%o}_{55}$}\\left[ \\mbox{ /tmp/maxout93.gnuplot } , \\mbox{ /tmp/maxplot.svg } \\right] \\]"
],
"text/plain": [
"(%o55) [/tmp/maxout93.gnuplot, /tmp/maxplot.svg]"
],
"text/x-maxima": [
"[\"/tmp/maxout93.gnuplot\",\"/tmp/maxplot.svg\"]"
]
},
"execution_count": 49,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"plot2d([[discrete,makelist(i*tres,i,0,length(errlist)-1),errlist/length(xlist)],[discrete,makelist([img_rho[i],0],i,1,13)]],\n",
"[style,[lines],[points,1]],[legend,false]);"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Maxima",
"language": "maxima",
"name": "maxima"
},
"language_info": {
"codemirror_mode": "maxima",
"file_extension": ".mac",
"mimetype": "text/x-maxima",
"name": "maxima",
"pygments_lexer": "maxima",
"version": "5.44.0"
}
},
"nbformat": 4,
"nbformat_minor": 4
}