Computes the Lerch Phi function.
lerch(x, s, v, tolerance = 1.0e-10, iter = 100)
Returns the value of the function evaluated at the values of
x
, s
, v
.
If the above ranges of NA
for those values.
(The C code returns 6 possible return codes, but this is
not passed back up to the R level.)
Numeric.
This function recyles values of x
, s
, and
v
if necessary.
Numeric. Accuracy required, must be positive and less than 0.01.
Maximum number of iterations allowed to obtain convergence.
If iter
is too small then a result of NA
may occur;
if so, try increasing its value.
S. V. Aksenov and U. D. Jentschura wrote the C code (called Version 1.00). The R wrapper function was written by T. Yee.
This function has not been thoroughly tested and contains
limitations,
for example,
the zeta function cannot be computed with this function even
though
NA
will be returned.
For example,
if tolerance
and/or iter
may be needed
to get an answer (that is treated cautiously).
Also known as
the Lerch transcendent, it can be defined by
an integral involving analytical continuation.
An alternative definition is the series
Originally the code was found at
http://aksenov.freeshell.org/lerchphi/source/lerchphi.c
.
Bateman, H. (1953). Higher Transcendental Functions. Volume 1. McGraw-Hill, NY, USA.
zeta
.
if (FALSE) {
s <- 2; v <- 1; x <- seq(-1.1, 1.1, length = 201)
plot(x, lerch(x, s = s, v = v), type = "l", col = "blue",
las = 1, main = paste0("lerch(x, s = ", s,", v = ", v, ")"))
abline(v = 0, h = 1, lty = "dashed", col = "gray")
}
Run the code above in your browser using DataLab