# Riemann Zeta Functions $\zeta$

The simplest representation is

$$ \zeta(s) = \sum_{n=1}^{\infty} \frac{1}{n^s} $$

Often in physics problems, $s$ will be integer. On the real line with $s>1$ we have an alternative definition:

$$ \zeta(s) = \frac{1}{\Gamma(s)} \int_0^{\infty} \frac{u^{s-1}}{e^u - 1} du $$

This is an integral that is needed in quite common problems such as blackbody radiation. Turning it around slightly:

$$ \int_0^{\infty} \frac{x^{\alpha}}{e^x - 1} dx = \Gamma(\alpha + 1) \zeta(\alpha + 1) $$

$\zeta(s)$ is defined over the complex plane, apart from some singularities (such as $s=1$). This is important in number theory and has spawned a vast literature, not immediately comprehensible to most of us.

Does $\zeta(s)$ have a simple representation for integer $s$? Some do, some don't:


```python
from IPython.display import Math
from sympy import zeta, latex
from sympy.abc import x, s

for i in range(-7, 7):
    zeta_i = latex(zeta(i))
    display(Math('\zeta({}) = {}'.format(i, zeta_i)))
```


$\displaystyle \zeta(-7) = \frac{1}{240}$



$\displaystyle \zeta(-6) = 0$



$\displaystyle \zeta(-5) = - \frac{1}{252}$



$\displaystyle \zeta(-4) = 0$



$\displaystyle \zeta(-3) = \frac{1}{120}$



$\displaystyle \zeta(-2) = 0$



$\displaystyle \zeta(-1) = - \frac{1}{12}$



$\displaystyle \zeta(0) = - \frac{1}{2}$



$\displaystyle \zeta(1) = \tilde{\infty}$



$\displaystyle \zeta(2) = \frac{\pi^{2}}{6}$



$\displaystyle \zeta(3) = \zeta\left(3\right)$



$\displaystyle \zeta(4) = \frac{\pi^{4}}{90}$



$\displaystyle \zeta(5) = \zeta\left(5\right)$



$\displaystyle \zeta(6) = \frac{\pi^{6}}{945}$


For real $s$, Python has a few issues with $s < 1$. The function `scipy.special.zeta(x)` returns `nan` for $s \le 1$. A related function `scipy.special.zetac(x)` is more flexible, but the values returned are offset to $\zeta(s) - 1$ and the documentation warns it returns `nan` for $x < -30.8148$.


```python
import numpy as np
import matplotlib.pyplot as plt

plt.rcParams.update({'font.size': 16})

import scipy.special as sp
xlims = (-20, 20)
x = np.linspace(xlims[0], xlims[1], 500)
zetas = sp.zetac(x) + 1
# display(zetas)

plt.figure(figsize=(9, 9))
plt.plot(x, zetas)

plt.xlim(xlims)
plt.ylim((-0.5, 1.5))
plt.xlabel('$x$')
plt.ylabel('$\\zeta(x)$')
plt.title('Plot of the zetas function for real x')                                
plt.grid(True)
```

## References:
    
- MathWorld, http://mathworld.wolfram.com/RiemannZetaFunction.html
- Wikipedia, https://en.wikipedia.org/wiki/Riemann_zeta_function


```python

```

fe04a9d83450204c3f41eada70a0142396ea71a9
ipynb
Jupyter Notebook
math/Zeta.ipynb
colinleach/astro-Jupyter
8d7618068f0460ff0c514075ce84d2bda31870b6
MIT
2020-06-06T15:35:35.000Z
2020-06-06T15:35:35.000Z
math/Zeta.ipynb
colinleach/astro-Jupyter
8d7618068f0460ff0c514075ce84d2bda31870b6
MIT
2019-06-08T11:44:15.000Z
2019-06-10T17:42:32.000Z
math/Zeta.ipynb
colinleach/astro-Jupyter
8d7618068f0460ff0c514075ce84d2bda31870b6
MIT
2021-04-14T15:28:43.000Z
2021-04-14T15:28:43.000Z
Qwen/Qwen-72B
1. YES
2. YES