lerch {VGAM} | R Documentation |
Lerch Phi Function
Description
Computes the Lerch Phi function.
Usage
lerch(x, s, v, tolerance = 1.0e-10, iter = 100)
Arguments
x , s , v |
Numeric.
This function recyles values of |
tolerance |
Numeric. Accuracy required, must be positive and less than 0.01. |
iter |
Maximum number of iterations allowed to obtain convergence.
If |
Details
Also known as the Lerch transcendent, it can be defined by an integral involving analytical continuation. An alternative definition is the series
which converges for
as well as for
with
.
The series is undefined for integers
.
Actually,
may be complex but this function only works
for real
.
The algorithm used is based on the relation
See the URL below for more information. This function is a wrapper function for the C code described below.
Value
Returns the value of the function evaluated at the values of
x
, s
, v
.
If the above ranges of and
are not satisfied,
or some numeric problems occur, then
this function will return an
NA
for those values.
(The C code returns 6 possible return codes, but this is
not passed back up to the R level.)
Warning
This function has not been thoroughly tested and contains
limitations,
for example,
the zeta function cannot be computed with this function even
though
.
Several numerical problems can arise,
such as lack of convergence, overflow
and underflow, especially near singularities.
If any problems occur then an
NA
will be returned.
For example,
if and
then
convergence may be so slow that
changing
tolerance
and/or iter
may be needed
to get an answer (that is treated cautiously).
Note
There are a number of special cases, e.g.,
the Riemann zeta-function is
.
Another example is the Hurwitz zeta function
.
The special case of
corresponds to the hypergeometric
2F1,
and this is implemented in the gsl package.
The Lerch Phi function should not be confused with the
Lerch zeta function though they are quite similar.
Author(s)
S. V. Aksenov and U. D. Jentschura wrote the C code (called Version 1.00). The R wrapper function was written by T. Yee.
References
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.
See Also
zeta
.
Examples
## 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 = paste0("lerch(x, s = ", s,", v = ", v, ")"))
abline(v = 0, h = 1, lty = "dashed", col = "gray")
## End(Not run)