log

Syntax

log(X)

Parameters

X is a scalar/vector/pair/matrix/table.

Y (optional) is a positive number indicating the base.

Details

  • If Y is not specified: return the natural logarithm of X.
  • If Y is specified: return the logarithm of X to base Y.

Differences from Python’s numpy.log and scipy.stats.log: numpy.log calculates the natural logarithm. scipy.stats.log is a continuous distribution object obtained by applying a logarithmic transformation to a random variable. DolphinDB’s log is a numeric logarithm function. log calculates the natural logarithm when Y is not specified and directly calculates the logarithm with base Y when Y is specified.

Examples

log(2.718283);
// output: 1
log(0 1 2 3);
// output: [,0,0.693147,1.098612]
log(100, 10)
// output: 2