2
$\begingroup$

I am using the below function to compute the Hurwitz zeta function from Riemann zeta function. But I am not getting the correct results when compared with the value of Wolfram alpha Hurwitz zeta function. I am suspecting some issues with floating point errors but not sure. Can someone help me out with the explanation ?

function h=hzeta(s,q) z = zeta(s) h = z - sum((1:(q-1)).^(-s));

where q=1-500 and s=1-7

Thanks,

  • 1
    Your results are wrong because you misinterpret the Hurwitz zeta function. It's definition is as follows: $$\zeta(s,\nu)=\sum_{n=0}^\infty\frac1{(n+\nu)^s}$$ From here, one can derive the following: $$\zeta(s,\nu)=\zeta(s)+\sum_{n=0}^\infty\frac1{(n+\nu)^s}-\frac1{n^s}$$ which converges for $\Re(s)>0$ and $-\nu\notin\mathbb N$.2017-05-27

2 Answers 2

3

I don't recognize the equation you are using for the Hurwitz-zeta function. The summation form is

$$\zeta (\nu,u)=\sum_{n=0}^\infty(n+u)^{-\nu} \ \ \ \ \nu>1$$

and the integral form is

$$\zeta (\nu,u)=\frac{1}{\Gamma(\nu)}\int_0^\infty \frac{t^{\nu-1}e^{-ut}}{1-e^{-t}} dt$$

In my own Matlab function I chose the integral form because the summation is notoriously slow to converge.

Reference: K. Oldham, J. Myland, & J. Spanier, An Atlas of Functions, $2^{nd}$ Edition, Ch. 64, Springer.

2

It's rather hard to explain your results if you don't say what your results are. For example $\zeta(2) = 1.644934067$ while $\zeta(2,3) = .3949340668 = \zeta(2) - (1/1^2 + 1/2^2)$. What do you get?