for complex \(z\), where the contour of integration is taken
to avoid the branch cut of the logarithm. Spence’s function is
analytic everywhere except the negative real axis where it has a
branch cut.
Parameters:
zarray_like
Points at which to evaluate Spence’s function
outndarray, optional
Optional output array for the function results
Returns:
sscalar or ndarray
Computed values of Spence’s function
Notes
There is a different convention which defines Spence’s function by
the integral
\[-\int_0^z \frac{\log(1 - t)}{t}dt;\]
this is our spence(1-z).
Array API Standard Support
spence has experimental support for Python Array API Standard compatible
backends in addition to NumPy. Please consider testing these features
by setting an environment variable SCIPY_ARRAY_API=1 and providing
CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following
combinations of backend and device (or other capability) are supported.
For complex inputs on the branch cut, which is the negative real axis,
the function returns the limit for z with positive imaginary part.
For example, in the following, note the sign change of the imaginary
part of the output for z=-2 and z=-2-1e-8j: