Skip to contents

Element-wise \(x \times \log(x)\) function on numeric or complex vectors (or objects which can be coerced to them).

Usage

# S3 method for default
xlogx(x)

Arguments

x

numeric or complex vectors or objects which can be coerced to such.

Value

Vector or array containing the values of x*log(x).

Details

See base::Arithmetic and base::log() for details about the multiplication operation and log function.

Note: by convention xlogx(0) returns 0.

Author

Chloe Serre-Combe, Amelie Vernay

Examples

xlogx(4)
#> [1] 5.545177
xlogx(1:10)
#>  [1]  0.000000  1.386294  3.295837  5.545177  8.047190 10.750557 13.621371
#>  [8] 16.635532 19.775021 23.025851