LOG

LOG(value)[source]

Computes the natural logarithm (ln) of a given number or numeric array.

This function calculates the natural logarithm (base e) of a given number or array of numbers. If an array of numbers is provided, the natural logarithm is calculated for each element individually. The input must be strictly positive; if the input is zero, negative, blank, or in an error state, the formula will evaluate to an error.

Parameters:

value (int | float | Operand) –

The numeric input whose natural logarithm is to be computed.

Supported types:

  • INTEGER

  • DECIMAL

  • INTEGER_ARRAY

  • DECIMAL_ARRAY

Return type:

Formula

Returns:

A Formula object representing the computed natural logarithm.

Supported types:

  • DECIMAL

  • DECIMAL_ARRAY

Raises:

ValueError – If value is not a numeric type or a numeric array.

Examples

Basic usage with a scalar:

LOG(1)
# Returns 0.0

Usage with a model object:

LOG(my_numeric_field)
# Returns a formula representing the natural logarithm of `my_numeric_field`

Usage with an array:

LOG([1, 2.718281828, 7.389056099])
# Returns [0.0, 1.0, 2.0] approximately