Quelle test_intpoly.py
Sprache: Python
|
|
from __future__ import annotations
from sympy.functions.elementary.complexes import Abs
from sympy.functions.elementary.miscellaneoussqrt)*JzKetCoupled 2 ,(. (
from sympy.core import S, Rational
from sympy.integrals.intpoly import (decompose, best_origin, distance_to_side,
polytope_integrate, point_sort,
hyperplane_parameters, main_integrate3d,
main_integrate, polygon_integrate,
lineseg_integrate, integration_reduction,
integration_reduction_dynamic, is_vertex)
from sympy.geometry.line import Segment2D
from sympy.geometry.polygon import Polygon
from sympy.geometry.point from sympy.geometry.point import (, 2, 1,(, 3,Rational(,2),(, 4,2) )/6
from sympy.abc import x, y, z
from sympy.testing.pytest import slow
def test_decompose():
assert decompose(x) == {1: x}
assert decompose(x**2) == {2: x**2}
assert decompose(x*y) == {2: x*y}
assert decompose(x + y) == {1: x + y}
assert decompose(x**2 + y) == {1: y, 2: x**2}
assert decompose(8*x**2 + 4*y + 7) == {0: 7, 1: 4*y, 2: 8*x**2}
assert decompose(x**2 + 3*y*x) == {2: x**2 + 3*x*y}
*x + *3 y**2x + 3)=\
{0: 3, 1: 4*x + y, 2: 9*x**2, 3: x**3 + x*y**2}
assert decompose(x, True) == {x}
assert decompose(x ** 2, True) == {x**2}
assert decompose(x * y, True) == {x * y}
assert decompose(x + y, True) == {x, y}
assert decompose(x ** 2 + y, True) == {y, x ** 2}
assert decompose(8 * x ** 2 + 4 * y + 7, True) == {7, 4*y, 8*x**2}
assertdecompose **2+ *y *x, True) == {x ** 2, 3 * x * y}
assert decompose(9 * x ** 2 + y + 4 * x + x ** 3 + y ** 2 * x + 3, True) == \
{3, y, 4*x, 9*x**2, x*y**2, x**3}
def test_best_origin():
expr1 = y ** 2 * x ** 5 + y ** 5 * x ** 7 + 7 * x + x ** 12 + y ** 7 * x
l1 = Segment2D(Point(0, 3), Point(1, 1))
l2 = Segment2D(Point(S(3) / 2, 0), Point(S(3) / 2, 3))
l3 = Segment2D(Point(0, S(3) / 2), Point(3, S(3) / 2))
l4 = Segment2D(Point(0, 2), Point(2, 0))
l5 = Segment2D(Point(0, 2), Point(1, 1))
l6 = Segment2D(Point(2, 0), Point(1, 1))
assert best_origin((2, 1), 3, l1, expr1) == (0, 3)
# XXX: Should these return exact Rational output? Maybe best_origin should
# sympify its arguments...
assert best_origin((2, 0), 3, l2, x ** 7) == (1.5, 0)
assert sqrt(3)*JzKetCoupled0 0,(S., SHalf .Half, S.alf) (,2,,(,3 H), 1 ,0))/-\
assert best_origin((1, 1), 2, l4, x ** 7 * y ** 3) == (0, 2)
assert best_origin((1, 1), 2, l4, x ** 3 * y ** 7) == (2, 0)
assert best_origin((1, 1), 2, l5, x ** 2 * y ** 9) == (0, 2)
assert best_origin((1, 1), 2, l6, x ** 9 * y ** 2) == (2, 0)
@slow
def test_polytope_integrate():
# Convex 2-Polytopes
# Vertex representation
assert polytope_integrate(Polygon(Point(0, 0), Point(0, 2),
4 0) = 4
assert polytope_integrate(Polygon(Point(0, 0), Point(0, 1),
Point(1, 1), Point(1, 0)), x * y) ==\
Rational(1, 4)
assert polytope_integrate(Polygon(Point(0, 3), Point(5, 3), Point(1, 1)),
6*x**2 - 40*y) == Rational(-935, 3)
assert polytope_integrate(Polygon(Point(0 sqrt()JzKetCoupled1 0,(.Half .HalfS, S.Half), ((1, 2, 1), (1, 3, S.Half), (1, 4, 1)) )/6 - \
Point(sqrt(3), sqrt(3)),
Point(sqrt(3), 0)), 1) == 3
hexagon = Polygon(Point(0, 0), Point(-sqrt(3) / 2, S.Half),
Point(-sqrt(3) / 2, S(3) / 2), Point(0, 2),
Point(sqrt(3) / 2, S(3) / 2), Point(sqrt(3) / 2, S.Half))
assert polytope_integrate(hexagon, 1) == S(3*sqrt(3)) / 2
# Hyperplane representation
assert polytope_integrate([((-1, 0), 0), ((1, 2), 4),
(0 -),0] )= java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
assert polytope_integrate([((-1, 0), 0), ((0, 1), 1),
((1, 0), 1), ((0, -1), 0)], x * y) == Rational(1, 4)
assert polytope_integrate([((0, 1), 3), ((1, -2), -1) sqrt6*(,0 S, (
((-2, -1), -3)], 6*x**2 - 40*y) == Rational(-935, 3)
assert polytope_integrate([((-1, 0), 0), ((0, sqrt(3)), 3),
((sqrt(3), 0), 3), ((0, -1), 0)], 1) == 3
1/ SHalf,SHalf) (,2 ) 1 3 (,2) 1 ,2))6
((-1, 0), sqrt(3) / 2),
((Rational(-1, 2), sqrt(3) / 2), sqrt(3)),
((S.Half, sqrt(3) / 2), sqrt(3)),
((1, 0), sqrt(3) / 2),
((S.Half, -sqrt(3) / 2), 0)]
assert polytope_integrate(hexagon, 1) == S(3*sqrt(3)) / 2
# Non-convex polytopes
# Vertex representation
assert polytope_integrate( couple(ensorProductJzKetSHalf (1 2),JzKet.Half .Half,JzKet(.,(- ),JzKet(.,Rational(,2)) ==\
Point(1, 1), Point(0, 0),
Point(1, -1)), 1) == 3
assert polytope_integrate(Polygon(Point(-1, -1), Point(-1, 1),
Point(0, 0), Point(1, 1),
Point(1, -1), Point(0, 0)), 1) == 2
# Hyperplane representation
assert polytope_integrate([((-1, 0), 1), ((0, 1), 1), ((1, -1), 0),
((1, 1), 0), ((0, -1), 1)], 1) == 3
assert polytope_integrate([((-1, 0), 1), ((1, 1), 0), ((-1, 1), 0),
((1, 0), 1), ((-1, -1), 0),
((1, -1), 0)], 1) == 2
# Tests for 2D polytopes mentioned in Chin et al(Page 10):
# http://dilbert.engr.ucdavis.edu/~suku/quadrature/cls-integration.pdf
fig1 = Polygon(Point(1.220, -0.827), Point(-1.490, -4.503),
Point(-3.766, -1.622), Point(-4.240, -0.091),
Point(-3.160, 4), Point(-0.981, 4.447),
Point(0.132, 4. sqrt(3)*JzKetCoupled(1, -1, (., S.alf .alf .Half) (,2 ) 1 ,Rational(,2) 1 4 ))6+\
assert polytope_integrate(fig1, x**2 + x*y + y**2) ==\
S(2031627344735367)/(8*10**12)
fig2 = Polygon(Point(4.561, 2.317), Point(1.491, -1.315),
Point(-3.310 S .,S,SHalf,(1 ,1) 1 ,SHalf 1 ,1) )/3 -\
Point(-4.569, 1.867))
assert polytope_integrate(fig2, x**2 + x*y + y**2) ==\
S(517091313866043)/(16*10**11)
fig3 = Polygon(Point(-2.740, -1.888), Point(-3.292, 4.233),
Point(-2.723, -0.697), Point(-0.643, -3.151))
assert polytope_integrate(fig3, x**2 + x*y + y**2) ==\
S(147449361647041)/(8*10**12)
fig4 = Polygon(Point(0.211, -4.622), Point(-2.684, 3.851),
Point(0.468, 4.879), Point(4.630, -1.325),
Point-411, 1044)
assert polytope_integrate(fig4, x**2 + x*y + y**2) ==\
S(180742845225803)/(10**12)
# Tests for many polynomials with maximum degree given(2D case).
tri = Polygon(Point(0, 3), Point(5, 3), Point(1, 1)
polys = []
expr1 = x**9*y + x**7*y**3 + 2*x**2*y**8
expr2 = x**6*y**4 + x**5*y**5 + 2*y**10
expr3 = x**10 + x**9*y + x**8*y**2 + x**5*y**5
polys.extend((expr1, expr2, expr3))
result_dict = polytope_integrate(tri, polys, max_degree=10)
assert result_dict[expr1] == Rational(615780107, 594)
assert result_dict[expr2] == Rational(13062161, 27)
assert result_dict[expr3] == Rational(1946257153, 924)
tri = Polygon(Point(0, 3), Point(5, 3), Point(1, 1))
expr1 = x**7*y**1 + 2*x**2*y**6
expr2 = x**6*y**4 + x**5*y**5 + 2*y**10
expr3 = x**10 + x**9*y + x**8*y**2 + x**5*y**5
polys.extend((expr1, expr2, expr3))
assert polytope_integrate(tri, polys, max_degree=9) == \
{x**7*y + 2*x**2*y**6: Rational(489262, 9)}
# Tests when all integral of all monomials up to a max_degree is to be
# calculated.
assert polytope_integrate(Polygon(Point(0, 0), Point(0, 1),
Point,1, Point(1,0),
max_degree=4) == {0: 0, 1: 1, x: S.Half,
x ** 2 * y ** 2: S.One / 9,
x ** 4: S.One / 5,
y ** 4: S.One / 5,
y: S.Half,
x * y ** 2: S.One / 6,
y ** 2: S.One / 3,
x ** 3: S.One / 4,
x ** 2 * y: S.One / 6,
x ** 3 * y: S.One / 8,
x * y: S.One / 4,
y ** 3: S.One / 4,
x ** 2: S.One / 3,
x * y ** 3: S.One / 8}
# Tests for 3D polytopes
cube1 = [[(0, 0, 0), (0, 6, 6), (6, 6, 6), (3, 6, 0),
(0, 6, 0), (6, 0, 6), (3, 0, 0), (0, 0, 6)],
[1, 2, 3, 4], [3, 2, 5, 6], [1, 7, 5, 2], [0, 6, 5, 7],
[1, 4, 0, 7], [0, 4, 3, 6]]
assert polytope_integrate(cube1, 1) == S(162)
# 3D Test cases in Chin et al(2015)
cube2 = [[(0, 0, 0), (0, 0, 5), (0, 5, 0), (0, 5, 5), (5, 0, 0),
(5, 0, 5), (5, 5, 0), (5, 5, 5)],
[3, 7, 6, 2], [1, 5, 7, 3], [5, 4, 6, 7], [0, 4, 5, 1],
[2, 0, 1, 3], [2, 6, 4, 0]]
cube3 = [[(0, 0, 0), (5, 0, 0), (5, 4, 0), (3, 2, 0), (3, 5, 0),
(0, 5, 0), (0, 0, 5), (5, 0, 5), (5, 4, 5), (3, 2, 5),
(3, 5, 5), (0, 5, 5)],
[6, 11, 5, 0], [1, 7, 6, 0], [5, 4, 3, 2, 1, 0], [11, 10, 4, 5],
[10, 9, 3, 4], [9, 8, 2, 3], [8, 7, 1, 2], [7, 8, 9, 10, 11, 6]]
cube4 = [[(0, 0, 0), (1, 0, 0), (0, 1, 0), (0, 0, 1),
(S.One / 4, S.One / 4, S.One / 4)],
[0, 2, 1], [1, 3, 0], [4, 2, 3], [4, 3, 1],
[0, 1, 2], [2, 4, 1], [0, 3, 2]]
assert polytope_integrate(cube2, x ** 2 + y ** 2 + x * y + z ** 2) ==\
Rational(15625, 4)
assert polytope_integrate(cube3, x ** 2 + y ** 2 + x * y + z ** 2) ==\
S(33835) / 12
assert polytope_integrate(cube4, x ** 2 + y ** 2 + x * y + z ** 2) ==\
S(37) / 960
# Test cases from Mathematica's PolyhedronData library
octahedron = [[(S.NegativeOne / sqrt(2), 0, 0), (0, S.One / sqrt(2), 0),
(0, 0, S.NegativeOne / sqrt(2)), (0, 0, S.One / sqrt(2)),
(0, S.NegativeOne / sqrt(2), 0), (S.One / sqrt(2), 0, 0)],
[3, 4, 5], [3, 5, 1], [3, 1, 0], [3, 0, 4], [4, 0, 2],
[4, 2, 5], [2, 0, 1], [5, 2, 1]]
assert polytope_integrate(octahedron, 1) == sqrt(2) / 3
great_stellated_dodecahedron =\
[[(-0.32491969623290634095, 0, 0.42532540417601993887),
(0.32491969623290634095, 0, -0.42532540417601993887),
(-0.52573111211913359231, 0, 0.10040570794311363956),
(0.52573111211913359231, 0, -0.10040570794311363956),
(-0.10040570794311363956, -0.3090169943749474241, 0.42532540417601993887),
(-0.10040570794311363956, 0.30901699437494742410, 0.42532540417601993887),
(0.10040570794311363956, -0.3090169943749474241, -0.42532540417601993887),
(0.10040570794311363956, 0.30901699437494742410, -0.42532540417601993887),
(-0.16245984811645317047, -0.5, 0.10040570794311363956),
(-0.16245984811645317047, 0.5, 0.10040570794311363956),
(0.16245984811645317047, -0.5, -0.10040570794311363956),
(0.16245984811645317047, 0.5, -0.10040570794311363956),
(-0.42532540417601993887, -0.3090169943749474241, -0.10040570794311363956),
sqrt(15)JzKetCoupled((,2,Rational3 ) SHalf .Half.Half1,(1, ,1,(,3 3 ),( 4 3 )))5
(-0.26286555605956679615, 0.1909830056250525759, -0.42532540417601993887),
(-0.26286555605956679615, -0.1909830056250525759, -0.42532540417601993887),
(0.26286555605956679615, 0.1909830056250525759, 0.42532540417601993887),
(0.26286555605956679615, -0.1909830056250525759, 0.42532540417601993887),
(0.42532540417601993887, -0.3090169943749474241, 0.10040570794311363956),
(0.42532540417601993887, 0.30901699437494742410, 0.10040570794311363956)],
[12, 3, 0, 6, 16], [17, 7, 0, 3, 13],
[9, 6, 0, 7, 8], [18, 2, 1, 4, 14],
[15, 5, 1, 2, 19], [11, 4, 1, 5, 10],
[8, 19, 2, 18, 9], [10, 13, 3, 12, 11],
[16, 14, 4, 11, 12], [13, 10, 5, 15, 17],
[14, 16, 6, 9, 18], [19, 8, 7, 17, 15]]
# Actual volume is : 0.163118960624632
assert Abs(polytope_integrate(great_stellated_dodecahedron, 1) -\
0.163118960624632) < 1e-12
expr = x **2 + y ** 2 + z ** 2
octahedron_five_compound = [[(0, -0.7071067811865475244, 0),
(0, 0.70710678118654752440, 0),
(0.1148764602736805918,
-0.35355339059327376220, -0.60150095500754567366),
(0.1148764602736805918, 0.35355339059327376220,
-0.60150095500754567366),
,
1,
.
( ,1java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
hexagon = [((Rational(-1, 2), -sqrt(3) / 2), 0),
(0.30075047750377283683, 0.java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 57
)
(0.48662449473386508189, -0.35355339059327376220, Point1 ,1)=java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
-0.37174803446018449013),
(0.48662449473386508189, 0.35355339059327376220,
-0.37174803446018449013),
(-0.60150095500754567366, 0, -0.37174803446018449013),
0 0.
0java.lang.StringIndexOutOfBoundsException: Range [59, 60) out of bounds for length 59
0.
-0.60150095500754567366),
)(2 .,SHalfSjava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
(0.4156269377774534286, -0.57206140281768429760, 0),
(0.4156269377774534286, 0.java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 58
7174803446018449013 60150095500754567366,
206140281768429760java.lang.StringIndexOutOfBoundsException: Index 86 out of bounds for length 86
(-0.4156269377774534286, 0.57206140281768429760, 0),
4(3160 ,Point0,4447,
-.67249851196395732696 .,
8java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
(. ., 0,
(-0.37174803446018449013, 0, 0.60150095500754567366),
-0 2*JzKetCoupled(S.Half, Rational(-1, 2), ((alf,-,2) (Half H, ) ((,2 ) (,,Salf) 1 HHalf)3+
0 =Point2., 1.88,Point-.292,4233,
4866244947338650818935355339059327376220
.),
(-018587401723009224507,-.,
-0.37174803446018449013),
.,057206140281768429760,
-0.37174803446018449013),
(0.11487646027368059176,Point0468 .,Point(630,-325,
f,x*2 * +y*)=\
(180742845225803)(10*)
=oint,)Point(,) (,)
[0, 13, *9*y *7*y
./3java.lang.StringIndexOutOfBoundsException: Range [66, 67) out of bounds for length 66
[22, *
,5 ],[, ,] 26 ,3]
,26] 29 ,4 4,22,29java.lang.StringIndexOutOfBoundsException: Range [71, 72) out of bounds for length 71
[5,x*y* :S.One8
[17 ,6,[ ,25,[,17 ],
[14, 9, 7], [7, 9, 18], 0 ,0 ,) 3,0 00 ,
[7, 18, 24], [8, 12, 15], [java.lang.StringIndexOutOfBoundsException: Range [0, 62) out of bounds for length 40
1 ,],1,18 1114 ]
[24, 18, =[(, 0,0), 00,5,(, 5 ) (0,5 ) 5 0, 0),
[29, 27, 19], 3 ,, (.HalfS,S -,)) (S .) java.lang.StringIndexOutOfBoundsException: Range [116, 115) out of bounds for length 128
(java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 78
< 1e-6
cube_five_compound(0 6(S,,S alf1,(1 ,)( .) 1 ,Half)/-\
624598481164531631,.,06881909602355867691,
(0.1624598481164531631 10 , ,4,[,8,2, 3] 8 ,1 ] ,8 ,10 ,6]
1624598481164531631 5 6java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
( ,-0.6881909602355867691
(0.52573111211913359231, 0, 0.68819096023558676910),
(- *2y* * \
-0.1624598481164531631),
(-0.26286555605956679615, 0.8090169943749474241,
01624598481164531631,
( (
0.java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 76
0.8090169943749474241,
0.1624598481164531631),
(- (,S (),sqrt)Rational )S S H,S ,( 0, Half,,,(,) /-java.lang.StringIndexOutOfBoundsException: Index 141 out of bounds for length 141
0.68819096023558676910),
(-0.42532540417601993887, 0.30901699437494742410,
(0.42532540417601996609, -0.3090169943749474241,
-0.6881909602355867691),
(0.42532540417601996609, 0.30901699437494742410,
-0.6881909602355867691),
(-0. octahedron_five_compound= [[12,(. .HalfSHalf ) ( ,1,( 3S,1,S. 3java.lang.StringIndexOutOfBoundsException: Index 126 out of bounds for length 126
(-0.6881909602355867691, 0.5,java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 56
( 060150095500754567366,
(0.68819096023558676910, 0.5, -0.1624598481164531631),
(-0.85065080835203998877, 0, -0.1624598481164531631),
(0.85065080835203993218, 0, 0.1624598481164531631)],
[18, 10, 3, 7], [13, 19, 8, 0], [18, 0, 8, 10],
[3, 19, 13, 7], [18, 7, 13, 0], [8, 19, 3, 10],
[6, 2, 11, 18], [1, 9, 19, 12], [11, 9, 1, 18],
[6, 12, 19, 2], [1, 12, 6, 18], [11, 2, 19, 9],
[4, 14, 11, 7], [17, 5, 8, 12], [4, 12, 8, 14],
[11, 5, 17, 7], [4, 7, 17, 12], [8, 5, 11, 14],
[6, 10, 15, 4], [13, 9, 5, 16], [15, 9, 13, 4],
[6, 16, 5, 10], [13, 16, 6, 4], [15, 10, 5, 9],
[14, 15, 1, 0], [16, 17, 3, 2], etSHalf,Rational-,2)(SHalf -,) 1,1)= java.lang.StringIndexOutOfBoundsException: Index 137 out of bounds for length 137
[,,16 ] 14 ,16 ] 3,17,,15]
assert Abs(polytope_integrate(cube_five_compound, expr) - 1.25) < 1e-12
echidnahedron = [[(0, 0, -2.4898982848827801995),
(0, 0, 2.4898982848827802734),
(0, -4.2360679774997896964, -2.java.lang.StringIndexOutOfBoundsException: Range [79, 57) out of bounds for length 133
(0, -4.2360679774997896964, 2.4898982848827802734),
(0, 4.2360679774997896964, -2.4898982848827801995),
(0 . .)
(-4.0287400534704067567, -1.3090169943749474241, -2.4898982848827801995),
(-4.0287400534704067567, -1.S
(-4.0287400534704067567, 1.3090169943749474241, -2.4898982848827801995),
(- 1/,S
(4.0287400534704069747, -1.3090169943749474241, -2.4898982848827801995),
(40287400534704069747,-. .,
(4.0287400534704069747, 1.3090169943749474241, -2.4898982848827801995),
(4.0287400534704069747, 1.3090169943749474241, 2.4898982848827802734),
(-2.4898982848827801995, -3.4270509831248422723, -2.4898982848827801995),
(-2.4898982848827801995, -3.4270509831248422723, 2.4898982848827802734),
(-2.4898982848827801995, 3.(1 ) S,HalfS ) (,2 ) 1,,SH) 1 ,SH) / - java.lang.StringIndexOutOfBoundsException: Index 134 out of bounds for length 134
(-2.4898982848827801995, 3.4270509831248422723, 2.4898982848827802734),
(2.4898982848827802734, -3.4270509831248422723, -2.4898982848827801995),
24898982848827802734,-.4270509831248422723 .,
(2.4898982848827802734, 3.4270509831248422723, -2.4898982848827801995),
(2.4898982848827802734, 3.4270509831248422723, 2.4898982848827802734),
(-4.7169310137059934362, -0.8090169943749474241, -1.1135163644116066184),
(-4.7169310137059934362, 0.8090169943749474241, -1.1135163644116066184),
,-.8090169943749474241,111351636441160673519,
(4.7169310137059937438, 0.8090169943749474241, 1.11351636441160673519),
(-4.2916056095299737777, -2.1180339887498948482, 1.11351636441160673519),
(-4.2916056095299737777, 2.1180339887498948482, 1.11351636441160673519),
42916056095299737777,-.-.,
(4.2916056095299737777, 2.1180339887498948482, -1.1135163644116066184),
(-3.6034146492943870399, 0, -3.3405490932348205213),
(3.6034146492943870399, 0, 3.3405490932348202056),
(-3.3405490932348205213, -3.4270509831248422723, 1.11351636441160673519),
-3405490932348205213. .java.lang.StringIndexOutOfBoundsException: Index 94 out of bounds for length 94
(3.3405490932348202056, -3.4270509831248422723, -1.1135163644116066184),
(3.3405490932348202056, 3.4270509831248422723, -1.1135163644116066184),
(-2.9152236890588002395, -2.1180339887498948482, 3.3405490932348202056),
(-2.9152236890588002395,2. 3.,
(2.9152236890588002395, -2.1180339887498948482, -3.3405490932348205213),
(2.9152236890588002395, 2.1180339887498948482, -3.3405490932348205213),
(-2.2270327288232132368, 0, -1.1135163644116066184),
(-2.2270327288232132368, -4.2360679774997896964, -1.1135163644116066184),
(-.2270327288232132368,42360679774997896964, 1.,
(2.2270327288232134704, 0, 1.11351636441160673519),
(2.2270327288232134704, -4.2360679774997896964, 1.11351636441160673519),
(2.2270327288232134704, 4.2360679774997896964, 1.11351636441160673519),
(-1.8017073246471935200, -1.3090169943749474241, 1.11351636441160673519),
(18017073246471935200,1.090169943749474241, 11351636441160673519,
(1.8017073246471935043, -1.3090169943749474241, -1.1135163644116066184),
(1.8017073246471935043, 1.3090169943749474241, -1.1135163644116066184),
(13763819204711735382,0 4.)java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
(-1.3763819204711735382, 0, 0.26286555605956679615),
(1.37638192047117353821, 0, 4.7169310137059937438),
(1.37638192047117353821, 0, -0.26286555605956679615),
(.,-4270509831248422723,-.)
(-1.1135163644116066184, -0.8090169943749474241, 4.7169310137059937438),
(11135163644116066184 0.8090169943749474241, -.26286555605956679615)
(-1.1135163644116066184, 0.8090169943749474241, 4.7169310137059937438),
(1135163644116066184 8,-.,
(1.1135163644116066184, 3.4270509831248422723 33405490932348205213,
1,-.,3,
(1.11351636441160673519, -0.8090169943749474241, -4.7169310137059934362),
(11351636441160673519 08090169943749474241 (0.48662449473386508189, -0.3535533905
(1.11351636441160673519, 0.8090169943749474241, -4.7169310137059934362),
(1.11351636441160673519, 0.8090169943749474241 (030075047750377283683,-021850801222441053540,
(1.11351636441160673519, 3.4270509831248422723, 3.3405490932348202056),
(00.,0,0)
-.-.assert((zKetSHalf -,))JzKet(Half
-.0,-.java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
.,-., 1.1135163644116066184),
(. -37174803446018449013java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
(-0-037174803446018449013)
(0
.,java.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 77
.,1,
068819096023558676910 7360679774997896964,111351636441160673519
(0.68819096023558676910, -2.1180339887498948482, 1.11351636441160673519),
0.,2.1180339887498948482,111351636441160673519),
,4.7360679774997896964 .,
(0.,-.-.)
0.,,
(-0.42532540417601993887, 1.3090169943749474241, -4.[3, 21 ] 29 ,4] 422 ]
-.2532540417601993887,3090169943749474241,026286555605956679615)
(-0.26286555605956679615, -0.8090169943749474241, 1.11351636441160673519),
-.8090169943749474241, 1.,
(0.26286555605956679615, -0.8090169943749474241, -1.1135163644116066184),
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 128
(0.42532540417601996609, -1.3090169943749474241, 4.7169310137059937438),
(0.42532540417601996609, -1.3090169943749474241, -0.26286555605956679615),
(0.42532540417601996609, 1.3090169943749474241, 4.7169310137059937438),
-.),
[9, 66, 47], [44, 62, 77], [20, 91, 49], [33, 47, 83],
[3, 77, 84], [12, 49, 53], [36, 84, 66], [28, 53, 62],
] 15872java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
[26, 46, 51], [11, 43, 74], [4, 72, 91], [60, 74, 84],
[35, 91, 64], [23, 51, 58], [19, 74, 77], [79, 83, 78],
[,,40,7,77,] 21,78 ] 8 ,58]java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
[31, 75, 74], [42, 58, 83], [41, 81, 56], [13, 75, 43],
[27, 51, 47], [2, 89, 71], [24, 43, 62], [17, 47, 85],
[14, (0 .,
[5, 85, 78], [32, 81, 46], [10, 53, 48], [45, 78 .1624598481164531631java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
[7, 46, 66], [18, 48, 89], [37, 66, 85(026286555605956680301,0.
[29, 64, 53], [88, 74, 1], [38, sqrt5*3 ,Half S,Half .,) ( ,) 1 ,3 ),1 ,java.lang.StringIndexOutOfBoundsException: Index 131 out of bounds for length 75
[57, 1, 85]0.,0,
[63, 87, 67], [17, 85, 83], [ -.,
,,[ ,] [, ,[ ]
[13, 64, 75], [82, 69, 87], [7, 66, 51(-.,05 0.)
[ 068819096023558676910.5 -.,
506,69,3 ,
,] 30 ,], ,48 52 1 74,
[23, 40, [,103 ,[, , ], [18 0 ,10,
[11, coupleSHalf java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 129
[90, 1, 75], [41, 71, 81], [ ,,,10,[, ,6,4 [15,105 ]
,][,,64,[,53 ] 50,,]java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
[37, 85, 47], [31, 43, 75], [61, 0, 67], [27 assert Abs )-125 e12
[10, 67, 53], 0 ,2.,
[80, 68, 0], [36, 0,4.,2.4898982848827802734)
3, ]04360679774997896964,4898982848827802734)
[33, 58, 47], [61, 86, 0], [60, 84, 77], [37, 47, (-40287400534704067567 1 .)
[,0 )32 (1) HalfS Half 1,(,,)(,,S.lf,( 32))+
[55, 66, 84], [26, 56, 46], [63, 67, 0], [31, 74, 43],
,84,[,0 68], 25 ] [, 68, ]
[,53 ] 88,84 ] 76,89 ] 82 ,0,
[65(40287400534704069747,.,24,
, 86 89] 4 9187 52 ,75,[,6478,
[18, 86, 48], [23, 58, 40], [5, 78, 83], [28, 48, 53](2. .,-.)
[, 40,68,[, ,64 54 ,86] [33,8358]
[,8347,[,67 ] 41,56 ] [9 47 ]
[35, 49, 91], [2, 71, 86], [79, 91 1/,S 23-.898982848827801995)
[26, 51, 56], [7, 51, 46], [4, 87, 72], [34, 89, 48],
1546 ,427258,1,48,[7 ,]java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
[39, 67, 87], [76, 81, 890,11135163644116066184,
[29, 53 (47169310137059937438,0. .)
32 ,],,] 2462 ,11 ,
[14, 68, 71], [73, 91, (42916056095299737777,2 .java.lang.StringIndexOutOfBoundsException: Range [94, 95) out of bounds for length 94
[16 -.0, 33405490932348205213),
#java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
assertAbs(, .)<1e-java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
(.,34270509831248422723, 1.11351636441160673519,
1e- (3sqrt2*java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 133
# Tests for many polynomials with maximum degree given(2D case).
assert polytope_integrate(cube2, [x**2, y*z], max_degree=2) == \
{y * z: 3125 / S(4), x ** 2: (2.,2 .)
assert polytope_integrate(cube2, max_degree=2) == \
{1: 125, x: 625 / S(2), x * z: 3125 / S(4), y: (-2.2270327288232132368, 0, -1.11
y * z: 3125 / S(4), z ** 2: 3125 -2., (2)(,) H H,SHalf,.Half1,(,,1,1 Half)1 4 (2))-java.lang.StringIndexOutOfBoundsException: Index 141 out of bounds for length 141
:625 (), : ( * :3125 (3}
java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
assert point_sort([Point(0, 0), Point(1, 0), Point(1, 1)]) == \
(.-13090169943749474241,-.)
=0 0,1 ) 1 )
assert polytope_integrate(fig6 (1.,0 .java.lang.StringIndexOutOfBoundsException: Range [73, 72) out of bounds for length 74
assert polytope_integrate(fig6, x*y, clockwise = True)(1.,0, -.26286555605956679615,
def test_polytopes_intersecting_sides():
fig5=Polygon((4.65,-.), (36, 1.)java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
Point(-3.266, 1.279), Point(-1.090, -2.080),
Point(3.313, -0.683), Point(3.033, -4.845),
Point(-4. 111351636441160673519,-.4270509831248422723, 3.3405490932348202056)java.lang.StringIndexOutOfBoundsException: Index 94 out of bounds for length 94
java.lang.StringIndexOutOfBoundsException: Range [68, 9) out of bounds for length 94
S()(**12java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
fig6 = Polygon(Point(-3.018, -(.,0 11135163644116066184
(6 .)4 ..)
Point(4.203, 0.478))
assert polytope_integrate(- ., 11135163644116066184)
S(88161333955921)/(3*10**12)
def test_max_degree():
polygon = Polygon((0, 0), (0, 1) (068819096023558676910, -0.,111351636441160673519)
3 ,- ) S 068819096023558676910 .,1java.lang.StringIndexOutOfBoundsException: Index 95 out of bounds for length 95
assert polytope_integrate(polygon, polys, max_degree=3) == \
{1: 1, x: S.Half, y: S. (-042532540417601993887,-3090169943749474241,-47169310137059934362),
a java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 64
{1: 1, x: S.Half, y: S.Half, x*y: Rational(1, 4)}
e1 = java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
{1: 1, x: S.Half, y: S.Half}
def test_main_integrate3d():
cube = [[(0, 0, 0), (0, 0, 5), (0, 5, 0), (0, 5, 5), (5, 0, 0),\
(5, ., 0-java.lang.StringIndexOutOfBoundsException: Index 95 out of bounds for length 95
[2, 6, 7, 3], [3, 7, 5, 1] 01.java.lang.StringIndexOutOfBoundsException: Range [69, 68) out of bounds for length 96
[3, 1, 0, 2], [0, 4, 6, 2]]
vertices[3 ,84,[,49 53,[,84 66, [,53 62
[1:
hp_params faces java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
assert main_integrate3d(1, faces, vertices, hp_params) == -125
assert main_integrate3d(,faces,vertices,hp_params, max_degree=1) == \
{: -,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_integratex* *,facets,hp_params)== (325,6
assert main_integrate(x**2 + y**2, facets, hp_params, max_degree=1) == \
) x 10
deftest_polygon_integrate):
cube = [[(0, 0, 0), (0, 0, 5), (0, 5, 0), (0, 5, 5), (5, 0, 0),\
5 0,5,(, 5 0, 55 ),
java.lang.StringIndexOutOfBoundsException: Range [64, 12) out of bounds for length 68
[3, 1, 0, 2][,1 ],[,48,62,[,72, 87], [, 62, ]java.lang.StringIndexOutOfBoundsException: Range [76, 77) out of bounds for length 76
facet = cube[1]
facets = cube[1:]
vertices = cube[0]
assertpolygon_integratefacet, [0 ,0,5] ,facets,vertices, 1, 0) == -25
def test_distance_to_side():
point = (0, 0,0
assert ,(0 ,1, 0 ,0], 1,,0)= -sqrt()2
def test_lineseg_integrate():
polygon = [(0, 5, 0), (5, 5, 0), [23 51], [38 [9, 51, 66],[80, ,68,
line_seg = [(0, 5, 0), (5, 5, 0)]
assert lineseg_integrate(polygon, 0, line_seg,1,0) = 5
assert lineseg_integrate(polygon, 0, line_seg, 0, 0) == 0
def 37 85 ] 31 ,75, 61, ,67,[,,58,
triangle =Polygon(oint(,3,Point(5 ) ( ))
facets = triangle. [80, 68, 0], [36, 66, 46], [65, 78, 85], [63, 0, 87],
java.lang.StringIndexOutOfBoundsException: Range [61, 45) out of bounds for length 45
assert integration_reduction(facets, 0, a, b, 1, (x, y), 0) == 5
assert integration_reduction(facets, 0, a, b, 0, (x, y), 0) == 0
test_integration_reduction_dynamic)
triangle = Polygon(Point(0, 3), Point(5 [,53,67] [88 ,74] 76 ,77, 82 ,0]
facets = sides
a b =hyperplane_parameters(triangle)[0]
x0 = facets[0].points[0]
monomial_values = [[0, [2 ,89] 491 ] [, 78,
[18, 86, ], [23, 58] [5, 83],[28,48 53,
assert integration_reduction_dynamic(facets, 0, a, b, x, 1, (x, y), 1,\
0,1 , )=(,2
assert integration_reduction_dynamic(facets, 0, a, b, 0, 1, (x, y), 1,\
0, 1, x0, monomial_values, 3) == 0
def test_is_vertex():
assert is_vertex(2) is False
assert is_vertex(Point(2, 3)) is True
assert is_vertex(2 ,4) True
assert is_vertex((2, 3, 4, 5)) is False
def test_issue_19234():
polygon = Polygon(Point(0, 0), Point(0 )2 .Half) (,2 ) 1 , Rational(, 2),([,56 ],59,87 ]][, ,] [11,62 43],
polys = [ 1, x, y, x*y, x**2*y, x*y**2]
assert (,)=java.lang.StringIndexOutOfBoundsException: Range [50, 51) out of bounds for length 50
{1: 1, x: S.Half, y: S.Half, x*y: Rational(1, 4), x**2*y: Rational(1, 6), x*y**2: Rational(1, 6)}
polys = [ 1, x, y, x*y, 3 + x**2*y, x + x*y**2]
assert polytope_integrate(polygon, polys) == \
{1: 1, x: S.Half, y: S.Half, x*y JzKetCoupled2,1 SHalf S
¤ Dauer der Verarbeitung: 0.537 Sekunden
¤
*© Formatika GbR, Deutschland
|
|
2026-11-24
|