firanka
firanka is a Python library to perform calculations on particular kinds of functions. These functions have a domain, which is a single continuous subset of the real number line. These functions can have any values.
firanka allows you do define two classes of such functions or series.
First are the DiscreteSeries. DiscreteSeries further divide the function domain into slices (left-closed, right-open) that have constant values. Manipulating DiscreteSeries and performing calculations on them is cheap.
Then you have FunctionSeries. These are simply defined by user-supplied Python callable.
Best part is, you can join series together (given a joining operator), slice them and so on.
Usage
Ranges
from firanka.series import Range
Range would have been better called an interval. It is a continuous subset of the real number line.
You can create Ranges as follows:
Range(-5, 5, True, False) == Range('<-5;5)')
First boolean argument signifies whether the interval is left-closed, and second whether it is right-closed.
Range's are immutable and hashable. They can be sliced:
Range('<-5;5>')[0:] == Range('<0;5>')
You can check whether a range contains a point
5 not in Range('<-1;5)')
Or you can check for strict inclusion
Range('<-1;1>') in Range('<-2;2>')