21 January 2020 08:58:02 AM
SIMPLEX_GM_RULE_TEST
C version
Test the SIMPLEX_GM_RULE library.
TEST01
SIMPLEX_UNIT_TO_GENERAL
maps points in the unit simplex to a general simplex.
Here we consider a simplex in 2D, a triangle.
The vertices of the general triangle are:
1 1
3 1
2 5
( XSI ETA ) ( X Y )
0 0 1 1
1 0 3 1
0 1 2 5
0.867886 0.0254803 2.76125 1.10192
0.138259 0.210636 1.48715 1.84254
0.202708 0.329918 1.73533 2.31967
0.112803 0.689309 1.91491 3.75723
0.642508 0.198073 2.48309 1.79229
0.844955 0.014506 2.70442 1.05802
0.346508 0.63118 2.3242 3.52472
0.0242126 0.292589 1.34101 2.17036
0.372621 0.0253558 1.7706 1.10142
0.408253 0.0761431 1.89265 1.30457
TEST02
SIMPLEX_UNIT_TO_GENERAL
maps points in the unit simplex to a general simplex.
Here we consider a simplex in 3D, a tetrahedron.
The vertices of the general tetrahedron are:
1 1 1
3 1 1
1 4 1
1 1 5
( XSI ETA MU ) ( X Y Z )
0 0 0 1 1 1
1 0 0 3 1 1
0 1 0 1 4 1
0 0 1 1 1 5
0.653014 0.0191719 0.0802331 2.30603 1.05752 1.32093
0.122743 0.379417 0.189469 1.24549 2.13825 1.75787
0.436322 0.0635846 0.388548 1.87264 1.19075 2.55419
0.118269 0.0364603 0.029345 1.23654 1.10938 1.11738
0.0138444 0.134129 0.301972 1.02769 1.40239 2.20789
0.0207729 0.0237097 0.286511 1.04155 1.07113 2.14604
0.288996 0.0196653 0.466915 1.57799 1.059 2.86766
0.0792463 0.536617 0.149631 1.15849 2.60985 1.59852
0.0966452 0.51108 0.0596006 1.19329 2.53324 1.2384
0.366347 0.0599075 0.203121 1.73269 1.17972 1.81248
TEST03
GM_RULE_SIZE returns N, the number of points
associated with a Grundmann-Moeller quadrature rule
for the unit simplex of dimension M
with rule index RULE
and degree of exactness DEGREE = 2*RULE+1.
M RULE DEGREE N
2 0 1 1
2 1 3 4
2 2 5 10
2 3 7 20
2 4 9 35
2 5 11 56
3 0 1 1
3 1 3 5
3 2 5 15
3 3 7 35
3 4 9 70
3 5 11 126
5 0 1 1
5 1 3 7
5 2 5 28
5 3 7 84
5 4 9 210
5 5 11 462
10 0 1 1
10 1 3 12
10 2 5 78
10 3 7 364
10 4 9 1365
10 5 11 4368
TEST04
GM_UNIT_RULE_SET determines the weights and abscissas
of a Grundmann-Moeller quadrature rule for
the M dimensional unit simplex,
using a rule of index RULE,
which will have degree of exactness 2*RULE+1.
Here we use M = 3
RULE = 2
DEGREE = 5
POINT W X Y Z
1 0.0507937 0.125 0.125 0.125
2 0.0507937 0.375 0.125 0.125
3 0.0507937 0.625 0.125 0.125
4 0.0507937 0.125 0.375 0.125
5 0.0507937 0.375 0.375 0.125
6 0.0507937 0.125 0.625 0.125
7 0.0507937 0.125 0.125 0.375
8 0.0507937 0.375 0.125 0.375
9 0.0507937 0.125 0.375 0.375
10 0.0507937 0.125 0.125 0.625
11 -0.0964286 0.166667 0.166667 0.166667
12 -0.0964286 0.5 0.166667 0.166667
13 -0.0964286 0.166667 0.5 0.166667
14 -0.0964286 0.166667 0.166667 0.5
15 0.0444444 0.25 0.25 0.25
TEST05
GM_UNIT_RULE_SET determines the weights and abscissas
of a Grundmann-Moeller quadrature rule for
the M dimensional unit simplex,
using a rule of index RULE,
which will have degree of exactness 2*RULE+1.
In this test, we compute various rules, and simply
report the number of points, and the sum of weights.
M RULE N WEIGHT SUM
2 0 1 0.5
2 1 4 0.4999999999999999
2 2 10 0.4999999999999999
2 3 20 0.5000000000000006
2 4 35 0.4999999999999999
2 5 56 0.5000000000000028
3 0 1 0.1666666666666667
3 1 5 0.1666666666666667
3 2 15 0.1666666666666667
3 3 35 0.166666666666667
3 4 70 0.1666666666666664
3 5 126 0.1666666666666647
5 0 1 0.008333333333333333
5 1 7 0.008333333333333331
5 2 28 0.008333333333333331
5 3 84 0.008333333333333283
5 4 210 0.008333333333333585
5 5 462 0.008333333333332863
10 0 1 2.755731922398589e-07
10 1 12 2.755731922398589e-07
10 2 78 2.755731922398579e-07
10 3 364 2.755731922398308e-07
10 4 1365 2.755731922397991e-07
10 5 4368 2.755731922406156e-07
TEST06
GM_UNIT_RULE_SET determines the weights and abscissas
of a Grundmann-Moeller quadrature rule for
the M dimensional unit simplex,
using a rule of index RULE,
which will have degree of exactness 2*RULE+1.
In this test, we write a rule to a file.
Here we use M = 3
RULE = 2
DEGREE = 5
Wrote rule 2 to "gm2_3d_w.txt" and "gm2_3d_x.txt".
TEST07
GM_UNIT_RULE_SET determines the weights and abscissas
of a Grundmann-Moeller quadrature rule for
the M dimensional unit simplex,
using a rule of index RULE,
which will have degree of exactness 2*RULE+1.
In this test, look at all the monomials up to
some maximum degree, choose a few low order rules
and determine the quadrature error for each.
Here we use M = 5
Rule Order Quad_Error
F(X) = X1^0 * X2^0 * X3^0 * X4^0 * X5^0
0 1 0
1 7 2.22045e-16
2 28 2.22045e-16
3 84 5.9952e-15
F(X) = X1^1 * X2^0 * X3^0 * X4^0 * X5^0
0 1 1.11022e-16
1 7 3.33067e-16
2 28 4.44089e-16
3 84 6.88338e-15
F(X) = X1^0 * X2^1 * X3^0 * X4^0 * X5^0
0 1 1.11022e-16
1 7 3.33067e-16
2 28 1.11022e-16
3 84 7.54952e-15
F(X) = X1^0 * X2^0 * X3^1 *