From time to time, especially if I make some proof of concept games or anything real-time in nature I quickly need to generate values between known wanted values.
Exactly what a function does, right?
Well, some things are not easily expressed as a function. You might know where you want some item at a discrete set of points in time, and you simply want the item to get there from the previous position in time.
"In mathematics, extrapolation is the process of estimating, beyond the original observation interval, the value of a variable on the basis of its relationship with another variable" - http://en.wikipedia.org/wiki/Extrapolation
You can set it up like this:
// create an object for training
var extrapolate = new EXTRAPOLATE.LINEAR();
// for this example, ket's keep it simple
// f(x) = 2x
Then you can ask for extrapolated values like this:
extrapolate.valueFor(-1); // -2
extrapolate.valueFor(2); // 4
extrapolate.valueFor(10); // 20