Files
biodiversity-metrics/R/generalized_log.R

36 lines
548 B
R
Raw Normal View History

2019-02-06 17:16:08 +01:00
#' @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) {
2019-02-06 17:16:08 +01:00
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)) {
2019-02-06 17:16:08 +01:00
if (q==1)
exp(x)
else
(1 + (1-q)*x)^(1/(1-q))
}