log {tutoR} | R Documentation |
log
computes natural logarithms,
log10
computes common (i.e., base 10) logarithms, and
log2
computes binary (i.e., base 2) logarithms.
The general form log(x, base)
computes logarithms with base
base
(log10
and log2
are only special cases).
tutoR
masks offer validation of inputs received. When an input object
is not found, appropriate suggestions are given, with an option
for correcting inputs. Additional information is provided,
such as log
being base e, and when NaNs are generated by
negative inputs.
Also, log1p(x)
computes log(1+x) accurately also for
|x| << 1 (and less accurately when x is approximately -1).
exp
computes the exponential function.
Also, expm1(x)
computes exp(x) - 1 accurately also for
|x| << 1.
log(x, base = exp(1)) log10(x) log2(x) exp(x)
x |
a numeric or complex vector. |
base |
positive number. The base with respect to which
logarithms are computed. Defaults to e=exp(1) . |
exp
and log
are generic functions: methods can be defined
for them individually or via the Math
group generic.
A vector of the same length as x
containing the transformed
values. log(0)
gives -Inf
(when available).
log
and logb
are the same thing in R, but logb
is preferred if base
is specified, for S-PLUS compatibility.
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
The New S Language.
Wadsworth & Brooks/Cole.
(for log
, \log10
and exp
.)
Chambers, J. M. (1998)
Programming with Data. A Guide to the S Language.
Springer. (for logb
.)
expm1
,
log1p
,
logb
,
Trig
,
sqrt
,
Arithmetic
.
log(exp(3)) log10(1e7)# = 7 x <- 10^-(1+2*1:9) cbind(x, log(1+x), log1p(x), exp(x)-1, expm1(x))