← log operator page · numeric/log/comp_comp/number_then_base
pandas ✅ · DuckDB ✅
log with the number and the base both in components, inside calc.
Logarithm: "log ( 1024, 2 ) gives 10", although the page's table and its sentence "calculates the logarithm of num base op" put the base first.
Me_3 = log(Me_1, Me_2), read as the page's examples read it, the number first and the base second: base 2 of 8 is 3, base 10 of 100 is 2 and base 3 of 81 is 4, a Number although both operands are Integers; the other components are kept.
DS_r := DS_1[calc Me_3 := log(Me_1, Me_2)];
| Id_1 | Me_1 | Me_2 |
|---|---|---|
| 1 | 8 | 2 |
| 2 | 100 | 10 |
| 3 | 81 | 3 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true},
{"name": "Me_2", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 | Me_2 | Me_3 |
|---|---|---|---|
| 1 | 8 | 2 | 3.000000 |
| 2 | 100 | 10 | 2.000000 |
| 3 | 81 | 3 | 4.000000 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Me_1", "type": "Integer", "role": "Measure"},
{"name": "Me_2", "type": "Integer", "role": "Measure"},
{"name": "Me_3", "type": "Number", "role": "Measure"}
]
}
]
}