From: "Brian Gladman" Subject: Re: Zeta computing Date: Thu, 23 Dec 1999 20:24:26 -0000 Newsgroups: sci.math Keywords: computing values of the Riemann Zeta function Max Alekseyev wrote in message news:945691336@f128.n5015.z2.fidonet.org... > Hi, All ! > > What is the fastest way to compute values of the Riemann Zeta function? > For example, how does Maple V evaluate it? > > Bye, > Max Here is a program that can compute the Riemann Zeta Function efficiently to high accuracy. It is in ubasic, a multiple precision basic which can be downloaded from rkmath.rikkyo.ac.jp. The sample test output is: 2.0000 1.6449340668482264364724151666460251892190 3.0000 1.2020569031595942853997381615114499907651 4.0000 1.0823232337111381915160036965411679027749 5.0000 1.0369277551433699263313654864570341680573 6.0000 1.0173430619844491397145179297909205279018 7.0000 1.0083492773819228268397975498497967595993 8.0000 1.0040773561979443393786852385086524652574 9.0000 1.0020083928260822144178527692324120604826 10.0000 1.0009945751278180853371459589003190170015 11.0000 1.0004941886041194645587022825264699364626 12.0000 1.0002460865533080482986379980477396709530 13.0000 1.0001227133475784891467518365263573957058 14.0000 1.0000612481350587048292585451051353337383 15.0000 1.0000305882363070204935517285106450625779 16.0000 1.0000152822594086518717325714876367220132 17.0000 1.0000076371976378997622736002935630292028 18.0000 1.0000038172932649998398564616446219397200 19.0000 1.0000019082127165539389256569577951013428 20.0000 1.0000009539620338727961131520386834493354 Enjoy! Brian Gladman --------------------------------------------------------------- 100 'Riemann Zeta Function Test 110 point 10:N%=50 120 dim Zc(N%) 130 gosub *Zetac 140 for S=2 to 20 150 print using(4,4),S,using(6,40),fnZeta(S) 160 next S 170 end 180 ' 190 ' 200 'Calculates values of the Riemann Zeta Function 210 'Implemented by Dr B R Gladman, 16 November 1998 220 '(brian.gladman@btinternet.com). 230 ' 240 '*zetac must be called first to initialise N% 250 'values in array Zc() of length N%. N% is 260 'about 1.3 times the number of decimal digits 270 'needed. The function fnzeta(x) then returns 280 'the value of the Riemann zeta function using 290 'the algorithm developed by P. Borwein as set 300 'out in the paper "An Efficient Algorithm for 310 'the Riemann Zeta Function". Note that N% and 320 'Zc() are global variables. 330 ' 340 *Zetac 350 local I%,S,T,U 360 S=1:T=1:U=1 370 for I%=0 to N% 380 Zc(I%)=S 390 T*=(N%-I%)*(N%+I%)*4 400 U*=(I%+I%+1)*(I%+I%+2) 410 S+=T/U 420 next I% 430 return 440 fnZeta(X) 450 local S,I% 460 Sm=0 470 for I%=N%-1 to 0 step -1 480 S=(Zc(N%)-Zc(I%))/(I%+1)^X-S 490 next I% 500 return(S/Zc(N%)/(1-2/2^X)) 510 end