https://github.com/cran/pracma
Revision 26e049d70b4a1c237987e260cba68f6a9413736c authored by Hans W. Borchers on 09 April 2019, 04:10:07 UTC, committed by cran-robot on 09 April 2019, 04:10:07 UTC
1 parent bf07673
Tip revision: 26e049d70b4a1c237987e260cba68f6a9413736c authored by Hans W. Borchers on 09 April 2019, 04:10:07 UTC
version 2.2.5
version 2.2.5
Tip revision: 26e049d
einsteinF.R
##
## e i n s t e i n F . R Einstein Functions
##
einsteinF <- function(d, x) {
stopifnot(is.numeric(x) || is.complex(x))
fi <- which(x == 0)
if (d == 1) {
y <- x^2 * exp(x) / (exp(x) - 1)^2
y[fi] <- 1
} else if (d == 2) {
y <- x / (exp(x) - 1)
y[fi] <- 1
} else if (d == 3) {
y <- log(1 - exp(-x))
y[fi] <- -Inf
} else if (d == 4) {
y <- x / (exp(x) - 1) - log(1 - exp(-x))
y[fi] <- Inf
} else {
stop("Argument 'd' must be one of the integers 1, 2, 3, 4.")
}
return(y)
}
Computing file changes ...