e - Generate Euler's number
e
is a fundamental value in mathematics and physics. It is an irrational number, meaning it can not be represented as a fraction, however for the sake of our memory buffers, we have limited it to 15 decimal places, so the value it produces is 2.718281828459045
Syntax
Example - Modelling exponential growth
Logs are not only a source of powerful insight, but also present rich predictive capabilities. Using 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
}