examples_test.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:quadpy 作者: nschloe 项目源码 文件源码
def test_hexahedron():
    val = quadpy.hexahedron.integrate(
            lambda x: numpy.exp(x[0]),
            quadpy.hexahedron.cube_points([0.0, 1.0], [0.0, 1.0], [0.0, 1.0]),
            quadpy.hexahedron.Product(quadpy.line_segment.NewtonCotesClosed(3))
            )

    val = quadpy.hexahedron.integrate(
            lambda x: [numpy.exp(x[0]), numpy.exp(x[1])],
            numpy.stack([
                quadpy.hexahedron.cube_points([0, 1], [0, 1], [0, 1]),
                quadpy.hexahedron.cube_points([0, 1], [0, 1], [0, 1]),
                quadpy.hexahedron.cube_points([0, 1], [0, 1], [0, 1]),
                quadpy.hexahedron.cube_points([0, 1], [0, 1], [0, 1]),
                quadpy.hexahedron.cube_points([0, 1], [0, 1], [0, 1]),
                ], axis=-2),
            quadpy.hexahedron.Product(quadpy.line_segment.NewtonCotesClosed(3))
            )
    assert val.shape == (2, 5)
    return
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号