Learn R Programming

utilities (version 0.4.0)

log: 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

Value

The logarithm of the input

Details

This version of the logarithm function allows both numeric and complex inputs, including negative numeric values. If the output of the logarithm has no complex part then the output is given as a numeric value. It also allows the user to generate the gradient and Hessian.

Examples

Run this code
# NOT RUN {
log(1)
log(-1)
log10(-10, TRUE, TRUE)
# }

Run the code above in your browser using DataLab