Skip to content

📐 Numerical integration (quadrature, cubature) in Python

License

Notifications You must be signed in to change notification settings

diego-hayashi/quadpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

quadrature

Build Status Code Health codecov PyPi Version GitHub stars

Numerical integration schemes for triangles.

To numerically integrate any function over any given triangle, do

import numpy
import quadrature

def f(x): return numpy.sin(x[0]) * numpy.sin(x[1])

triangle = numpy.array([[0.0, 0.0], [1.0, 0.0], [0.7, 0.5]])

val = quadrature.triangle.integrate(f, triangle, quadrature.triangle.Strang9())
print(val)

This uses Strang's rule of degree 6 (see picture above); many more are implemented.

Installation

Python Package Index

quadrature is available from the Python Package Index, so with

pip install -U quadrature

you can install/upgrade.

Manual installation

Download quadrature from the Python Package Index. Place the quadrature script in a directory where Python can find it (e.g., $PYTHONPATH). You can install it system-wide with

python setup.py install

Testing

To run the tests, just check out this repository and type

nosetests

Distribution

To create a new release

  1. bump the __version__ number,

  2. publish to PyPi and GitHub:

    $ make publish
    

License

quadrature is published under the MIT license.

About

📐 Numerical integration (quadrature, cubature) in Python

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%