Skip to main content

Numerical integration technique

Project description



Github Actions status:

Actions Status

Coverage status:

Coverage Status Codecov Status

What is Cubature?

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.

Cubature for Python

This is a wrapper to Prof. Steven Johnson's C package, available at The current version is a wrapper to version 1.0.4 of Prof. Johnson's package.


Please, see the module documentation here

Python wrapper for the Cubature package

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.

Installation from source code

You must have Cython installed. Then do:

python install 

or (usually in Linux):

python3 install

Installation from pip repository

Just do:

python -m pip install cubature

or (usually in Linux):

python3 -m pip install cubature

Running the tests

To run the tests you will have to download the source code. After installing as explained above, go to the source code root folder and run:

py.test .

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.

Citing this Python wrapper for Cubature

We kindly ask you to cite this Python library properly. Also, it would be helpful if you could cite the papers where this methods has been applied as well.

Castro, S.G.P.; Loukianov, A.; et al. "Python wrapper for Cubature: adaptive multidimensional integration". DOI:10.5281/zenodo.2541552. Version 0.15.0, 2022.

Citing Papers using this Python wrapper for Cubature

Used to integrate tangent stiffness matrices in computational solid mechanics

Castro, S.G.P. et al. "Evaluation of non-linear buckling loads of geometrically imperfect composite cylinders and cones with the Ritz method". Composite Structures, Vol. 122, 284-299, 2015.

Castro, S.G.P. et al. "A semi-analytical approach for linear and non-linear analysis of unstiffened laminated composite cylinders and cones under axial, torsion and pressure loads". Thin-Walled Structures, Vol. 90, 61-73, 2015.


Some examples are given in "./examples"

Fork me!

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.


This wrapper follows the GNU-GPL license terms of Steven G. Johnson described in the C Package <>_.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cubature-0.16.0.tar.gz (15.6 MB view hashes)

Uploaded source

Built Distributions

cubature-0.16.0-cp310-cp310-win_amd64.whl (10.5 MB view hashes)

Uploaded cp310

cubature-0.16.0-cp39-cp39-win_amd64.whl (10.5 MB view hashes)

Uploaded cp39

cubature-0.16.0-cp38-cp38-win_amd64.whl (10.5 MB view hashes)

Uploaded cp38

cubature-0.16.0-cp37-cp37m-win_amd64.whl (10.5 MB view hashes)

Uploaded cp37

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page