ln - Compute the natural log
ln
, otherwise known as natural log or log to base e (euler's constant). This function will compute the natural log of a numerical value.
Syntax
Arguments
Name | Type | Required | Description |
---|---|---|---|
number | number | true | The number whose natural log we seek to find |
Example - Modelling exponential growth with Euler's number and natural Log
Logs are not only a source of powerful insight, but also present rich predictive capabilities. Using ln
and e
, we can build exponential models to view of how growth may occur. Consider the following documents:
We can begin by calculating the growth rate.:
Now that we have a value indicating the rate at which we are growing, we can then use e()
to calculate our predictive values in 10 hours time:
create prediction_in_ten_hours from (initial_value * power(e(), growth_rate * (time_since_start_hours + 10)))
Now, every log document we have is decorated with a predicted value for what is coming next. The full query looks like this:
create growth_rate from ((1 / time_since_start_hours) * (ln(current_value / initial_value)))
| create prediction_in_ten_hours from (initial_value * power(e(), growth_rate * (time_since_start_hours + 10)))
And our resulting document looks like this:
{
"initial_value": 500,
"current_value": 1000,
"time_since_start_hours": 10,
"growth_rate": 0.0693,
"prediction_in_ten_hours": 1999.41
}
Theme
Light