4 closeto(e,tol):=block([numer:true,abse],abse:abs(e),if(abse<tol) then true else abse);
5 closeto(e,tol):=block([numer:true,abse],abse:abs(e),if(abse<tol) then true else abse);
10 (chk(x) := zeta(1-x) - 2 * cos(x * %pi /2) * gamma(x) * zeta(x) / (2 * %pi)^x, 0);
13 every(lambda([e], is(equal(e,0))), makelist(chk(k),k,2,21));
16 every(lambda([e], is(equal(e,0))), makelist(zeta(-k) + bern(k+1)/(k+1),k,1,21));
31 errcatch(zeta(1)); /* zeta(1) is undefined */
37 errcatch(zeta(1.0b0));
41 limit(zeta(x),x,1,plus);
44 limit(zeta(x),x,1,minus);
65 /* bfloat(zeta(5)) should not return a rational! */
66 (fpprec:16, bfloat(zeta(5)));
70 closeto(abs(zeta(%i-2)-(0.02919559324346426-0.01778710697084208*%i)), 2e-17),numer;
80 closeto(abs(zeta(%i)-(0.003300223685324066-0.4181554491413215*%i)), 1.69e-16),numer;
87 * The expected value was obtained from functions.wolfram.com using 40 digits of
90 closeto(abs(zeta(3b0 + %i) - (1.1072144084314091956251002057752233976776b0 - 0.1482908671781753484907641256686246807941b0*%i)), 3.11b-33);
94 * Bug 3968: For s < 0, zeta(-s) can be expressed in terms of
95 * zeta(1-s), a positive number.
97 * The expected answer is
99 * zeta(s) = 2^s*%pi^(s-1)*sin(%pi/2*s)*gamma(1-s)*zeta(1-s))
105 (7*gamma(1/3)*zeta(10/3))/(27*2^(4/3)*%pi^(10/3));
109 /* Experimentally determined. Should be around 1e-15 or so */
111 exact : zeta(-(k+1/2)),
112 fl : zeta(float(-(k+1/2))), err],
115 * Use relative error. If the error is too large, return the arg,
116 * the relative error, the exact value, and the corresponding
120 err : closeto(abs((float(exact)-fl)/fl), threshold),
123 else [-(k + 1/2), err, exact, fl]),
125 [true, true, true, true, true, true, true, true, true, true];
127 (reset(fpprec), remfunction(chk),0);