Epstein Zeta Library 0.5.0
Calculates the Epstein Zeta function
|
Authors: Andreas A. Buchheit, Jonathan Busse, Ruben Gutendorf, DevOps: Jan Schmitz
Contact: buchh.nosp@m.eit@.nosp@m.num.u.nosp@m.ni-s.nosp@m.b.de
EpsteinLib is a C library designed for the fast and efficient computation of the Epstein zeta function for arbitrary multidimensional lattices. In addition to the C library, we also offer a Python package, epsteinlib, which can be easily installed via pip. For more information on the properties of the Epstein zeta function and on the underlying algorithm, see our recent preprint https://arxiv.org/abs/2412.16317.
Originally studied by Epstein [1,2], the Epstein zeta function forms the basis for computing general multidimensional lattice sums in classical and quantum physics applications [3]. Together with its regularization, it serves as the central ingredient in the singular Euler-Maclaurin (SEM) expansion, which generalizes the 300-year-old Euler summation formula to lattice sums in higher dimensions with physically relevant power-law interactions [4-5]. An efficiently computable representation of the Epstein zeta function is provided in [6,7,8]. In [8], we discuss in detail the analytical properties of the Epstein zeta function and present an algorithm for its computation, complete with error bounds.
For a \(d\)-dimensional lattice \(\Lambda=A\mathbb Z^d\), with \(A\in \mathbb R^{d\times d}\) regular, \(\boldsymbol x,\boldsymbol y \in \mathbb R^d\), and \(\nu \in \mathbb C\), the Epstein zeta function is defined by the Dirichlet series
$$ Z_{\Lambda,\nu}\begin{vmatrix} \boldsymbol x \newline\boldsymbol y \end{vmatrix} = \sum_{z \in \Lambda}{}^{'} \frac{e^{-2\pi i \boldsymbol y \cdot \boldsymbol z}}{\left| \boldsymbol x- \boldsymbol z\right|^\nu},\quad \mathrm{Re}(\nu)>d, $$
which can be meromorphically continued to \(\nu \in \mathbb C\). Here, the primed sum excludes the case \(\boldsymbol z = \boldsymbol x.\)
The Epstein zeta function is implemented in this library as
In the Python package, it is implemented as
In the Mathematica package, it is implemented as
and evaluates to full precision over the whole parameter range up to ten dimensions.
The Epstein zeta function admits singularities in the lattice \(\boldsymbol x\in\Lambda\) and in the reciprocal lattice \(\boldsymbol y\in\Lambda^*\). To ensure numerical stability when evaluating the Epstein zeta function, we implement the following cutoffs:
When evaluating \(\boldsymbol x\in\Lambda\) or \(\boldsymbol y \in\Lambda^*\), users should set \(\boldsymbol x= \boldsymbol 0\) or \(\boldsymbol y = \boldsymbol 0\) and use the quasi-periodicity of the Epstein zeta function.
In addition, this library includes the regularized Epstein zeta function, which is analytic around \(\boldsymbol y=0\), and is defined via
$$ Z_{\Lambda,\nu}^{\mathrm{reg}}\begin{vmatrix} \boldsymbol x \newline\boldsymbol y \end{vmatrix} = e^{2\pi i \boldsymbol x\cdot\boldsymbol y} Z_{\Lambda,\nu}\left|\begin{aligned} \boldsymbol x \newline\boldsymbol y \end{aligned}\right| -\frac{\hat{s}(\boldsymbol y)}{V_{\Lambda}}, $$
where \(V_{\Lambda}=|\det A|\) is the volume of the elementary lattice cell, and
$$ \hat{s}_\nu(\boldsymbol y) = \frac{\pi^{\nu/2}}{\Gamma(\nu/2)}\Gamma\big((d-\nu)/2\big) (\pi \boldsymbol y^2)^{(\nu - d)/2},\quad \nu \not\in (d+2\mathbb N_0) $$
is the distributional Fourier transform of \(\vert\boldsymbol z \vert^{-\nu}\), where \(\Gamma\) denotes the gamma function and we adopt the choice
$$ \hat s_{d+2k}(\boldsymbol y)= \frac{\pi^{k+d/2}}{\Gamma(k+d/2)}\frac{(-1)^{k+1}}{k!} ( \pi \boldsymbol y^2 )^{k} \log (\pi \boldsymbol y^{2}),\quad k\in \mathbb N_0. $$
In the c library, the regularized Epstein zeta function is included as
in the Python package as
and in the Mathematica package as
To ensure numerical stability when evaluating the regularized Epstein zeta function as a function of \(\boldsymbol x\), we again implement the following cutoff:
Install our required dependencies: meson, ninja, pkg-config, python3 e.g. with
Currently, we support native Windows builds only with GCC installed via https://www.msys2.org/. Different environments may or may not work. However, for the full out of the box development experience we encourage Windows users to use WSL2 and follow the Linux installation instructions.
cd epsteinlib
meson setup build
meson compile -C build
meson test -C build
Proceed either with system-wide or local installation.
Meson supports a system-wide installation of the compiled library. After that, you can use #include <epsteinZeta.h>
and link the library with gcc -lepsteinZeta
. This may require superuser rights.
meson install -C build
.test/lattice_sum.c
with the command gcc -o lattice_sum lattice_sum.c -lm -lepsteinZeta
. You may encounter the problem that the shared library cannot be found. In this case, you need to modify the environment variables. Please continue with the next step. Otherwise, you are done./path/to/library
in the output given by meson install
. include/epsteinZeta.h
and move the compiled library build/src/libepsteinZeta.so
to places of your choice, e. g. test/lattice_sum.c
with the command gcc -o lattice_sum lattice_sum.c -lm -L/your/path/to/library -lepsteinZeta -I/your/path/to/include
.See https://epsteinlib.github.io/epsteinlib/.
Minimal working examples for calculating the Madelung constant in \(3\) dimensions.
In the examples/python/
folder, you can find two more Python examples:
dispersion_relation_3d.py
: This script demonstrates how to use EpsteinLib to calculate quantum dispersion relations in 3D.sem_gaussian_1d.py
: This script showcases the Singular Euler-Maclaurin (SEM) expansion for a Gaussian function in 1D. It has an optional argument --nu
that can be used to set the value of nu. For example, you can run it with python sem_gaussian_1d.py --nu 1
. If no value is provided, it defaults to nu = 1.5.These examples, along with the lattice_sum.py
script, provide a comprehensive overview of how to use EpsteinLib in various scenarios.
Executing this code snipped in the same folder as EpsteinZeta.wl
and setting SetDirectory[NotebookDirectory[]]
is the easiest way to help mathematica find the package.
We provide a nix devshell to have a reproducible development environment with the same dependencies across different operating systems. Once you have installed and configured nix, starting developing is as easy as running nix develop
.
systemctl enable --now nix-daemon.socket
usermod -a -G nix-users <your username>
cd <path/to/repo>
nix develop
or nix run -- <your args>
nix.conf
by executing .local/bin
permanently to your PATH cd <path/to/repo>
nix develop
or nix run -- <your args>
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
[1] P. Epstein. “Zur Theorie allgemeiner Zetafunctionen”. Math. Ann. 56 (1903), pp. 615–644.
[2] P. Epstein. “Zur Theorie allgemeiner Zetafunktionen. II”. Math. Ann. 63 (1906), pp. 205–216
[3] Andreas A. Buchheit et al. “Exact Continuum Representation of Long-range Interacting Systems and Emerging Exotic Phases in Unconventional Superconductors”, Phys. Rev. Research 5, 043065 (2023)
[4] Andreas A Buchheit and Torsten Keßler. “On the Efficient Computation of Large Scale Singular Sums with Applications to Long-Range Forces in Crystal Lattices”. J. Sci. Comput. 90.1 (2022), pp. 1–20
[5] Andreas A Buchheit and Torsten Keßler. “Singular Euler–Maclaurin expansion on multidimensional lattices”. Nonlinearity 35.7 (2022), p. 3706
[6] R. Crandall. “Unified algorithms for polylogarithm, L-series, and zeta variants”. Algorithmic Reflections: Selected Works. PSIpress, 2012
[7] Andreas A. Buchheit, Torsten Keßler, and Kirill Serkh. "On the computation of lattice sums without translational invariance". Mathematics of Computation (Oct. 2024)
[8] Andreas A. Buchheit, Jonathan Busse, and Ruben Gutendorf. "Computation and properties of the Epstein zeta function with high-performance implementation in EpsteinLib". arXiv preprint arXiv:2412.16317 (2024).