Computes the Lerch transcendental Phi function.
lerch(x, s, v, tolerance = 1.0e-10, iter = 100)
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.
Returns the value of the function evaluated at the values of
x
, s
, v
.
If the above ranges of NA
for those values.
This function has not been thoroughly tested and contains bugs,
for example,
the zeta function cannot be computed with this function even though
NA
will be returned.
The Lerch transcendental function is defined by
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
.
# NOT RUN {
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 = paste("lerch(x, s = ", s,", v =", v, ")", sep = ""))
abline(v = 0, h = 1, lty = "dashed", col = "gray")
s <- rnorm(n = 100)
max(abs(zeta(s) - lerch(x = 1, s = s, v = 1))) # This fails (a bug); should be 0
# }
Run the code above in your browser using DataLab