def test_main_integrate3d(): cube = [ [ (0, 0, 0), (0, 0, 5), (0, 5, 0), (0, 5, 5), (5, 0, 0), (5, 0, 5), (5, 5, 0), (5, 5, 5), ], [2, 6, 7, 3], [3, 7, 5, 1], [7, 6, 4, 5], [1, 5, 4, 0], [3, 1, 0, 2], [0, 4, 6, 2], ] vertices = cube[0] faces = cube[1:] hp_params = hyperplane_parameters(faces, vertices) assert main_integrate3d(1, faces, vertices, hp_params) == -125 assert main_integrate3d(1, faces, vertices, hp_params, max_degree=1) == { 1: -125, y: Rational(-625, 2), z: Rational(-625, 2), x: Rational(-625, 2), }
def test_main_integrate(): triangle = Polygon((0, 3), (5, 3), (1, 1)) facets = triangle.sides hp_params = hyperplane_parameters(triangle) assert main_integrate(x**2 + y**2, facets, hp_params) == Rational(325, 6) assert main_integrate(x**2 + y**2, facets, hp_params, max_degree=1) == \ {0: 0, 1: 5, y: Rational(35, 3), x: 10}
def test_main_integrate(): triangle = Polygon((0, 3), (5, 3), (1, 1)) facets = triangle.sides hp_params = hyperplane_parameters(triangle) assert main_integrate(x**2 + y**2, facets, hp_params) == S(325)/6 assert main_integrate(x**2 + y**2, facets, hp_params, max_degree=1) == \ {0: 0, 1: 5, y: S(35)/3, x: 10}
def test_main_integrate3d(): cube = [[(0, 0, 0), (0, 0, 5), (0, 5, 0), (0, 5, 5), (5, 0, 0),\ (5, 0, 5), (5, 5, 0), (5, 5, 5)],\ [2, 6, 7, 3], [3, 7, 5, 1], [7, 6, 4, 5], [1, 5, 4, 0],\ [3, 1, 0, 2], [0, 4, 6, 2]] vertices = cube[0] faces = cube[1:] hp_params = hyperplane_parameters(faces, vertices) assert main_integrate3d(1, faces, vertices, hp_params) == -125 assert main_integrate3d(1, faces, vertices, hp_params, max_degree=1) == \ {1: -125, y: -S(625)/2, z: -S(625)/2, x: -S(625)/2}
def test_main_integrate3d(): cube = [[(0, 0, 0), (0, 0, 5), (0, 5, 0), (0, 5, 5), (5, 0, 0),\ (5, 0, 5), (5, 5, 0), (5, 5, 5)],\ [2, 6, 7, 3], [3, 7, 5, 1], [7, 6, 4, 5], [1, 5, 4, 0],\ [3, 1, 0, 2], [0, 4, 6, 2]] vertices = cube[0] faces = cube[1:] hp_params = hyperplane_parameters(faces, vertices) assert main_integrate3d(1, faces, vertices, hp_params) == -125 assert main_integrate3d(1, faces, vertices, hp_params, max_degree=1) == \ {1: -125, y: -S(625)/2, z: -S(625)/2, x: -S(625)/2}
def test_integration_reduction_dynamic(): triangle = Polygon(Point(0, 3), Point(5, 3), Point(1, 1)) facets = triangle.sides a, b = hyperplane_parameters(triangle)[0] x0 = facets[0].points[0] monomial_values = [[0, 0, 0, 0], [1, 0, 0, 5],\ [y, 0, 1, 15], [x, 1, 0, None]] assert integration_reduction_dynamic(facets, 0, a, b, x, 1, (x, y), 1,\ 0, 1, x0, monomial_values, 3) == Rational(25, 2) assert integration_reduction_dynamic(facets, 0, a, b, 0, 1, (x, y), 1,\ 0, 1, x0, monomial_values, 3) == 0
def test_integration_reduction_dynamic(): triangle = Polygon(Point(0, 3), Point(5, 3), Point(1, 1)) facets = triangle.sides a, b = hyperplane_parameters(triangle)[0] x0 = facets[0].points[0] monomial_values = [[0, 0, 0, 0], [1, 0, 0, 5],\ [y, 0, 1, 15], [x, 1, 0, None]] assert integration_reduction_dynamic(facets, 0, a, b, x, 1, (x, y), 1,\ 0, 1, x0, monomial_values, 3) == S(25)/2 assert integration_reduction_dynamic(facets, 0, a, b, 0, 1, (x, y), 1,\ 0, 1, x0, monomial_values, 3) == 0
def test_integration_reduction(): triangle = Polygon(Point(0, 3), Point(5, 3), Point(1, 1)) facets = triangle.sides a, b = hyperplane_parameters(triangle)[0] assert integration_reduction(facets, 0, a, b, 1, (x, y), 0) == 5 assert integration_reduction(facets, 0, a, b, 0, (x, y), 0) == 0
def test_integration_reduction(): triangle = Polygon(Point(0, 3), Point(5, 3), Point(1, 1)) facets = triangle.sides a, b = hyperplane_parameters(triangle)[0] assert integration_reduction(facets, 0, a, b, 1, (x, y), 0) == 5 assert integration_reduction(facets, 0, a, b, 0, (x, y), 0) == 0