logcosh: Logarithm of cosh

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/logsumexp.R

Description

Compute log(cosh(x)) without floating overflow or underflow

Usage

1

Arguments

x

a numeric vector or matrix.

Details

The computation uses asymptotic expressions for very large or very small arguments. For intermediate arguments, log(cosh(x)) is returned.

Value

Numeric vector or matrix of same dimensions as x.

Author(s)

Gordon K Smyth

See Also

logsumexp

Examples

1
2
3
x <- c(1e-8,1e-7,1e-6,1e-5,1e-4,1,3,50,800)
logcosh(x)
log(cosh(x))

Example output

[1] 5.000000e-17 5.000000e-15 5.000000e-13 5.000000e-11 5.000000e-09
[6] 4.337808e-01 2.309329e+00 4.930685e+01 7.993069e+02
[1] 0.000000e+00 5.107026e-15 5.000445e-13 5.000000e-11 5.000000e-09
[6] 4.337808e-01 2.309329e+00 4.930685e+01          Inf

limma documentation built on Nov. 8, 2020, 8:28 p.m.