(Hobbyist here, please excuse any misunderstanding I have below.)
I'm trying to compute values of the Riemann zeta function in the critical strip, using the Dirichlet eta function. I've reimplemented this implementation in C. I get the same values as the reference implementation, so I'm pretty sure the implementation is correct.
The values look correct on the critical line, but the errors get quite large when approaching the ends of the critical strip. Is this expected? If so, is there a different formula I could implement that shows smaller errors around the end of the strip?
Thank you!
You should compute an upper bound for the error.
For $Re(s) > 0$ : $$\eta(s) = \sum_{n=1}^\infty (-1)^{n+1}n^{-s}=\sum_{n=1}^\infty (2n-1)^{-s}-(2n)^{-s} = \sum_{n=1}^\infty \int_{2n-1}^{2n}s x^{-s-1}dx$$ $$\left|\eta(s)-\sum_{n=1}^{2N} (-1)^{n+1} n^{-s}\right| \le \sum_{n=N+1}^\infty \int_{2n-1}^{2n} |s x^{-s-1}|dx\\<|s| \int_{2N+1}^\infty x^{-Re(s)-1}dx=\frac{|s|}{Re(s)}(2N+1)^{-Re(s)}$$ Which suggests that for a fixed $N$, the error increases as $Im(s)$ gets large or $Re(s) \to 0$
See this post if you want a fast converging series valid for every $s$ $$\eta(s)=\sum_{n=0}^\infty \frac{1}{2^{n+1}} \sum_{k=0}^n (-1)^{k} {n \choose k} \frac {1}{(k+1)^s}$$