-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
integrals/intpoly : Add Mathematica test cases for 3D polytopes #13187
integrals/intpoly : Add Mathematica test cases for 3D polytopes #13187
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks very good, thank you @ArifAhmed1995. Do the answers agree with @ndotsu's poster? I just pointed out some minor things, once those are fixed, this is ready to be merged.
[14, 16, 6, 9, 18], [19, 8, 7, 17, 15]] | ||
# Actual volume is : 0.163118960624632 | ||
assert polytope_integrate(great_stellated_dodecahedron, 1) -\ | ||
0.163118960624632 < 1e-15 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to use the abs(x-y) < eps
idiom, not x-y < eps
. The latter would be satisfied, e.g., for x=1, y=5.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
15 digits are printed, but I would still lower eps
to something like 1e-12 or so, just in case.
[14, 68, 71], [73, 91, 72], [13, 43, 64], [70, 71, 89], | ||
[16, 72, 69], [44, 89, 62], [30, 69, 68], [45, 64, 91]] | ||
# Actual volume is : 51.405764746872634 | ||
assert polytope_integrate(echidnahedron, 1) - 51.4057647468726 < 1e-15 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use abs(x-y)<eps
. Also, only 13 decimal digits are printed, so you must use something like 1e-12 or so. You can't do 1e-15, because that might fail sometimes.
Yes, abs(..) < 1e-12 should suffice.
…On 8/25/17 10:17 AM, Ondřej Čertík wrote:
***@***.**** requested changes on this pull request.
This looks very good, thank you @ArifAhmed1995
<https://github.com/arifahmed1995>. Do the answers agree with @ndotsu
<https://github.com/ndotsu>'s poster? I just pointed out some minor
things, once those are fixed, this is ready to be merged.
------------------------------------------------------------------------
In sympy/integrals/tests/test_intpoly.py
<#13187 (comment)>:
> + (-0.42532540417601993887, 0.30901699437494742410, -0.10040570794311363956),
+ (-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 polytope_integrate(great_stellated_dodecahedron, 1) -\
+ 0.163118960624632 < 1e-15
You need to use the |abs(x-y) < eps| idiom, not |x-y < eps|. The
latter would be satisfied, e.g., for x=1, y=5.
------------------------------------------------------------------------
In sympy/integrals/tests/test_intpoly.py
<#13187 (comment)>:
> + [12, 53, 67], [88, 84, 74], [76, 89, 77], [82, 87, 0],
+ [65, 75, 78], [60, 77, 74], [80, 0, 86], [79, 78, 91],
+ [2, 86, 89], [4, 91, 87], [52, 74, 75], [21, 64, 78],
+ [18, 86, 48], [23, 58, 40], [5, 78, 83], [28, 48, 53],
+ [6, 40, 68], [25, 53, 64], [54, 68, 86], [33, 83, 58],
+ [17, 83, 47], [12, 67, 49], [41, 56, 71], [9, 47, 51],
+ [35, 49, 91], [2, 71, 86], [79, 91, 83], [38, 86, 67],
+ [26, 51, 56], [7, 51, 46], [4, 87, 72], [34, 89, 48],
+ [15, 46, 81], [42, 72, 58], [10, 48, 67], [27, 58, 51],
+ [39, 67, 87], [76, 81, 89], [3, 81, 77], [8, 69, 40],
+ [29, 53, 49], [19, 77, 62], [22, 40, 56], [20, 49, 87],
+ [32, 56, 81], [59, 87, 69], [24, 62, 53], [11, 62, 43],
+ [14, 68, 71], [73, 91, 72], [13, 43, 64], [70, 71, 89],
+ [16, 72, 69], [44, 89, 62], [30, 69, 68], [45, 64, 91]]
+ # Actual volume is : 51.405764746872634
+ assert polytope_integrate(echidnahedron, 1) - 51.4057647468726 < 1e-15
Use |abs(x-y)<eps|. Also, only 13 decimal digits are printed, so you
must use something like 1e-12 or so. You can't do 1e-15, because that
might fail sometimes.
------------------------------------------------------------------------
In sympy/integrals/tests/test_intpoly.py
<#13187 (comment)>:
> + (-0.42532540417601993887, 0.30901699437494742410, -0.10040570794311363956),
+ (-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 polytope_integrate(great_stellated_dodecahedron, 1) -\
+ 0.163118960624632 < 1e-15
15 digits are printed, but I would still lower |eps| to something like
1e-12 or so, just in case.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#13187 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AbwYKhdorOTsb3RMJZAXQev6QZLsGXhZks5sblH8gaJpZM4PBRLn>.
--
N. Sukumar, Professor Work Phone: (530)754-6415
Department of Civil & Environmental Engg. FAX : (530)752-7872
3159 Ghausi Hall, One Shields Avenue E-mail: nsukumar@ucdavis.edu
University of California *GO BLAZERS*
Davis, CA 95616 WEB: http://dilbert.engr.ucdavis.edu/~suku
|
2fd0d7f
to
a8eb89b
Compare
@certik
I have added the tests for octahedron, Great Stellated Dodecahedron and Echidnahedron.