{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"keepfloat:true$\n",
"assume(x>1)$\n",
"texput(moebius,\"\\\\mu\")$\n",
"declare(rho,complex)$"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"\\[\\tag{${\\it \\%o}_{5}$}J\\left(x\\right)=-\\sum_{i=1}^{\\infty }{\\left({\\it li}\\left(x^{\\rho_{i}^\\star}\\right)+{\\it li}\\left(x^{\\rho_{i}}\\right)\\right)}+{\\it li}\\left(x\\right)+\\int_{x}^{\\infty }{\\frac{1}{t\\,\\left(t^2-1\\right)\\,\\log t}\\;dt}-\\log 2\\]"
],
"text/plain": [
" inf\n",
" ==== conjugate(rho ) rho\n",
" \\ i i\n",
"(%o5) J(x) = (- > (li(x ) + li(x ))) + li(x)\n",
" /\n",
" ====\n",
" i = 1\n",
" inf\n",
" /\n",
" [ 1\n",
" + I ----------------- dt - log(2)\n",
" ] 2\n",
" / t (t - 1) log(t)\n",
" x"
],
"text/x-maxima": [
"J(x) = (-'sum(li(x^conjugate(rho[i]))+li(x^rho[i]),i,1,inf))\n",
" +li(x)+'integrate(1/(t*(t^2-1)*log(t)),t,x,inf)-log(2)"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"J(x)=li(x)-sum(li(x^rho[i])+li(x^(conjugate(rho[i]))),i,1,inf)-log(2)+integrate(1/(t*(t^2-1)*log(t)),t,x,inf);"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"\\[\\tag{${\\it \\%o}_{6}$}\\pi\\left(x\\right)=\\sum_{m=1}^{\\left \\lfloor \\frac{\\log x}{\\log 2} \\right \\rfloor}{\\frac{\\mu\\left(m\\right)\\,J\\left(x^{\\frac{1}{m}}\\right)}{m}}\\]"
],
"text/plain": [
" log(x)\n",
" floor(------)\n",
" log(2)\n",
" ==== 1/m\n",
" \\ moebius(m) J(x )\n",
"(%o6) pi(x) = > ------------------\n",
" / m\n",
" ====\n",
" m = 1"
],
"text/x-maxima": [
"pi(x) = 'sum((moebius(m)*J(x^(1/m)))/m,m,1,floor(log(x)/log(2)))"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pi(x)=sum(moebius(m)/m*J(x^(1/m)),m,1,floor(log(x)/log(2)));"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"pi1[n]:=if n<2 then 0 elseif primep(n) then pi1[n-1]+1 else pi1[n-1]$"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"pi(x):=if integerp(x) and primep(x) then pi1[x]-1/2 else pi1[floor(x)]$"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"\n",
"\n",
"\n"
],
"text/plain": [
"/var/folders/3n/jp9c5wkw8xjgmy006s6t_pt80000gn/T/maxplot.svg"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plot2d(pi(x),[x,0,100])$"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"\\[\\tag{${\\it \\%o}_{10}$}J_{2}\\left(x\\right):={\\it expintegral\\_li}\\left(x\\right)-\\log 2+{\\it romberg}\\left(\\frac{1}{t\\,\\left(t^2-1\\right)\\,\\log t} , t , x , 100\\right)\\]"
],
"text/plain": [
"(%o10) J2(x) := expintegral_li(x) - log(2)\n",
" 1\n",
" + romberg(-----------------, t, x, 100)\n",
" 2\n",
" t (t - 1) log(t)"
],
"text/x-maxima": [
"J2(x):=expintegral_li(x)-log(2)+romberg(1/(t*(t^2-1)*log(t)),t,x,100)"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"J2(x):=expintegral_li(x)-log(2)+romberg(1/(t*(t^2-1)*log(t)),t,x,100);"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"\\[\\tag{${\\it \\%o}_{11}$}\\pi_{2}\\left(x\\right):={\\it ev}\\left({\\it sum}\\left(\\frac{\\mu\\left(m\\right)}{m}\\,J_{2}\\left(x^{\\frac{1}{m}}\\right) , m , 1 , \\left \\lfloor \\frac{\\log x}{\\log 2} \\right \\rfloor\\right) , {\\it numer}\\right)\\]"
],
"text/plain": [
" moebius(m) 1/m log(x)\n",
"(%o11) pi2(x) := ev(sum((----------) J2(x ), m, 1, floor(------)), numer)\n",
" m log(2)"
],
"text/x-maxima": [
"pi2(x):=ev(sum((moebius(m)/m)*J2(x^(1/m)),m,1,floor(log(x)/log(2))),numer)"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pi2(x):=ev(sum(moebius(m)/m*J2(x^(1/m)),m,1,floor(log(x)/log(2))),numer);"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"\n",
"\n",
"\n"
],
"text/plain": [
"/var/folders/3n/jp9c5wkw8xjgmy006s6t_pt80000gn/T/maxplot.svg"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plot2d([pi(x),pi2(x)],[x,2,1000])$"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"\\[\\tag{${\\it \\%o}_{13}$}{\\it expintegral\\_ei}\\left(\\left(i\\,t+\\frac{1}{2}\\right)\\,\\log x\\right)={\\it expintegral\\_li}\\left(x^{i\\,t+\\frac{1}{2}}\\right)\\]"
],
"text/plain": [
" 1 %i t + 1/2\n",
"(%o13) expintegral_ei((%i t + -) log(x)) = expintegral_li(x )\n",
" 2"
],
"text/x-maxima": [
"expintegral_ei((%i*t+1/2)*log(x)) = expintegral_li(x^(%i*t+1/2))"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"expintegral_ei((1/2+%i*t)*log(x))=expintegral_li(x^(1/2+%i*t));"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"\n",
"\n",
"\n"
],
"text/plain": [
"/Users/yasube/Programming2/ipynb/maxima_out.svg"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/latex": [
"\\[\\tag{${\\it \\%o}_{14}$}\\left[ {\\it gr2d}\\left({\\it parametric} , {\\it parametric}\\right) \\right] \\]"
],
"text/plain": [
"(%o14) [gr2d(parametric, parametric)]"
],
"text/x-maxima": [
"[gr2d(parametric,parametric)]"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"draw2d(nticks=1000,\n",
" parametric( realpart(expintegral_ei(expand((1/2+%i*t)*log(20.0)))),\n",
" imagpart(expintegral_ei(expand((1/2+%i*t)*log(20.0)))),\n",
" t,-50,50) ,\n",
" color=red,\n",
" parametric( realpart(expintegral_li(rectform(20.0^(1/2+%i*t)))),\n",
" imagpart(expintegral_li(rectform(20.0^(1/2+%i*t)))),\n",
" t,0,2.1));"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"\\[\\tag{${\\it \\%o}_{15}$}{\\it Li\\_power}\\left(x , t\\right):=2\\,{\\it realpart}\\left({\\it expintegral\\_ei}\\left({\\it expand}\\left(\\left(\\frac{1}{2}+i\\,t\\right)\\,\\log x\\right)\\right)\\right)\\]"
],
"text/plain": [
" 1\n",
"(%o15) Li_power(x, t) := 2 realpart(expintegral_ei(expand((- + %i t) log(x))))\n",
" 2"
],
"text/x-maxima": [
"Li_power(x,t):=2*realpart(expintegral_ei(expand((1/2+%i*t)*log(x))))"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Li_power(x,t):=2*realpart(expintegral_ei(expand((1/2+%i*t)*log(x))));"
]
},
{
"cell_type": "code",
"execution_count": 13,
"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",
"60.8317785246098098442599018245241,\n",
"65.1125440480816066608750542531836,\n",
"67.0798105294941737144788288965221,\n",
"69.5464017111739792529268575265547,\n",
"72.0671576744819075825221079698261,\n",
"75.7046906990839331683269167620305,\n",
"77.1448400688748053726826648563047,\n",
"79.3373750202493679227635928771161,\n",
"82.9103808540860301831648374947706,\n",
"84.7354929805170501057353112068276,\n",
"87.4252746131252294065316678509191,\n",
"88.8091112076344654236823480795095,\n",
"92.4918992705584842962597252418105,\n",
"94.6513440405198869665979258152080,\n",
"95.8706342282453097587410292192467,\n",
"98.8311942181936922333244201386224,\n",
"101.3178510057313912287854479402924,\n",
"103.7255380404783394163984081086952,\n",
"105.4466230523260944936708324141119,\n",
"107.1686111842764075151233519630860,\n",
"111.0295355431696745246564503099445,\n",
"111.8746591769926370856120787167707,\n",
"114.3202209154527127658909372761910,\n",
"116.2266803208575543821608043120647,\n",
"118.7907828659762173229791397026999,\n",
"121.3701250024206459189455329704998,\n",
"122.9468292935525882008174603307700,\n",
"124.2568185543457671847320079661301,\n",
"127.5166838795964951242793237669060,\n",
"129.5787041999560509857680339061800,\n",
"131.0876885309326567235663724615015,\n",
"133.4977372029975864501304920426407,\n",
"134.7565097533738713313260641571699,\n",
"138.1160420545334432001915551902824,\n",
"139.7362089521213889504500465233824,\n",
"141.1237074040211237619403538184753,\n",
"143.1118458076206327394051238689139,\n",
"146.0009824867655185474025075964246,\n",
"147.4227653425596020495211850104316,\n",
"150.0535204207848803514324672369594,\n",
"150.9252576122414667618525246783058,\n",
"153.0246938111988961982565442551854,\n",
"156.1129092942378675697501893101691,\n",
"157.5975918175940598875305031584988,\n",
"158.8499881714204987241749947755403,\n",
"161.1889641375960275194373441293695,\n",
"163.0307096871819872433110390006880,\n",
"165.5370691879004188300389193548749,\n",
"167.1844399781745134409577562462105,\n",
"169.0945154155688214895058711814318,\n",
"169.9119764794116989666998435958216,\n",
"173.4115365195915529598461186493456,\n",
"174.7541915233657258133787624558669,\n",
"176.4414342977104188888926410578611,\n",
"178.3774077760999772858309354141843,\n",
"179.9164840202569961393400366120511,\n",
"182.2070784843664619154070372269880,\n",
"184.8744678483875088009606466172344,\n",
"185.5987836777074714665277042683928,\n",
"187.2289225835018519916415405861313,\n",
"189.4161586560169370848522890998453,\n",
"192.0266563607137865472836314255836,\n",
"193.0797266038457040474022057943760,\n",
"195.2653966795292353214631878148621,\n",
"196.8764818409583169486222639146962,\n",
"198.0153096762519124249199187022090,\n",
"201.2647519437037887330161334275482,\n",
"202.4935945141405342776866606378642,\n",
"204.1896718031045543307164383863137,\n",
"205.3946972021632860252123793906930,\n",
"207.9062588878062098615019679077537,\n",
"209.5765097168562598528356442898868,\n",
"211.6908625953653075639074867307192,\n",
"213.3479193597126661906391220210726,\n",
"214.5470447834914232229442010725905,\n",
"216.1695385082637002658695633544983,\n",
"219.0675963490213789856772565904373,\n",
"220.7149188393140033691155926339062,\n",
"221.4307055546933387320974751192761,\n",
"224.0070002546043352117288755285048,\n",
"224.9833246695822875037825236805285,\n",
"227.4214442796792913104614361606596,\n",
"229.3374133055253481077600833060557,\n",
"231.2501887004991647738061867700103,\n",
"231.9872352531802486037716685391979,\n",
"233.6934041789083006407044947325696,\n",
"236.5242296658162058024755079556632,\n",
"237.7698204809252040032366259263873,\n",
"239.5554775733276287402689320343344,\n",
"241.0491577962165864128379214103356,\n",
"242.8232719342226000168264744588786,\n",
"244.0708984970781582368165279898444,\n",
"247.1369900748974994675509681792082,\n",
"248.1019900601484592567621420846569,\n",
"249.5736896447072091923297941887400,\n",
"251.0149477950160011429541551037080,\n",
"253.0699867479994771945990137856179,\n",
"255.3062564549140227530864917940013,\n",
"256.3807136944344777893583823397297,\n",
"258.6104394915313682089830586447592,\n",
"259.8744069896780003506728446138766,\n",
"260.8050845045968701859312334724646,\n",
"263.5738939048701322330815881310234,\n",
"265.5578518388763202924773089641850,\n",
"266.6149737815010724957201129738679,\n",
"267.9219150828240594403789671721855,\n",
"269.9704490239976025946935053188985,\n",
"271.4940556416449990181794167575227,\n",
"273.4596091884032870457142502988019,\n",
"275.5874926493438412487407026193778,\n",
"276.4520495031329386798873436383991,\n",
"278.2507435298419544927482767113162,\n",
"279.2292509277451892284098804519553,\n",
"282.4651147650520962330272011865010,\n",
"283.2111857332338674204938379433290,\n",
"284.8359639809047241331576339226964,\n",
"286.6674453630028842928476241464148,\n",
"287.9119205014221871552541202718675,\n",
"289.5798549292188341527380235693524,\n",
"291.8462913290673958355130544246386,\n",
"293.5584341393562853567766971060351,\n",
"294.9653696192655421750664486390095,\n",
"295.5732548789582923884608314587787,\n",
"297.9792770619434152099296829576829,\n",
"299.8403260537213129600270525252938,\n",
"301.6493254621941836234701002084181,\n",
"302.6967495896069170517514770953529,\n",
"304.8643713408572977001487499031444,\n",
"305.7289126020368092892228212616610,\n",
"307.2194961281700547894100333999346,\n",
"310.1094631467018988047862197679989,\n",
"311.1651415303560032709426708003548,\n",
"312.4278011806008919804859830928742,\n",
"313.9852857311589229790489657545763,\n",
"315.4756160894757338685960781439538,\n",
"317.7348059423701803956454942049681,\n",
"318.8531042563165979066891845477493,\n",
"321.1601343091135782919214714174306,\n",
"322.1445586724829322988374450059887,\n",
"323.4669695575120505062120304147951,\n",
"324.8628660517396132649800869954006,\n",
"327.4439012619054573434692638163206,\n",
"329.0330716804809340336147275768039,\n",
"329.9532397282338663438921221886314,\n",
"331.4744675826634243756617538663449,\n",
"333.6453785248698505849616830808793,\n",
"334.2113548332443832324034079591923,\n",
"336.8418504283906847946547629194120,\n",
"338.3399928508066118862573260871631,\n",
"339.8582167253635401923265509308740,\n",
"341.0422611110465604825977845985367,\n",
"342.0548775103635854514038250940982,\n",
"344.6617029402523370441811880981990,\n",
"346.3478705660099473959364598161519,\n",
"347.2726775844204844757970948880699,\n",
"349.3162608706961441231555557339939,\n",
"350.4084193491920991876719532344873,\n",
"351.8786490253592804367133930765969,\n",
"353.4889004887188067836037686094353,\n",
"356.0175749772649473179603619607666,\n",
"357.1513022520396248096029282322904,\n",
"357.9526851016322737551289189827774,\n",
"359.7437549531144487992919859769902,\n",
"361.2893616958046503902913112277154,\n",
"363.3313305789738347473344495666148,\n",
"364.7360241140889937162621021269403,\n",
"366.2127102883313168610771451968066,\n",
"367.9935754817403033261832980442079,\n",
"368.9684380957343898915769012998921,\n",
"370.0509192121060003396511630612665,\n",
"373.0619283721128384491193964312852,\n",
"373.8648739109085697447563627336596,\n",
"375.8259127667393341079077141466931,\n",
"376.3240922306680521171908196124275,\n",
"378.4366802499654797240909659132034,\n",
"379.8729753465323466510240596904463,\n",
"381.4844686171865249196625224236574,\n",
"383.4435294495364877043457554807227,\n",
"384.9561168148636871037515842087935,\n",
"385.8613008459742291805619593598032,\n",
"387.2228902223879809759485147381099,\n",
"388.8461283542322546008094203003735,\n",
"391.4560835636380457705782281225541,\n",
"392.2450833395190967490151841709930,\n",
"393.4277438444340259366989529201288,\n",
"395.5828700109937209708777113231417,\n",
"396.3818542225921869319994544917305\n",
"]$"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"\\[\\tag{${\\it \\%o}_{17}$}J_{3}\\left(x\\right):={\\it expintegral\\_li}\\left(x\\right)-{\\it sum}\\left({\\it Li\\_power}\\left(x , {\\it img\\_rho}_{i}\\right) , i , 1 , 200\\right)-\\log 2.0+{\\it romberg}\\left(\\frac{1}{t\\,\\left(t^2-1\\right)\\,\\log t} , t , x , 20\\right)\\]"
],
"text/plain": [
"(%o17) J3(x) := expintegral_li(x) - sum(Li_power(x, img_rho ), i, 1, 200)\n",
" i\n",
" 1\n",
" - log(2.0) + romberg(-----------------, t, x, 20)\n",
" 2\n",
" t (t - 1) log(t)"
],
"text/x-maxima": [
"J3(x):=expintegral_li(x)-sum(Li_power(x,img_rho[i]),i,1,200)-log(2.0)\n",
" +romberg(1/(t*(t^2-1)*log(t)),t,x,20)"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"J3(x):=\n",
"expintegral_li(x)\n",
"-sum(Li_power(x,img_rho[i]),i,1,200)\n",
"-log(2.0)\n",
"+romberg(1/(t*(t^2-1)*log(t)),t,x,20);"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"\\[\\tag{${\\it \\%o}_{18}$}\\pi_{3}\\left(x\\right):={\\it ev}\\left({\\it sum}\\left(\\frac{\\mu\\left(m\\right)}{m}\\,J_{3}\\left(x^{\\frac{1}{m}}\\right) , m , 1 , \\left \\lfloor \\frac{\\log x}{\\log 2} \\right \\rfloor\\right) , {\\it numer}\\right)\\]"
],
"text/plain": [
" moebius(m) 1/m log(x)\n",
"(%o18) pi3(x) := ev(sum((----------) J3(x ), m, 1, floor(------)), numer)\n",
" m log(2)"
],
"text/x-maxima": [
"pi3(x):=ev(sum((moebius(m)/m)*J3(x^(1/m)),m,1,floor(log(x)/log(2))),numer)"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pi3(x):=ev(sum(moebius(m)/m*J3(x^(1/m)),m,1,floor(log(x)/log(2))),numer);"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"\n",
"\n",
"\n"
],
"text/plain": [
"/var/folders/3n/jp9c5wkw8xjgmy006s6t_pt80000gn/T/maxplot.svg"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/latex": [
"\\[\\tag{${\\it \\%o}_{19}$}\\left[ \\mbox{ /var/folders/3n/jp9c5wkw8xjgmy006s6t\\_pt80000gn/T/maxout92067.gnuplot } , \\mbox{ /var/folders/3n/jp9c5wkw8xjgmy006s6t\\_pt80000gn/T/maxplot.svg } \\right] \\]"
],
"text/plain": [
"(%o19) [/var/folders/3n/jp9c5wkw8xjgmy006s6t_pt80000gn/T/maxout92067.gnuplot, \n",
" /var/folders/3n/jp9c5wkw8xjgmy006s6t_pt80000gn/T/maxplot.svg]"
],
"text/x-maxima": [
"[\"/var/folders/3n/jp9c5wkw8xjgmy006s6t_pt80000gn/T/maxout92067.gnuplot\",\n",
" \"/var/folders/3n/jp9c5wkw8xjgmy006s6t_pt80000gn/T/maxplot.svg\"]"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"plot2d([pi3(x),pi(x)],[x,3,200]);"
]
},
{
"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
}