Logarithm: log

Syntax

log ( op , num )

Input parameters

op

the base of the logarithm

num

the number to which the logarithm is applied

Examples of valid syntaxes

log ( DS_1, 2 )
log ( 1024, 2 )

Semantics for scalar operations

The operator log calculates the logarithm of num base op. For example:

log ( 1024, 2 ) gives 10
log ( 1024, 10 ) gives 3.01

Input parameters type

op

dataset { measure<number [value > 1] > _+ }
| component<number [value > 1] >
| number [value > 1]

num

component<integer [value > 0]>
| integer [value > 0]

Result type

result

dataset { measure<number> _+ }
| component<number>
| number

Additional Constraints

None.

Behavior

As for the invocations at Data Set level, the operator has the behaviour of the “Operators applicable on one Scalar Value or Data Set or Data Set Component”. As for the invocations at Component or Scalar level, the operator has the behaviour of the “Operators applicable on two Scalar Values or Data Sets or Data Set Components”, (see the section “Typical behaviours of the ML Operators”).

Examples

Given the operand dataset DS_1:

Input DS_1 (see structure)

Id_1

Id_2

Me_1

Me_2

10

A

1024

0.7545

10

B

64

13.45

11

A

32

1.87

Example 1

DS_r := log ( DS_1, 2 );

results in (see structure):

DS_r

Id_1

Id_2

Me_1

Me_2

10

A

10.0

-0.4064071941354039

10

B

6.0

3.749534267669262

11

A

5.0

0.9030382701129122

Example 2

DS_r := DS_1 [ calc Me_1 := log (Me_1, 2) ];

results in (see structure):

DS_r

Id_1

Id_2

Me_1

Me_2

10

A

10.0

0.7545

10

B

6.0

13.45

11

A

5.0

1.87