Numerical integration technique
It is a numerical integration technique. From MathWorld, Ueberhuber (1997, p. 71) and Krommer and Ueberhuber (1998, pp. 49 and 155-165) use the word “quadrature” to mean numerical computation of a univariate integral, and “cubature” to mean numerical computation of a multiple integral.
From the Nanostructures and Computation Wiki at MIT, Steven W. Johnson has written a simple C package for adaptive multidimensional integration (cubature) of vector-valued functions over hypercubes and this is a Python wrapper for the referred C package.
If you are changing _cubature.pyx, you must have Cython installed in order to create a new _cubature.c file (the same is valid for _test_integrands.pyx). The setup.py script will automatically try to use the Cython compiler first.
To install in the site-packages directory and make it importable from anywhere:
python setup.py install
set prefix=anydirectory set PYTHONPATH=%anydirectory%\Lib\site-packages;%PYTHONPATH% mkdir %anydirectory% python setup.py install --prefix="%anydirectory%"
export prefix=anydirectory export PYTHONPATH=$anydirectory/Lib/site-packages;$PYTHONPATH mkdir $anydirectory python setup.py install --prefix=$anydirectory
It will create an .egg file that will go to $anydirectory\Lib\site-packages. This file can be unzipped to obtain the importable module, OR, the full path to this .egg can be added to $PYTHONPATH (which can be also done inside a script through sys.path.append().
If you want to build it locally (without installing in Python’s site-packages) just type:
python setup.py build_ext --inplace clean
The Python wrapper has been proven using test integrands from the C package and some additional testing functions from Genz. The integrands were implemented in Cython and verified with Mathematica.
After building cubature, run the unit tests with the `pytest` package in the package directory. Be aware that this takes several minutes:
python -m pytest test_cubature.py
You are welcome to fork this repository and modify it in whatever way you want. It will also be nice if you could send a pull request here in case you think your modifications are valuable for another person.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size & hash SHA256 hash help||File type||Python version||Upload date|
|cubature-0.13.3-cp35-cp35m-win_amd64.whl (20.9 MB) Copy SHA256 hash SHA256||Wheel||3.5|
|cubature-0.13.3.tar.gz (133.0 kB) Copy SHA256 hash SHA256||Source||None|