Python package for obtaining Lebedev quadrature points and coefficients
Project description
PyLebedev
Purpose
PyLebedev is a python package that stores Lebedev quadrature coefficients for integration over the unit sphere.
Installation
Anaconda
Open Anaconda prompt and type
conda install -c ifilot pylebedev
PyPi
Open a terminal and type
pip install pylebedev
Usage
from pylebedev import PyLebedev
import numpy as np
def main():
"""
Test Lebedev quadrature for probe function
"""
# build library
leblib = PyLebedev()
# exact answer to function "testfunc"
exact = 216.0 * np.pi / 35.0
r,w = leblib.get_points_and_weights(9)
integral = 4.0 * np.pi * np.sum(w * tfunc(r[:,0], r[:,1], r[:,2]))
print('Integral: %f vs Exact: %f' % (integral, exact))
def tfunc(x,y,z):
"""
Trial function to test
Adapted from: https://cbeentjes.github.io/files/Ramblings/QuadratureSphere.pdf
This function has the exact result upon integration over a unit sphere
of 216/35 * pi
"""
return 1 + x + y**2 + x**2*y + x**4 + y**5 + x**2*y**2*z**2
if __name__ == '__main__':
main()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
pylebedev-0.2.0.0-py3-none-any.whl
(339.9 kB
view hashes)
Close
Hashes for pylebedev-0.2.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a11afd62e7709485815a76fea68bd2d3b3243d6f03df9ad52aba4e88b609949 |
|
MD5 | 465f4e9cb1102783c6fb70e0dedbcc12 |
|
BLAKE2b-256 | 3c7ef28a50890c119129bc59eb8a1f8b4f3cc0bb33ce3c4131fc51885a23d7dd |