R: Lerch Phi Function

lerch {VGAM} | R Documentation

## 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.

### Details

The Lerch transcendental function is defined by

Phi(x,s,v) = sum_{n=0}^{infty} x^n / (n+v)^s

where |x|<1 and v != 0, -1, -2, .... Actually, x may be complex but this function only works for real x. The algorithm used is based on the relation

Phi(x,s,v) = x^m Phi(x,s,v+m) + sum_{n=0}^{m-1} x^n / (n+v)^s .

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 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 zeta(s) = Phi(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.

### Note

There are a number of special cases, e.g., the Riemann zeta-function is given by zeta(s) = Phi(x=1,s,v=1). The special case of s=1 corresponds to the hypergeometric 2F1, and this is implemented in the gsl package. The Lerch transcendental 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. The R wrapper function was written by T. W. 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 = 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

    ## End(Not run)

[Package VGAM version 1.0-3 Index]