# Differences

This shows you the differences between two versions of the page.

interpolation [2013/11/26 13:52] |
interpolation [2013/11/26 13:52] (current) |
||
---|---|---|---|

Line 1: | Line 1: | ||

+ | ====== Interpolation ====== | ||

+ | TimEL will interpolate a value when some operation requires a higher granularity than the one provided by the value. | ||

+ | |||

+ | In this process, TimEL will discriminate between the two numeric data types available: | ||

+ | |||

+ | * Averages; | ||

+ | * Integrals. | ||

+ | |||

+ | A variable is an average if the following property follows: | ||

+ | |||

+ | A = k for ∀a,b,c: a < b < c and ∀t: a ≤ t < c | ||

+ | → | ||

+ | A = k for ∀t: a ≤ t < b | ||

+ | and A = k for ∀t: b ≤ t < c | ||

+ | |||

+ | An average models correctly any derivate function, such as: | ||

+ | |||

+ | * The speed a vehicle; | ||

+ | * A price of a stock quote. | ||

+ | |||

+ | As a practical example, you can think that if a stock price was 100$ from 09:00 to 15:00, then one can say that the stock price was 100$ from 09:00 to 12:00 and again 100$ from 12:00 to 15:00. | ||

+ | |||

+ | An integral variable is a variable which express a relationship between a value (energy) and a time (its interval), such as: | ||

+ | |||

+ | * The electricity consumed (kWh) per period; | ||

+ | * The number of calls received per period; | ||

+ | |||

+ | For an integral variable, TimEL uses linear interpolation, so: | ||

+ | |||

+ | A = k for ∀a,b,c: a < b < c and ∀t: a ≤ t < c | ||

+ | → | ||

+ | A = k * (b - a) / (c - a) for ∀t: a ≤ t < b | ||

+ | and A = k * (c - b) / (c - a) for ∀t: b ≤ t < c | ||

+ | |||

+ | As a practical example, you can think that if a device consumed 10kWh from 09:00 to 15:00, then one can say that the same device consumed 5kWh from 09:00 to 12:00 and again 5kWh from 12:00 to 15:00. | ||

+ | |||

+ | Every numeric constant is treated as an average by TimEL, to convert an average into an Integral refer to the [[Integral]] function. |