log: Logarithm Function

View source: R/log.R

logR Documentation

Logarithm Function

Description

log returns the logarithm of the input

Usage

log(x, base = exp(1), gradient = FALSE, hessian = FALSE)

log2(x, gradient = FALSE, hessian = FALSE)

log10(x, gradient = FALSE, hessian = FALSE)

Arguments

x

An input value (numeric/complex scalar or vector)

base

The base for the logarithm (a positive scalar value)

gradient

Logical; if TRUE the output will include a 'gradient' attribute

hessian

Logical; if TRUE the output will include a 'hessian' attribute

Details

The logarithm function in base R accomodates complex numbers but it does not accomodate negative values (which is strange). The pressent version of the logarithm function allows both numeric and complex inputs, including negative numeric values. For negative inputs this function gives the princpal complex logarithm of the input value. If the output of the logarithm has no complex part then the output is given as a numeric value. This function also allows the user to generate the gradient and Hessian.

Value

The logarithm of the input

Examples

log(1)
log(-1)
log10(-10, TRUE, TRUE)

utilities documentation built on July 1, 2022, 9:06 a.m.

Related to log in utilities...