Skip to content

Open database for multi-dimensional numerical integration

License

Notifications You must be signed in to change notification settings

qucontrol/openquad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

openquad
Open database for multi-dimensional numerical integration

Source code on Github Documentation Openquad on the Python Package Index License: GPL v3 arXiv


Note

The first stable release is under active development.
Stay tuned for any updates!


OpenQuad offers a collection of highly efficient quadrature methods for evaluating integrals on different domains and geometries, including 1d intervals, spherical surfaces, Euler angles and more. These methods serve as building blocks for constructing custom quadratures, making this package versatile for integrals over arbitrary multi-dimensional domains and tensor spaces.

Key features:

  • Access a large collection of state-of-the-art quadrature methods (Gauss quadratures, spherical designs, uniform coverings, ...).
  • Combine methods to create customized product quadratures.
  • Integrate Python functions and array data with a single command.
  • Export quadrature points and weights for use in other software.

Get started!

Found a bug? Open an issue.
Missing a feature? Start a discussion.

We appreciate and welcome your contribution!

Installation

This package is available on PyPi. Install it with pip into your active environment:

python -m pip install openquad

Basic usage

Obtain Gauss-Legendre sample points and weights for degree 71 on the interval [-10, 5]:

from openquad import Rn

quad = Rn([
    ('GaussLegendre', dict(degree=71, a=-10, b=5)),
])
quad.points
quad.weights

Integrate a function func(theta, phi) over the surface of the two-dimensional unit sphere using a spherical design of degree 7:

from openquad import S2

quad = S2([
    ('S2-Design-Graef', dict(degree=7)),
])
quad.integrate(func)

Create a quadrature method for an integral over the three Euler angles, using Lebedev-Laikov quadrature of degree 5 for the first two angles combined with the composite trapezoid rule with 6 sample points for the third angle, and export sample points and weights in a text file:

from openquad import SO3

quad = SO3([
    ('LebedevLaikov', dict(degree=5)),
    ('Trapezoid', dict(size=6)),
])
quad.savetxt('points_and_weights.dat')

For further information, including advanced examples, background information, and details on the implementation, see the documentation.

Citation

If this package was useful for your research, please cite it.