寻找用于在细分域上进行数值积分的 Python 包
我想知道是否有人知道基于 numpy/scipy 的 python 包,可以在镶嵌域(在我的具体情况下,由 voronoi 单元格界定的 2D 域)上对复杂的数值函数进行数值积分?过去,我使用了几个 matlab 文件交换之外的包,但如果可能的话,希望保留在我当前的 python 工作流程中。 Matlab 例程为
http://www.mathworks.com/matlabcentral/fileexchange/9435- n-Dimensional-simplex-quadrature
用于求积和网格生成,使用:
http ://www.mathworks.com/matlabcentral/fileexchange/25555-mesh2d-automatic-mesh- Generation
任何有关网格生成以及对该网格进行数值积分的建议将不胜感激。
I was wondering if anyone knew of a numpy/scipy based python package to numerically integrate a complicated numerical function over a tessellated domain (in my specific case, a 2D domain bounded by a voronoi cell)? In the past I used a couple of packages off of the matlab file exchange, but would like to stay within my current python workflow if possible. The matlab routines were
http://www.mathworks.com/matlabcentral/fileexchange/9435-n-dimensional-simplex-quadrature
for the quadrature and mesh generation using:
http://www.mathworks.com/matlabcentral/fileexchange/25555-mesh2d-automatic-mesh-generation
Any suggestions on mesh generation and then numerical integration over that mesh would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这直接在三角形上积分,而不是 Voronoi 区域,但应该很接近。 (用不同数量的点运行来查看?)它也适用于 2d、3d ...
This integrates over triangles directly, not the Voronoi regions, but should be close. (Run with different numbers of points to see ?) Also it works in 2d, 3d ...
数值积分通常是在三角形或矩形等简单元素上定义的。也就是说,您可以将每个 polgon 分解为一系列三角形。运气好的话,您的多边形网格有一个三角形对偶,这将使集成变得更加容易。
quadpy (我的一个项目)对许多域(例如三角形)进行数值积分:
您也可以积分通过为三角形提供数百种方案之一来非自适应地实现。
Numerical integration is typically defined over simple elements like triangles or rectangles. That said, you can decompose every polgon into a series of triangles. With any luck, your polygonal mesh has a triangular dual which would make integration much easier.
quadpy (a project of mine) does numerical integration over many domains, e.g., triangles:
You can also integrate non-adaptively by providing one of hundreds of schemes for the triangle.
scipy.integrate.dblquad怎么样?它使用自适应求积规则,因此您可以放弃对积分网格的控制。不知道这对你的申请来说是有利还是不利。
How about scipy.integrate.dblquad? It uses a adaptive quadrature rule so you relinquish your control over your integrating mesh. Don't know if that is a plus or minus for your application.