IntPy
NOTE 1: This project was discontinued. I’m currently with other priority projects and I have not enough time to develop IntPy. Nobody has shown interest in continuing this project. However, I still notice some demand for this library, so I’ll keep this page online for those interested. (09/21/2009).
NOTE 2: The source code for this project is now available in this repository at GitHub.
What is it?
IntPy is a Python package providing types and functions for Maximum Accuracy Interval Arithmetic developed by me at CIn/UFPE (Brazil).
The Interval Arithmetic is a mathematical tool to solve problems related to numerical errors, based on an algebraic system formed by all closed intervals of the Real Line (or rectangles of the Complex Plane) and operations defined on it. Unlike usual numeric algorithms, interval ones produce intervals containing the correct answer as a result.
The Maximum Accuracy provides an axiomatic method for arithmetic operations performed in computers that captures essential properties associated with rounding.
For more information about it, see:
- Moore, R. E., Interval Analysis. Prentice-Hall, Englewood Cliffs, New Jersey, 1966.
- Moore, R. E., Methods and Applications of Interval Analysis. SIAM Studies in Applied Mathematics, Philadelphia, 1979.
- Kulisch, U. W., Miranker, W. L., Computer Arithmetic in Theory and Practice. Academic Press, 1981.
Features
IntPy is a rising academic project. So, there’s not many things implemented right now. Despite this, I really believe in that tenet: “Release Early, Release Often”.
In fact, currently, only Real Intervals are available. No Complex Intervals, no Interval Vectors and Matrixes, and no extensions of basic math functions. These will be the next work and any help is welcome.
The following list points out what I intend to implement and what is already done:
- Directed rounding: done!
- Rational string input: done!
- Real Intervals: done!
- Basic math functions adherent to IEEE 754: pending!
- Interval extensions of basic math functions for Real Intervals: pending!
- Complex Intervals: pending!
- Interval extensions of basic math functions for Complex Intervals: pending!
- Real Interval Vectors: pending!
- Complex Interval Vectors: pending!
- Real Interval Matrixes: pending!
- Complex Interval Matrixes: pending!
- Basic functions to operate with Interval Vector and Matrixes: pending!
- Common Interval Numeric Algorithms: pending!
How to install
There’s basically two ways to install IntPy: from the MS Windows installer (if this is your OS) or from the source code.
From the MS Windows installer
- Download the MS Windows installer from here based on your Python version
- Follow the instructions of the installer
From the source code
IntPy uses an extension written in C, so if you want to install it from the source code, you need to build this extension first. To do this, you need a C compiler. In Linux, by default, the compiler for Python extensions is GCC. In MS Windows, although the default compiler is MS Visual Studio, I use MinGW because MS VS doesn’t have the <fenv.h> header, which is a dependency of the extension (at least, by now). Thus, if your OS is MS Windows, install MinGW before continue. In general, it should work with any C compiler that supports <fenv.h> and can compile Python extensions, but I just tested with GCC and MinGW. (NOTE: In next release, a solution making use of ctypes will not have this compilation requirement).
- Download the source code from here
- Extract the code and go to the directory
- Enter the command line
python setup.py install(for Linux) or
python setup.py build --compiler=mingw32 install(for MS Windows)
An alternative to both methods is to use easy_install: easy_install intpy
IMPORTANT: Before install, check if the fpconst dependency is installed. If it’s not, IntPy will install but you can’t use it.
Documentation
Unfortunately, at this moment I don’t have time to write a good documentation for IntPy. Despite this, because I use doctest to test the code I write, the source is the documentation itself. I know that it is not sufficient, but this is the best I can do right now. So, when you need to know what some function or operator does and what is available for you, just use the tools of the Python terminal like dir(object) and help(object).
License
The current version of IntPy is licensed under GPLv2.
Pingback: Aritmética de ponto flutuante « Rafael Barreto