2016-08-26

Envelopes in algorithms

In mathematics / computer science algorithms, it is sometimes useful to solve a problem in terms of an "envelope" over source data such as a time series or other data sets.

You could look at a time series as an array of values, and the position in the array is the time (array[0] is the value for time=0) and the contents in that position is the value at that time.

Another way to look at a time series is a function, func(time)=value.

Given a time series function, the upper-left envelope takes a value at time=t that is the maximum of all points of the original function between 0 and t inclusive. If you take the minimum, that's the lower-left envelope. If you start from the right instead of the left (max/min of all points from t onward), it's an upper-right or lower-right envelope. You can draw the envelope on top of the graphed original data to visualize it.

Upper-left envelope (red) over original data / time series (blue)