Files
biodiversity-metrics/R/generalized_log.R

36 lines
548 B
R

#' @importFrom Rdpack reprompt
#'
NULL
#' Generalized logaritmic function.
#'
#' \deqn{x \longmapsto 1 : \log(x) \approx x-1}
#'
#'
#' @references
#' \insertRef{Tsallis:94:00}{ROBITools2}
#'
#'
#' @author Eric Coissac
#' @export
log.q = function(x,q=1) {
if (q==1)
log(x)
else (x^(1-q)-1)/(1-q)
}
#' Generalized exponential function.
#'
#'
#' @references
#' \insertRef{Tsallis:94:00}{ROBITools2}
#'
#' @author Eric Coissac
#' @export
exp.q = function(x,q=1,base=exp(1)) {
if (q==1)
exp(x)
else
(1 + (1-q)*x)^(1/(1-q))
}