50% off | Unlimited Data & AI Learning
Get 50% off unlimited learning

VGAM (version 1.0-6)

lerch: Lerch Phi Function

Description

Computes the Lerch transcendental Phi function.

Usage

lerch(x, s, v, tolerance = 1.0e-10, iter = 100)

Arguments

x, s, v

Numeric. This function recyles values of x, s, and v if necessary.

tolerance

Numeric. Accuracy required, must be positive and less than 0.01.

iter

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.

Value

Returns the value of the function evaluated at the values of x, s, v. If the above ranges of x and v are not satisfied, or some numeric problems occur, then this function will return a NA for those values.

Warning

This function has not been thoroughly tested and contains bugs, for example, the zeta function cannot be computed with this function even though ζ(s)=Φ(x=1,s,v=1). There are many sources of problems such as lack of convergence, overflow and underflow, especially near singularities. If any problems occur then a NA will be returned.

Details

The Lerch transcendental function is defined by Φ(x,s,v)=n=0xn(n+v)s where |x|<1 and v0,1,2,. Actually, x may be complex but this function only works for real x. The algorithm used is based on the relation Φ(x,s,v)=xmΦ(x,s,v+m)+n=0m1xn(n+v)s. See the URL below for more information. This function is a wrapper function for the C code described below.

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

Run this code
# 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