19 April 2008 11:21:29 AM STROUD_PRB C++ version Test the routines in the STROUD library. TEST01 For integrals in a ball in ND: BALL_F1_ND approximates the integral; BALL_F3_ND approximates the integral. Spatial dimension N = 2 Ball center: 1 2 Ball radius = 2 Ball volume = 12.5664 Rule: F1 F3 F(X) 1 12.5664 12.5664 X 12.5664 12.5664 X^2 25.1327 25.1327 X^3 50.2655 50.2655 X^4 113.097 113.097 X^5 263.894 263.894 X^6 636.869 628.319 R 30.9892 31.1087 SIN(X) 6.10243 6.11161 EXP(X) 54.3168 54.2817 1/(1+R) 3.99685 3.92547 SQRT(R) 19.2772 19.3785 Spatial dimension N = 3 Ball center: 1 2 3 Ball radius = 2 Ball volume = 33.5103 Rule: F1 F3 F(X) 1 33.5103 33.5103 X 33.5103 33.5103 X^2 60.3186 60.3186 X^3 113.935 113.935 X^4 240.317 240.317 X^5 531.378 531.378 X^6 1224.7 1203.77 R 132.549 132.562 SIN(X) 18.4181 18.4408 EXP(X) 133.124 133.039 1/(1+R) 6.99449 6.99027 SQRT(R) 66.2201 66.2279 TEST02 For the integral of a monomial in a ball in ND: BALL_MONOMIAL_ND approximates the integral. BALL_F1_ND, which can handle general integrands, will be used for comparison. Spatial dimension N = 3 Ball radius = 2 Ball volume = 33.5103 Rule: MONOMIAL F1 F(X) 1 33.5103 33.5103 xyz 0 0 x^2 z^2 15.319 15.319 x^4y^2z^2 7.4274 7.6101 TEST03 For integrals in the unit ball in 3D: BALL_UNIT_07_3D uses a formula of degree 7; BALL_UNIT_14_3D uses a formula of degree 14; BALL_UNIT_15_3D uses a formula of degree 15. Unit ball volume = 4.18879 Rule: #7 #14 #15 F(X) 1 4.18879 4.18879 4.18879 X 5.44979e-17 1.70306e-17 -1.64062e-16 Y -3.08822e-17 4.5415e-19 -2.3362e-17 Z 0 2.27075e-18 -9.08299e-19 X*X 0.837758 0.837758 0.837758 X*Y 0.296192 -1.36245e-18 -5.10466e-17 X*Z 0 -3.12228e-18 1.58952e-18 Y*Y 0.837758 0.837758 0.837758 Y*Z 0 1.93014e-18 8.66964e-18 Z*Z 0.837758 0.837758 0.837758 X^3 6.0856e-17 9.24975e-18 -1.09564e-16 X*Y*Z 4.5415e-19 1.62713e-17 -9.28939e-20 Z*Z*Z 0 0 1.63494e-17 X^4 0.359039 0.359039 0.359039 X^2 Z^2 0.11968 0.11968 0.11968 Z^4 0.359039 0.359039 0.359039 X^5 -1.04454e-16 -3.94005e-18 -8.15828e-17 X^6 0.199466 0.199466 0.199466 R 3.15453 3.14291 3.14291 SIN(X) -2.36158e-16 -6.81224e-18 -1.59066e-16 EXP(X) 4.62291 4.62291 4.62291 1/(1+R) 3.34715 3.34793 3.34793 SQRT(R) 3.60705 3.59269 3.59269 TEST04 For integrals inside the unit ball in ND: BALL_UNIT_F1_ND approximates the integral; BALL_UNIT_F3_ND approximates the integral. Spatial dimension N = 2 Unit ball volume = 3.14159 Rule: F1 F3 F(X) 1 3.14159 3.14159 X 0 0 X^2 0.785398 0.785398 X^3 0 0 X^4 0.392699 0.392699 X^5 0 0 X^6 0.229749 0.19635 R 2.07465 1.92382 SIN(X) 0 0 EXP(X) 3.55098 3.55093 1/(1+R) 1.94254 2.08251 SQRT(R) 2.49488 2.12906 Spatial dimension N = 3 Unit ball volume = 4.18879 Rule: F1 F3 F(X) 1 4.18879 4.18879 X 0 0 X^2 0.837758 0.837758 X^3 0 0 X^4 0.359039 0.359039 X^5 0 0 X^6 0.194741 0.153874 R 3.12359 2.97375 SIN(X) 0 0 EXP(X) 4.6229 4.62284 1/(1+R) 2.44033 2.57714 SQRT(R) 3.57254 3.23471 TEST045 In 3 dimensions: BALL_UNIT_VOLUME_3D gets the volume of the unit ball. BALL_UNIT_VOLUME_ND will be called for comparison. N Volume Method 3 4.18879 BALL_UNIT_VOLUME_3D 3 4.18879 BALL_UNIT_VOLUME_ND TEST05 BALL_UNIT_VOLUME_ND computes the volume of the unit ball in ND. N Volume 2 3.14159 3 4.18879 4 4.9348 5 5.26379 6 5.16771 7 4.72477 8 4.05871 9 3.29851 10 2.55016 TEST052 In 3 dimensions: BALL_VOLUME_3D computes the volume of a unit ball. BALL_VOLUME_ND will be called for comparison. N R Volume Method 3 1 4.18879 BALL_VOLUME_3D 3 1 4.18879 BALL_VOLUME_ND 3 2 33.5103 BALL_VOLUME_3D 3 2 33.5103 BALL_VOLUME_ND 3 4 268.083 BALL_VOLUME_3D 3 4 268.083 BALL_VOLUME_ND TEST054 BALL_UNIT_VOLUME_ND computes the volume of the unit ball in N dimensions. N R Volume 2 0.5 0.785398 2 1 3.14159 2 2 12.5664 3 0.5 0.523599 3 1 4.18879 3 2 33.5103 4 0.5 0.308425 4 1 4.9348 4 2 78.9568 5 0.5 0.164493 5 1 5.26379 5 2 168.441 6 0.5 0.0807455 6 1 5.16771 6 2 330.734 7 0.5 0.0369122 7 1 4.72477 7 2 604.77 8 0.5 0.0158543 8 1 4.05871 8 2 1039.03 9 0.5 0.0064424 9 1 3.29851 9 2 1688.84 10 0.5 0.00249039 10 1 2.55016 10 2 2611.37 TEST07 CIRCLE_ANNULUS estimates integrals in a circular annulus. F CENTER Radius1 Radius2 NR Result Area 0 0 0 1 3.14159 1 0 0 0 1 1 3.14159 1 0 0 0 1 2 3.14159 1 0 0 0 1 3 3.14159 1 0 0 0 1 4 3.14159 X 0 0 0 1 1 0 X 0 0 0 1 2-9.2211e-17 X 0 0 0 1 3-9.26465e-17 X 0 0 0 1 4-2.12542e-16 X^2 0 0 0 1 1 0.785398 X^2 0 0 0 1 2 0.785398 X^2 0 0 0 1 3 0.785398 X^2 0 0 0 1 4 0.785398 X^3 0 0 0 1 1 0 X^3 0 0 0 1 2-5.99477e-17 X^3 0 0 0 1 3-3.54237e-17 X^3 0 0 0 1 4-1.02184e-16 X^4 0 0 0 1 1 0.392699 X^4 0 0 0 1 2 0.392699 X^4 0 0 0 1 3 0.392699 X^4 0 0 0 1 4 0.392699 X^5 0 0 0 1 1 0 X^5 0 0 0 1 25.44979e-18 X^5 0 0 0 1 31.32839e-17 X^5 0 0 0 1 4-1.90743e-17 X^6 0 0 0 1 1 0.19635 X^6 0 0 0 1 2 0.245437 X^6 0 0 0 1 3 0.245437 X^6 0 0 0 1 4 0.245437 R 0 0 0 1 1 2.22144 R 0 0 0 1 2 2.11708 R 0 0 0 1 3 2.10229 R 0 0 0 1 4 2.09804 SIN(X) 0 0 0 1 1 0 SIN(X) 0 0 0 1 2-1.35809e-16 SIN(X) 0 0 0 1 35.44979e-18 SIN(X) 0 0 0 1 4-9.26465e-17 EXP(X) 0 0 0 1 1 3.55093 EXP(X) 0 0 0 1 2 3.551 EXP(X) 0 0 0 1 3 3.551 EXP(X) 0 0 0 1 4 3.551 1/(1+R) 0 0 0 1 1 1.8403 1/(1+R) 0 0 0 1 2 1.90807 1/(1+R) 0 0 0 1 3 1.92062 1/(1+R) 0 0 0 1 4 1.92451 SQRT(R) 0 0 0 1 1 2.64175 SQRT(R) 0 0 0 1 2 2.5453 SQRT(R) 0 0 0 1 3 2.5267 SQRT(R) 0 0 0 1 4 2.52036 Area 0 0 1 2 9.42478 1 0 0 1 2 1 9.42478 1 0 0 1 2 2 9.42478 1 0 0 1 2 3 9.42478 1 0 0 1 2 4 9.42478 X 0 0 1 2 1 0 X 0 0 1 2 2-9.90816e-16 X 0 0 1 2 3-2.6159e-16 X 0 0 1 2 4-3.92385e-16 X^2 0 0 1 2 1 11.781 X^2 0 0 1 2 2 11.781 X^2 0 0 1 2 3 11.781 X^2 0 0 1 2 4 11.781 X^3 0 0 1 2 1 0 X^3 0 0 1 2 2-1.56954e-15 X^3 0 0 1 2 3-9.48264e-16 X^3 0 0 1 2 4-2.84479e-15 X^4 0 0 1 2 1 29.4524 X^4 0 0 1 2 2 24.74 X^4 0 0 1 2 3 24.74 X^4 0 0 1 2 4 24.74 X^5 0 0 1 2 1 0 X^5 0 0 1 2 2-1.83113e-15 X^5 0 0 1 2 3-3.07368e-15 X^5 0 0 1 2 4-4.38163e-15 X^6 0 0 1 2 1 73.6311 X^6 0 0 1 2 2 62.5864 X^6 0 0 1 2 3 62.5864 X^6 0 0 1 2 4 62.5864 R 0 0 1 2 1 14.9019 R 0 0 1 2 2 14.6694 R 0 0 1 2 3 14.6613 R 0 0 1 2 4 14.6608 SIN(X) 0 0 1 2 15.2318e-16 SIN(X) 0 0 1 2 2-4.67636e-16 SIN(X) 0 0 1 2 3-4.57783e-16 SIN(X) 0 0 1 2 4-8.33819e-16 EXP(X) 0 0 1 2 1 16.6494 EXP(X) 0 0 1 2 2 16.4376 EXP(X) 0 0 1 2 3 16.4375 EXP(X) 0 0 1 2 4 16.4375 1/(1+R) 0 0 1 2 1 3.6514 1/(1+R) 0 0 1 2 2 3.73082 1/(1+R) 0 0 1 2 3 3.73524 1/(1+R) 0 0 1 2 4 3.73555 SQRT(R) 0 0 1 2 1 11.851 SQRT(R) 0 0 1 2 2 11.7108 SQRT(R) 0 0 1 2 3 11.7044 SQRT(R) 0 0 1 2 4 11.704 TEST08 CIRCLE_ANNULUS estimates integrals in a circular annulus. CIRCLE_RT_SET sets up a rule for a circle; CIRCLE_RT_SUM applies the rule. RESULT1 = CIRCLE_ANNULUS result. RESULT2 = Difference of two CIRCLE_RT_SUM results. F CENTER Radius1 Radius2 Result1 Result2 Area 0 0 0 1 3.14159 1 0 0 0 1 3.14159 3.14159 X 0 0 0 1-1.63494e-17-2.7249e-18 X^2 0 0 0 1 0.785398 0.785398 X^3 0 0 0 1-3.81486e-17-4.35984e-17 X^4 0 0 0 1 0.392699 0.392699 X^5 0 0 0 1-5.65416e-17-2.7249e-17 X^6 0 0 0 1 0.245437 0.245437 R 0 0 0 1 2.09637 2.09637 SIN(X) 0 0 0 1-1.82568e-16-7.9022e-17 EXP(X) 0 0 0 1 3.551 3.551 1/(1+R) 0 0 0 1 1.92609 1.92609 SQRT(R) 0 0 0 1 2.51754 2.51754 Area 0 0 1 2 9.42478 1 0 0 1 2 9.42478 9.42478 X 0 0 1 24.25084e-16-1.90743e-17 X^2 0 0 1 2 11.781 11.781 X^3 0 0 1 2-1.47144e-15-1.35155e-15 X^4 0 0 1 2 24.74 24.74 X^5 0 0 1 2-9.94043e-15-3.46062e-15 X^6 0 0 1 2 62.5864 62.5864 R 0 0 1 2 14.6608 14.6746 SIN(X) 0 0 1 22.45241e-16 4.0601e-16 EXP(X) 0 0 1 2 16.4375 16.4375 1/(1+R) 0 0 1 2 3.73557 3.72308 SQRT(R) 0 0 1 2 11.704 11.7238 Area 0 0 1 3 25.1327 1 0 0 1 3 25.1327 25.1327 X 0 0 1 3-2.83389e-15-3.23445e-15 X^2 0 0 1 3 62.8319 62.8319 X^3 0 0 1 3-1.81369e-14-2.97777e-14 X^4 0 0 1 3 285.885 285.885 X^5 0 0 1 3-1.57652e-13-2.35404e-13 X^6 0 0 1 3 1610.07 1610.07 R 0 0 1 3 54.4548 54.5057 SIN(X) 0 0 1 3-7.8477e-16-8.77417e-16 EXP(X) 0 0 1 3 70.9683 70.9683 1/(1+R) 0 0 1 3 8.21087 8.16864 SQRT(R) 0 0 1 3 36.6652 36.727 TEST085 CIRCLE_ANNULUS_AREA_2D computes the area of a circular annulus. CENTER Radius1 Radius2 Area 0 0 0 1 3.14159 1 0 1 2 9.42478 3 4 1 3 25.1327 TEST09 CIRCLE_ANNULUS_SECTOR estimates an integral in a circular annulus sector. CIRCLE_RT_SET sets an integration rule in a circle. CIRCLE_RT_SUM uses an integration rule in a circle. To test CIRCLE_ANNULUS_SECTOR, we estimate an integral over 4 annular sectors that make up the unit circle, and add to get RESULT1. We will also estimate the integral over the unit circle using CIRCLE_RT_SET and CIRCLE_RT_SUM to get RESULT2. We will then compare RESULT1 and RESULT2. CIRCLE_ANNULUS_SECTOR computations will use NR = 5 CIRCLE_RT_SET/CIRCLE_RT_SUM will use rule 9 RESULT1 is the sum of Annulus Sector calculations. RESULT2 is for CIRCLE_RT_SET/CIRCLE_RT_SUM. F Result1 Result2 1 3.14159 3.14159 X -0.000727989 -2.7249e-18 X^2 0.784623 0.785398 X^3 -0.000661095 -4.35984e-17 X^4 0.392181 0.392699 X^5 -0.00039012 -2.7249e-17 X^6 0.245151 0.245437 R 2.09452 2.09637 SIN(X) -0.000621017 -7.9022e-17 EXP(X) 3.54975 3.551 1/(1+R) 1.9279 1.92609 SQRT(R) 2.51356 2.51754 TEST10 CIRCLE_CUM approximates an integral over a circle. We use radius R = 3 and center: CENTER = ( 0, 0). Order: 2 4 8 16 F(X) 1 28.2743 28.2743 28.2743 28.2743 X 0 -3.89543e-15 -6.27816e-15 -7.06293e-15 X^2 254.469 127.235 127.235 127.235 X^3 0 -1.18305e-45 -3.7669e-14 -6.90598e-14 X^4 2290.22 1145.11 858.833 858.833 X^5 0 -3.59293e-76 -3.01352e-13 -6.02704e-13 X^6 20612 10306 6441.25 6441.25 R 84.823 84.823 84.823 84.823 SIN(X) 0 -2.52208e-15 3.92385e-16 4.90482e-16 EXP(X) 284.656 156.465 138.047 138.001 1/(1+R) 7.06858 7.06858 7.06858 7.06858 SQRT(R) 48.9726 48.9726 48.9726 48.9726 TEST11 LENS_HALF_AREA_2D computes the area of a circular half lens, defined by joining the endpoints of a circular arc. CIRCLE_SECTOR_AREA_2D computes the area of a circular sector, defined by joining the endpoints of a circular arc to the center. CIRCLE_TRIANGLE_AREA_2D computes the signed area of a triangle, defined by joining the endpoints of a circular arc and the center. R Theta1 Theta2 Sector Triangle Half Lens 1 0 0 0 0 0 1 0 0.523599 0.261799 0.25 0.0117994 1 0 1.0472 0.523599 0.433013 0.0905861 1 0 1.5708 0.785398 0.5 0.285398 1 0 2.0944 1.0472 0.433013 0.614185 1 0 2.61799 1.309 0.25 1.059 1 0 3.14159 1.5708 6.12323e-17 1.5708 1 0 3.66519 1.8326 -0.25 2.0826 1 0 4.18879 2.0944 -0.433013 2.52741 1 0 4.71239 2.35619 -0.5 2.85619 1 0 5.23599 2.61799 -0.433013 3.05101 1 0 5.75959 2.87979 -0.25 3.12979 1 0 6.28319 3.14159 -1.22465e-16 3.14159 TEST12 For the area of a circular half lens, LENS_HALF_AREA_2D uses two angles; LENS_HALF_H_AREA_2D works from the height; LENS_HALF_W_AREA_2D works from the width. The circle has radius R = 50 THETA1 THETA2 H W Area(THETA) Area(H) Area(W) 0 0 0 0 0 0 0 0 0.523599 1.70371 25.8819 29.4985 29.4985 29.4985 0 1.0472 6.69873 50 226.465 226.465 226.465 0 1.5708 14.6447 70.7107 713.495 713.495 713.495 0 2.0944 25 86.6025 1535.46 1535.46 1535.46 0 2.61799 37.059 96.5926 2647.49 2647.49 2647.49 0 3.14159 50 100 3926.99 3926.99 3926.99 0 3.66519 62.941 96.5926 5206.49 5206.49 2647.49 0 4.18879 75 86.6025 6318.52 6318.52 1535.46 0 4.71239 85.3553 70.7107 7140.49 7140.49 713.495 0 5.23599 93.3013 50 7627.52 7627.52 226.465 0 5.75959 98.2963 25.8819 7824.48 7824.48 29.4985 0 6.28319 100 1.22465e-14 7853.98 7853.98 0 TEST13 CIRCLE_SECTOR_AREA_2D computes the area of a circular sector. CIRCLE_SECTOR estimates an integral in a circular sector. The user can specify NR, the number of radial values used to approximated the integral. In this test, computations will use values of NR from 1 to 5 CENTER RADIUS THETA1 THETA2 Area 0 0 1 0 6.28319 3.14159 F 1 2 3 4 5 1 3.14159 3.14159 3.14159 3.14159 3.14159 X -1.74393e-16 -1.74393e-16 -2.28891e-16 -7.08473e-17 -7.08473e-17 X^2 0.785398 0.785398 0.785398 0.785398 0.785398 X^3 -1.30795e-16 -1.74393e-16 -1.52594e-16 -1.03546e-16 -4.63233e-17 X^4 0.19635 0.392699 0.392699 0.392699 0.392699 X^5 -5.44979e-17 -1.74393e-16 -1.03546e-16 -7.62971e-17 -1.90743e-17 X^6 0.0490874 0.245437 0.245437 0.245437 0.245437 R 2.22144 2.11708 2.10229 2.09804 2.09637 SIN(X) -1.74393e-16 -1.52594e-16 -2.17992e-16 -5.44979e-17 -8.71967e-17 EXP(X) 3.54254 3.551 3.551 3.551 3.551 1/(1+R) 1.8403 1.90807 1.92062 1.92451 1.92609 SQRT(R) 2.64175 2.5453 2.5267 2.52036 2.51754 CENTER RADIUS THETA1 THETA2 Area 0 0 2 0 3.14159 6.28319 F 1 2 3 4 5 1 6.28319 6.28319 6.28319 6.28319 6.28319 X 0 5.2318e-16 4.35984e-16 4.79582e-16 5.3408e-16 X^2 6.28319 6.28319 6.28319 6.28319 6.28319 X^3 0 3.48787e-16 1.56954e-15 2.6159e-16 1.30795e-16 X^4 9.42478 12.5664 12.5664 12.5664 12.5664 X^5 0 -2.79029e-15 6.97574e-16 4.18544e-15 5.2318e-16 X^6 15.708 31.4159 31.4159 31.4159 31.4159 R 8.88577 8.46832 8.40916 8.39217 8.3855 SIN(X) 0 3.48787e-16 3.26988e-16 3.92385e-16 -1.25345e-16 EXP(X) 9.83997 9.9942 9.99427 9.99427 9.99427 1/(1+R) 2.60258 2.76839 2.80611 2.81904 2.82458 SQRT(R) 7.47201 7.1992 7.1466 7.12865 7.12068 CENTER RADIUS THETA1 THETA2 Area 0 0 4 0 1.5708 12.5664 F 1 2 3 4 5 1 12.5664 12.5664 12.5664 12.5664 12.5664 X 22.7735 21.5991 21.429 21.3791 21.359 X^2 50.2655 50.2655 50.2655 50.2655 50.2655 X^3 120.647 136.113 136.469 136.516 136.527 X^4 301.593 402.124 402.124 402.124 402.124 X^5 772.373 1251.56 1248.48 1248.33 1248.31 X^6 2010.62 4021.24 4021.24 4021.24 4021.24 R 35.5431 33.8733 33.6366 33.5687 33.542 SIN(X) 8.14853 7.09324 6.8295 6.77009 6.748 EXP(X) 103.916 119.054 119.019 118.976 118.957 1/(1+R) 3.28238 3.59355 3.68088 3.71511 3.73122 SQRT(R) 21.134 20.3624 20.2136 20.1629 20.1403 CENTER RADIUS THETA1 THETA2 Area 0 0 8 00.785398 25.1327 F 1 2 3 4 5 1 25.1327 25.1327 25.1327 25.1327 25.1327 X 128.206 122.036 121.156 120.902 120.801 X^2 659.776 658.536 658.307 658.227 658.19 X^3 3423.26 3852.7 3861.18 3861.96 3862.02 X^4 17895.8 23808.2 23798.4 23795 23793.4 X^5 94198.4 152324 151890 151851 151839 X^6 498915 995947 995596 995474 995417 R 142.172 135.493 134.547 134.275 134.168 SIN(X) -20.5913 -0.613778 -1.77204 -2.55066 -2.72853 EXP(X) 4580.19 9276.31 9550.42 9552.77 9552.25 1/(1+R) 3.77547 4.23702 4.39005 4.45814 4.49356 SQRT(R) 59.7761 57.5936 57.1728 57.0292 56.9654 TEST14 CIRCLE_SECTOR estimates integrals in a circular sector. CIRCLE_RT_SET sets an integration rule in a circle. CIRCLE_RT_SUM uses an integration rule in a circle. To test CIRCLE_SECTOR, we estimate an integral over a sector, and over its complement and add the results to get RESULT1. We also estimate the integral over the whole circle using CIRCLE_RT_SET and CIRCLE_RT_SUM to get RESULT2. We will then compare RESULT1 and RESULT2. CIRCLE_SECTOR computations will use NR = 5 CIRCLE_RT_SET/CIRCLE_RT_SUM will use rule 9 'Sector1' and 'Sector2' are the CIRCLE_SECTOR computations for the sector and its complement. 'Sum' is the sum of Sector1 and Sector2. 'Circle' is the computation for CIRCLE_RT_SET + CIRCLE_RT_SUM. CENTER RADIUS THETA1 THETA2 Area1 Area2 Circle 0 0 1 0 6.28319 3.14159 0 3.14159 F Sector1 Sector2 Sum Circle 1 3.14159 0 3.14159 3.14159 X -7.08473e-17 0 -7.08473e-17 -2.7249e-18 X^2 0.785398 0 0.785398 0.785398 X^3 -4.63233e-17 0 -4.63233e-17 -4.35984e-17 X^4 0.392699 0 0.392699 0.392699 X^5 -1.90743e-17 0 -1.90743e-17 -2.7249e-17 X^6 0.245437 0 0.245437 0.245437 R 2.09637 0 2.09637 2.09637 SIN(X) -8.71967e-17 0 -8.71967e-17 -7.9022e-17 EXP(X) 3.551 0 3.551 3.551 1/(1+R) 1.92609 0 1.92609 1.92609 SQRT(R) 2.51754 0 2.51754 2.51754 CENTER RADIUS THETA1 THETA2 Area1 Area2 Circle 0 0 2 0 3.14159 6.28319 6.28319 12.5664 F Sector1 Sector2 Sum Circle 1 6.28319 6.28319 12.5664 12.5664 X 5.3408e-16 -9.48264e-16 -4.14184e-16 -2.17992e-17 X^2 6.28319 6.28319 12.5664 12.5664 X^3 1.30795e-16 -2.92109e-15 -2.79029e-15 -1.39515e-15 X^4 12.5664 12.5664 25.1327 25.1327 X^5 5.2318e-16 -1.08124e-14 -1.02892e-14 -3.48787e-15 X^6 31.4159 31.4159 62.8319 62.8319 R 8.3855 8.3855 16.771 16.771 SIN(X) -1.25345e-16 -8.39268e-16 -9.64614e-16 3.26988e-16 EXP(X) 9.99427 9.99427 19.9885 19.9885 1/(1+R) 2.82458 2.82458 5.64917 5.64917 SQRT(R) 7.12068 7.12068 14.2414 14.2414 CENTER RADIUS THETA1 THETA2 Area1 Area2 Circle 0 0 4 0 1.5708 12.5664 37.6991 50.2655 F Sector1 Sector2 Sum Circle 1 12.5664 37.6991 50.2655 50.2655 X 21.359 -21.403 -0.0439855 -1.74393e-16 X^2 50.2655 150.796 201.062 201.062 X^3 136.527 -136.523 0.0046137 -4.46447e-14 X^4 402.124 1206.37 1608.5 1608.5 X^5 1248.31 -1248.31 -0.00161715 -4.46447e-13 X^6 4021.24 12063.7 16085 16085 R 33.542 100.626 134.168 134.168 SIN(X) 6.748 -6.79277 -0.0447682 -3.48787e-16 EXP(X) 118.957 126.281 245.239 245.282 1/(1+R) 3.73122 11.1936 14.9249 14.9249 SQRT(R) 20.1403 60.421 80.5613 80.5613 CENTER RADIUS THETA1 THETA2 Area1 Area2 Circle 0 0 8 0 0.785398 25.1327 175.929 201.062 F Sector1 Sector2 Sum Circle 1 25.1327 175.929 201.062 201.062 X 120.801 -121.175 -0.373397 -1.39515e-15 X^2 658.19 2555.61 3213.8 3216.99 X^3 3862.02 -3883.71 -21.6832 -1.42863e-12 X^4 23793.4 79014.3 102808 102944 X^5 151839 -152658 -818.194 -5.71452e-11 X^6 995417 3.11753e+06 4.11295e+06 4.11775e+06 R 134.168 939.176 1073.34 1073.34 SIN(X) -2.72853 2.77012 0.041587 -3.13908e-15 EXP(X) 9552.25 10508.4 20060.7 20099.8 1/(1+R) 4.49356 31.4549 35.9485 35.9485 SQRT(R) 56.9654 398.758 455.723 455.723 TEST15 For R, Theta product rules on the unit circle, CIRCLE_RT_SET sets a rule. CIRCLE_RT_SUM uses the rule in an arbitrary circle. We use a radius 1 and center: CENTER = 1 1 Rule: 1 2 3 4 5 Function 1 3.14159 3.14159 3.14159 3.14159 3.14159 X 3.14159 3.14159 3.14159 3.14159 3.14159 X^2 3.14159 3.53429 3.92699 3.92699 3.92699 X^3 3.14159 4.31969 5.49779 5.49779 5.49779 X^4 3.14159 5.59596 8.63938 8.24668 8.37758 X^5 3.14159 7.55946 14.9226 12.9591 13.6136 X^6 3.14159 10.5292 27.4889 21.053 23.1692 R 4.44288 4.588 4.76304 4.72696 4.75069 SIN(X) 2.64356 2.48175 2.33975 2.32661 2.33102 EXP(X) 8.53973 9.08468 9.69918 9.6526 9.66801 1/(1+R) 1.30129 1.30207 1.28605 1.30752 1.2931 SQRT(R) 3.736 3.76998 3.82784 3.79755 3.81787 Rule: 6 7 8 9 Function 1 3.14159 3.14159 3.14159 3.14159 X 3.14159 3.14159 3.14159 3.14159 X^2 3.92699 3.92699 3.92699 3.92699 X^3 5.49779 5.49779 5.49779 5.49779 X^4 8.37758 8.24668 8.24668 8.24668 X^5 13.6136 12.9591 12.9591 12.9591 X^6 23.1692 21.0585 21.0585 21.0585 R 4.75072 4.727 4.72698 4.727 SIN(X) 2.33102 2.3266 2.3266 2.3266 EXP(X) 9.66801 9.65262 9.65262 9.65262 1/(1+R) 1.29307 1.30749 1.3075 1.30749 SQRT(R) 3.81791 3.79755 3.79753 3.79756 TEST16 CIRCLE_XY_SET sets a quadrature rule for the unit circle. CIRCLE_XY_SUM evaluates the quadrature rule in an arbitrary circle. We use a radius 1 and center: CENTER = (1, 1). Rule: 1 2 3 4 5 'Function 1 3.14159 3.14159 3.14159 3.14159 3.14159 X 3.14159 3.14159 3.14159 3.14159 3.14159 X^2 3.14159 3.53429 3.92699 4.71239 3.92699 X^3 3.14159 4.31969 5.49779 7.85398 5.49779 X^4 3.14159 5.59596 8.05033 13.3518 8.63938 X^5 3.14159 7.55946 11.9773 22.7765 14.9226 X^6 3.14159 10.5292 17.9169 38.8772 27.4889 R 4.44288 4.588 4.70509 4.94214 4.76304 SIN(X) 2.64356 2.48175 2.31994 2.00975 2.33975 EXP(X) 8.53973 9.08468 9.62963 10.7651 9.69918 1/(1+R) 1.30129 1.30207 1.32027 1.36035 1.28605 SQRT(R) 3.736 3.76998 3.77952 3.79309 3.82784 Rule: 6 7 8 9 10 'Function 1 3.14159 3.14159 3.14159 3.14159 3.14159 X 3.14159 3.14159 3.14159 3.14159 3.14159 X^2 3.92699 3.92699 3.92699 3.92699 3.92699 X^3 5.49779 5.49779 5.49779 5.49779 5.49779 X^4 8.24668 8.24668 8.24668 8.24668 8.24668 X^5 12.9591 12.9591 12.9591 12.9591 12.9591 X^6 21.053 21.1076 21.0094 21.0585 21.0585 R 4.72696 4.72441 4.72692 4.72583 4.7277 SIN(X) 2.32661 2.32654 2.32666 2.3266 2.3266 EXP(X) 9.6526 9.65281 9.65243 9.65262 9.65262 1/(1+R) 1.30752 1.30886 1.30784 1.30841 1.30694 SQRT(R) 3.79755 3.79563 3.7971 3.79626 3.79832 Rule: 11 12 13 'Function 1 3.14159 3.14159 3.14159 X 3.14159 3.14159 3.14159 X^2 3.92699 3.92699 3.92699 X^3 5.49779 5.49779 5.49779 X^4 8.24668 8.24668 8.24668 X^5 12.9591 12.9591 12.9591 X^6 21.0585 21.0585 21.0585 R 4.727 4.72704 4.72698 SIN(X) 2.3266 2.3266 2.3266 EXP(X) 9.65262 9.65262 9.65262 1/(1+R) 1.30749 1.30744 1.3075 SQRT(R) 3.79755 3.79762 3.79753 TEST17 CONE_UNIT_3D approximates integrals in a unit cone. Volume = 1.0472 F(X) CONE_3D 1 1.0472 X 0 Y 0 Z 0.261799 X*X 0.181917 X*Y 0 X*Z 0 Y*Y 0.181917 Y*Z 0 Z*Z 0.10472 X^3 0 X*Y*Z 0 Z*Z*Z 0.0523599 X^4 0.0653115 X^2 Z^2 0.00866271 Z^4 0.0299199 X^5 0 X^6 0.0303938 R 0.680705 SIN(X) 0 EXP(X) 1.14092 1/(1+R) 0.876763 SQRT(R) 0.837626 TEST18 CUBE_SHELL_ND approximates integrals in a cubical shell in ND. Inner radius = 0 Outer radius = 1 Spatial dimension N = 2 Volume = 4 F(X) CUBE_SHELL_ND 1 4 X 0 X^2 1.33333 X^3 0 X^4 0.555556 X^5 0 X^6 0.259259 R 3.26599 SIN(X) 0 EXP(X) 4.69018 1/(1+R) 2.20204 SQRT(R) 3.61441 Spatial dimension N = 3 Volume = 8 F(X) CUBE_SHELL_ND 1 8 X 0 X^2 2.66667 X^3 0 X^4 1.17333 X^5 0 X^6 0.618667 R 8 SIN(X) 0 EXP(X) 9.38309 1/(1+R) 4 SQRT(R) 8 Spatial dimension N = 4 Volume = 16 F(X) CUBE_SHELL_ND 1 16 X 0 X^2 5.33333 X^3 0 X^4 2.37037 X^5 0 X^6 1.31687 R 18.4752 SIN(X) 0 EXP(X) 18.7673 1/(1+R) 7.42563 SQRT(R) 17.1931 Inner radius = 1 Outer radius = 2 Spatial dimension N = 2 Volume = 12 F(X) CUBE_SHELL_ND 1 12 X 0 X^2 20 X^3 0 X^4 41.6667 X^5 0 X^6 97.2222 R 21.9089 SIN(X) 0 EXP(X) 23.8772 1/(1+R) 4.24667 SQRT(R) 16.2144 Spatial dimension N = 3 Volume = 56 F(X) CUBE_SHELL_ND 1 56 X 0 X^2 82.6667 X^3 0 X^4 161.082 X^5 0 X^6 376.137 R 117.847 SIN(X) 0 EXP(X) 104.592 1/(1+R) 18.0388 SQRT(R) 81.237 Spatial dimension N = 4 Volume = 240 F(X) CUBE_SHELL_ND 1 240 X 0 X^2 336 X^3 0 X^4 627.2 X^5 0 X^6 1463.47 R 567.944 SIN(X) 0 EXP(X) 436.264 1/(1+R) 71.2921 SQRT(R) 369.197 TEST19 CUBE_UNIT_3D approximates integrals in the unit cube in 3D. QMULT_3D approximates triple integrals. RECTANGLE_3D approximates integrals in a rectangular block. F(X) CUBE_UNIT_3D QMULT_3D RECTANGLE_3D 1 8 8 8 X 2.22045e-16 -1.16135e-16 0 Y 0 -1.1787e-16 0 Z 0 -4.08575e-17 0 X*X 2.66667 2.66667 2.66667 X*Y 0 8.34497e-18 0 X*Z 0 4.1674e-19 0 Y*Y 2.66667 2.66667 2.66667 Y*Z 0 -6.67462e-19 0 Z*Z 2.66667 2.66667 2.66667 X^3 5.55112e-17 1.12164e-16 5.55112e-17 X*Y*Z 0 -6.40357e-19 0 Z*Z*Z 0 -1.69508e-17 0 X^4 0.888889 1.6 0.888889 X^2 Z^2 0.888889 0.888889 0.888889 Z^4 0.888889 1.6 0.888889 X^5 0 -9.60027e-17 2.77556e-17 X^6 0.296296 1.14286 0.296296 R 8 7.68482 8 SIN(X) 0 3.5384e-16 -2.22045e-16 EXP(X) 9.37078 9.40161 9.37078 1/(1+R) 5.65685 5.80447 5.65685 SQRT(R) 8 7.74509 8 TEST20 CUBE_UNIT_ND approximates integrals inside the unit cube in ND. Spatial dimension N = 2 Value of K = 10 F(X) CUBE_UNIT_ND 1 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 X 0 0 0 0 1.11022e-16 -2.77556e-17 -2.77556e-17 0 4.16334e-17 2.77556e-17 0 0 0 0 5.97554e-16 -1.61034e-15 1.68138e-15 -3.94265e-16 9.15243e-16 -4.50394e-15 X^2 0 1 1.18519 1.25 1.28 1.2963 1.30612 1.3125 1.31687 1.32 0 1.33333 1.33333 1.33333 1.33333 1.33333 1.33333 1.33333 1.33333 1.33333 X^3 0 0 -5.55112e-17 0 0 2.77556e-17 1.38778e-17 0 0 -1.38778e-17 0 0 -1.1241e-16 1.44527e-16 -8.12966e-17 2.79365e-16 -4.88749e-16 1.93801e-16 3.61437e-16 -1.7744e-15 X^4 0 0.25 0.526749 0.640625 0.69632 0.727366 0.746356 0.758789 0.767363 0.77352 0 0.333333 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 X^5 0 0 1.38778e-17 0 -1.38778e-17 -4.16334e-17 0 0 -2.08167e-17 6.93889e-18 0 0 2.81025e-17 -3.61318e-17 -5.43701e-17 -2.15414e-16 8.72564e-16 -1.23416e-15 5.12032e-17 4.14201e-15 X^6 0 0.0625 0.234111 0.356445 0.425984 0.467393 0.493633 0.511185 0.523457 0.532356 0 0.0833333 0.407407 0.571429 0.571429 0.571429 0.571429 0.571429 0.571429 0.571429 R 0 2.82843 2.86129 2.99535 2.99898 3.03055 3.03142 3.04345 3.04375 3.04956 0 3.77124 2.77712 3.29336 2.82952 3.33489 2.70238 3.56765 2.30224 4.24872 SIN(X) 0 0 0 5.55112e-17 8.32667e-17 5.55112e-17 -1.38778e-17 4.16334e-17 2.77556e-17 1.38778e-17 0 0 0 1.80455e-16 1.27356e-16 -2.57379e-16 -6.76532e-16 2.98327e-15 -5.13957e-15 4.83691e-15 EXP(X) 4 4.5105 4.61487 4.65219 4.66961 4.67911 4.68485 4.68859 4.69115 4.69298 4 4.68067 4.70057 4.7008 4.7008 4.7008 4.7008 4.7008 4.7008 4.7008 1/(1+R) 4 2.34315 2.42617 2.34104 2.35741 2.33745 2.34322 2.33566 2.33833 2.3347 4 1.79086 2.5803 2.11555 2.55385 2.06663 2.68329 1.83403 3.08146 1.15691 SQRT(R) 0 3.36359 3.17774 3.40277 3.34985 3.41302 3.38987 3.41712 3.40464 3.41916 0 4.48478 2.8471 3.98415 2.79068 4.25275 2.24506 5.21264 0.574027 8.13865 Spatial dimension N = 3 Value of K = 5 F(X) CUBE_UNIT_ND 1 8 8 8 8 8 8 8 8 8 8 X 0 0 0 0 9.71445e-17 0 0 0 0 5.2286e-16 X^2 0 2 2.37037 2.5 2.56 0 2.66667 2.66667 2.66667 2.66667 X^3 0 0 8.32667e-17 0 5.55112e-17 0 0 1.68615e-16 -2.16791e-16 4.20722e-16 X^4 0 0.5 1.0535 1.28125 1.39264 0 0.666667 1.6 1.6 1.6 X^5 0 0 -2.77556e-17 0 9.02056e-17 0 0 -5.6205e-17 7.22636e-17 4.44864e-16 X^6 0 0.125 0.468221 0.712891 0.851968 0 0.166667 0.814815 1.14286 1.14286 R 0 6.9282 7.27446 7.48869 7.55032 0 9.2376 7.3407 7.86797 7.54372 SIN(X) 0 0 0 1.38778e-16 2.08167e-16 0 0 0 4.51138e-16 3.1839e-16 EXP(X) 8 9.02101 9.22974 9.30439 9.33922 8 9.36134 9.40114 9.40161 9.40161 1/(1+R) 8 4.28719 4.29317 4.20849 4.20436 8 3.04958 4.454 4.00548 4.30537 SQRT(R) 0 7.44484 7.45106 7.66123 7.66537 0 9.92645 7.14724 8.15275 7.3895 TEST205 ELLIPSE_AREA_2D returns the area of an ellipse. ELLIPSE_ECCENTRICITY_2D returns the eccentricity of an ellipse. ELLIPSE_CIRCUMFERENCE_2D returns the circumference of an ellipse. R1 R2 E Circum Area 25 20 0.6 141.808 1570.8 0.218418 0.956318 0.973569 4.06461 0.656207 0.829509 0.561695 0.735852 4.41118 1.46377 0.415307 0.0661187 0.987246 1.71901 0.0862668 0.257578 0.109957 0.904305 1.2017 0.0889775 (For the first example, the eccentricity should be 0.6, the circumference should be about 141.8). TEST21 HEXAGON_UNIT_SET sets a quadrature rule for the unit hexagon. HEXAGON_SUM evaluates the quadrature rule in an arbitrary hexagon. We use a radius 2 and center: CENTER = (0, 0) Rule: 1 2 3 4 Function 1 10.3923 10.3923 10.3923 10.3923 X 0 0 0 0 X^2 0 8.66025 8.66025 8.66025 X^3 0 0 0 0 X^4 0 14.4338 25.9808 14.5492 X^5 0 0 0 0 X^6 0 24.0563 95.2628 29.8744 R 0 13.4164 8.66025 11.5728 SIN(X) 0 0 0 0 EXP(X) 10.3923 15.3583 15.9469 15.3718 1/(1+R) 10.3923 4.53615 7.50555 5.75702 SQRT(R) 0 11.8079 6.12372 9.45964 TEST215 LENS_HALF_2D approximates an integral within a circular half lens, defined by joining the endpoints of a circular arc. Integrate F(X,Y) = 1 R Theta1 Theta2 Area Order Integral 1 0 0 0 2 0 1 0 0 0 4 0 1 0 0 0 6 0 1 0 0 0 8 0 1 0 0 0 10 0 1 0 0 0 12 0 1 0 0 0 14 0 1 0 0 0 16 0 1 0 0.785398 0.0391457 2 0.039576 1 0 0.785398 0.0391457 4 0.0392147 1 0 0.785398 0.0391457 6 0.0391683 1 0 0.785398 0.0391457 8 0.0391557 1 0 0.785398 0.0391457 10 0.039151 1 0 0.785398 0.0391457 12 0.0391488 1 0 0.785398 0.0391457 14 0.0391477 1 0 0.785398 0.0391457 16 0.0391471 1 0 1.5708 0.285398 2 0.288675 1 0 1.5708 0.285398 4 0.28592 1 0 1.5708 0.285398 6 0.285569 1 0 1.5708 0.285398 8 0.285474 1 0 1.5708 0.285398 10 0.285438 1 0 1.5708 0.285398 12 0.285422 1 0 1.5708 0.285398 14 0.285413 1 0 1.5708 0.285398 16 0.285408 1 0 2.35619 0.824544 2 0.83471 1 0 2.35619 0.824544 4 0.826147 1 0 2.35619 0.824544 6 0.825066 1 0 2.35619 0.824544 8 0.824776 1 0 2.35619 0.824544 10 0.824667 1 0 2.35619 0.824544 12 0.824616 1 0 2.35619 0.824544 14 0.82459 1 0 2.35619 0.824544 16 0.824575 1 0 3.14159 1.5708 2 1.59223 1 0 3.14159 1.5708 4 1.57411 1 0 3.14159 1.5708 6 1.57188 1 0 3.14159 1.5708 8 1.57128 1 0 3.14159 1.5708 10 1.57105 1 0 3.14159 1.5708 12 1.57095 1 0 3.14159 1.5708 14 1.57089 1 0 3.14159 1.5708 16 1.57086 1 0 3.92699 2.31705 2 2.35375 1 0 3.92699 2.31705 4 2.32247 1 0 3.92699 2.31705 6 2.31881 1 0 3.92699 2.31705 8 2.31783 1 0 3.92699 2.31705 10 2.31746 1 0 3.92699 2.31705 12 2.31729 1 0 3.92699 2.31705 14 2.3172 1 0 3.92699 2.31705 16 2.31715 1 0 4.71239 2.85619 2 2.91421 1 0 4.71239 2.85619 4 2.86377 1 0 4.71239 2.85619 6 2.85861 1 0 4.71239 2.85619 8 2.85727 1 0 4.71239 2.85619 10 2.85676 1 0 4.71239 2.85619 12 2.85653 1 0 4.71239 2.85619 14 2.85641 1 0 4.71239 2.85619 16 2.85634 1 0 5.49779 3.10245 2 3.19494 1 0 5.49779 3.10245 4 3.11336 1 0 5.49779 3.10245 6 3.10555 1 0 5.49779 3.10245 8 3.10376 1 0 5.49779 3.10245 10 3.10313 1 0 5.49779 3.10245 12 3.10285 1 0 5.49779 3.10245 14 3.1027 1 0 5.49779 3.10245 16 3.10262 1 0 6.28319 3.14159 2 3.26599 1 0 6.28319 3.14159 4 3.16056 1 0 6.28319 3.14159 6 3.14773 1 0 6.28319 3.14159 8 3.14431 1 0 6.28319 3.14159 10 3.14303 1 0 6.28319 3.14159 12 3.14244 1 0 6.28319 3.14159 14 3.14214 1 0 6.28319 3.14159 16 3.14196 Integrate F(X,Y) = X R Theta1 Theta2 Area Order Integral 1 0 0 0 2 0 1 0 0 0 4 0 1 0 0 0 6 0 1 0 0 0 8 0 1 0 0 0 10 0 1 0 0 0 12 0 1 0 0 0 14 0 1 0 0 0 16 0 1 0 0.785398 0.0391457 2 0.0349205 1 0 0.785398 0.0391457 4 0.0345818 1 0 0.785398 0.0391457 6 0.0345387 1 0 0.785398 0.0391457 8 0.0345271 1 0 0.785398 0.0391457 10 0.0345227 1 0 0.785398 0.0391457 12 0.0345207 1 0 0.785398 0.0391457 14 0.0345197 1 0 0.785398 0.0391457 16 0.0345191 1 0 1.5708 0.285398 2 0.169102 1 0 1.5708 0.285398 4 0.167041 1 0 1.5708 0.285398 6 0.166788 1 0 1.5708 0.285398 8 0.16672 1 0 1.5708 0.285398 10 0.166695 1 0 1.5708 0.285398 12 0.166683 1 0 1.5708 0.285398 14 0.166677 1 0 1.5708 0.285398 16 0.166674 1 0 2.35619 0.824544 2 0.205492 1 0 2.35619 0.824544 4 0.201814 1 0 2.35619 0.824544 6 0.201387 1 0 2.35619 0.824544 8 0.201274 1 0 2.35619 0.824544 10 0.201232 1 0 2.35619 0.824544 12 0.201212 1 0 2.35619 0.824544 14 0.201202 1 0 2.35619 0.824544 16 0.201197 1 0 3.14159 1.5708 2 0 1 0 3.14159 1.5708 4 5.20417e-18 1 0 3.14159 1.5708 6 -1.0842e-18 1 0 3.14159 1.5708 8 4.09286e-18 1 0 3.14159 1.5708 10 -4.05221e-18 1 0 3.14159 1.5708 12 6.89146e-18 1 0 3.14159 1.5708 14 -1.87533e-18 1 0 3.14159 1.5708 16 6.12913e-18 1 0 3.92699 2.31705 2 -0.216881 1 0 3.92699 2.31705 4 -0.203381 1 0 3.92699 2.31705 6 -0.201876 1 0 3.92699 2.31705 8 -0.201488 1 0 3.92699 2.31705 10 -0.201344 1 0 3.92699 2.31705 12 -0.201278 1 0 3.92699 2.31705 14 -0.201244 1 0 3.92699 2.31705 16 -0.201225 1 0 4.71239 2.85619 2 -0.201184 1 0 4.71239 2.85619 4 -0.172233 1 0 4.71239 2.85619 6 -0.168431 1 0 4.71239 2.85619 8 -0.167438 1 0 4.71239 2.85619 10 -0.167072 1 0 4.71239 2.85619 12 -0.166905 1 0 4.71239 2.85619 14 -0.166819 1 0 4.71239 2.85619 16 -0.16677 1 0 5.49779 3.10245 2 -0.0620848 1 0 5.49779 3.10245 4 -0.0413975 1 0 5.49779 3.10245 6 -0.0370893 1 0 5.49779 3.10245 8 -0.0357024 1 0 5.49779 3.10245 10 -0.0351485 1 0 5.49779 3.10245 12 -0.0348907 1 0 5.49779 3.10245 14 -0.034756 1 0 5.49779 3.10245 16 -0.0346791 1 0 6.28319 3.14159 2 -5.55112e-17 1 0 6.28319 3.14159 4 1.94289e-16 1 0 6.28319 3.14159 6 -6.93889e-18 1 0 6.28319 3.14159 8 2.60209e-18 1 0 6.28319 3.14159 10 -5.24754e-17 1 0 6.28319 3.14159 12 7.83878e-17 1 0 6.28319 3.14159 14 -4.73254e-17 1 0 6.28319 3.14159 16 -1.49715e-16 Integrate F(X,Y) = R R Theta1 Theta2 Area Order Integral 1 0 0 0 2 0 1 0 0 0 4 0 1 0 0 0 6 0 1 0 0 0 8 0 1 0 0 0 10 0 1 0 0 0 12 0 1 0 0 0 14 0 1 0 0 0 16 0 1 0 0.785398 0.0391457 2 0.0384017 1 0 0.785398 0.0391457 4 0.0380323 1 0 0.785398 0.0391457 6 0.0379857 1 0 0.785398 0.0391457 8 0.0379732 1 0 0.785398 0.0391457 10 0.0379684 1 0 0.785398 0.0391457 12 0.0379663 1 0 0.785398 0.0391457 14 0.0379651 1 0 0.785398 0.0391457 16 0.0379645 1 0 1.5708 0.285398 2 0.257008 1 0 1.5708 0.285398 4 0.253591 1 0 1.5708 0.285398 6 0.253232 1 0 1.5708 0.285398 8 0.253137 1 0 1.5708 0.285398 10 0.253101 1 0 1.5708 0.285398 12 0.253085 1 0 1.5708 0.285398 14 0.253076 1 0 1.5708 0.285398 16 0.253072 1 0 2.35619 0.824544 2 0.656948 1 0 2.35619 0.824544 4 0.639356 1 0 2.35619 0.824544 6 0.637932 1 0 2.35619 0.824544 8 0.637615 1 0 2.35619 0.824544 10 0.637503 1 0 2.35619 0.824544 12 0.637452 1 0 2.35619 0.824544 14 0.637426 1 0 2.35619 0.824544 16 0.637411 1 0 3.14159 1.5708 2 1.12071 1 0 3.14159 1.5708 4 1.05856 1 0 3.14159 1.5708 6 1.05089 1 0 3.14159 1.5708 8 1.04884 1 0 3.14159 1.5708 10 1.04807 1 0 3.14159 1.5708 12 1.04771 1 0 3.14159 1.5708 14 1.04753 1 0 3.14159 1.5708 16 1.04742 1 0 3.92699 2.31705 2 1.5994 1 0 3.92699 2.31705 4 1.47722 1 0 3.92699 2.31705 6 1.4641 1 0 3.92699 2.31705 8 1.46017 1 0 3.92699 2.31705 10 1.45861 1 0 3.92699 2.31705 12 1.45799 1 0 3.92699 2.31705 14 1.45765 1 0 3.92699 2.31705 16 1.45743 1 0 4.71239 2.85619 2 2.05128 1 0 4.71239 2.85619 4 1.86626 1 0 4.71239 2.85619 6 1.84848 1 0 4.71239 2.85619 8 1.84427 1 0 4.71239 2.85619 10 1.84289 1 0 4.71239 2.85619 12 1.84233 1 0 4.71239 2.85619 14 1.84203 1 0 4.71239 2.85619 16 1.84184 1 0 5.49779 3.10245 2 2.34495 1 0 5.49779 3.10245 4 2.09084 1 0 5.49779 3.10245 6 2.06676 1 0 5.49779 3.10245 8 2.06083 1 0 5.49779 3.10245 10 2.05869 1 0 5.49779 3.10245 12 2.05773 1 0 5.49779 3.10245 14 2.05723 1 0 5.49779 3.10245 16 2.05696 1 0 6.28319 3.14159 2 2.43432 1 0 6.28319 3.14159 4 2.13903 1 0 6.28319 3.14159 6 2.10851 1 0 6.28319 3.14159 8 2.1006 1 0 6.28319 3.14159 10 2.09766 1 0 6.28319 3.14159 12 2.09632 1 0 6.28319 3.14159 14 2.09563 1 0 6.28319 3.14159 16 2.09523 TEST22 OCTAHEDRON_UNIT_ND approximates integrals in a unit octahedron in N dimensions. F(X) N = 1 N = 2 N = 3 1 2 2 1.33333 X 0 0 0 X^2 0.666667 0.333333 0.133333 X^3 0 0 0 X^4 0.222222 0.111111 0.04 X^5 0 0 0 X^6 0.0740741 0.037037 0.012 R 1.1547 1.1547 0.730297 SIN(X) 0 0 0 EXP(X) 2.3427 2.17135 1.40168 1/(1+R) 1.26795 1.26795 0.861481 SQRT(R) 1.51967 1.51967 0.986777 TEST23 PARALLELIPIPED_VOLUME_ND computes the volume of a parallelipiped in N dimensions. Spatial dimension N = 2 Parallelipiped vertices: 0 1 0 0 0 1 Volume is 1 Spatial dimension N = 3 Parallelipiped vertices: 0 1 0 0 0 0 1 0 0 0 0 1 Volume is 1 Spatial dimension N = 4 Parallelipiped vertices: 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 Volume is 1 TEST24 For a polygon in 2D: POLYGON_1_2D integrates 1 POLYGON_X_2D integrates X POLYGON_Y_2D integrates Y POLYGON_XX_2D integrates X*X POLYGON_XY_2D integrates X*Y POLYGON_YY_2D integrates Y*Y F(X,Y) Integral 1 1 X 0.5 Y 0.5 X*X 0.333333 X*Y 0.25 Y*Y 0.333333 TEST25 For the unit pyramid, we approximate integrals with: PYRAMID_UNIT_O01_3D, a 1 point rule. PYRAMID_UNIT_O05_3D, a 5 point rule. PYRAMID_UNIT_O06_3D, a 6 point rule. PYRAMID_UNIT_O08_3D, an 8 point rule. PYRAMID_UNIT_O08b_3D, an 8 point rule. PYRAMID_UNIT_O09_3D, a 9 point rule. PYRAMID_UNIT_O13_3D, a 13 point rule. PYRAMID_UNIT_O18_3D, a 18 point rule. PYRAMID_UNIT_O27_3D, a 27 point rule. PYRAMID_UNIT_O48_3D, a 48 point rule. PYRAMID_UNIT_VOLUME_3D computes the volume of a unit pyramid. Volume = 1.33333 Order 1 X Y Z X*X 1 1.33333 0 0 0.333333 0 5 1.33333 0 0 0.333333 0.266667 6 1.33333 0 0 0.333333 0.266667 8 1.33333 0 0 0.333333 0.266667 8 1.33333 0 0 0.333333 0.266667 9 1.33333 0 0 0.333333 0.266667 13 1.33333 0 0 0.333333 0.266667 18 1.33333 0 -9.25186e-18 0.333333 0.266667 27 1.33333 0 -2.89121e-19 0.333333 0.266667 48 1.33333 0 0 0.333333 0.266667 Order X*Y X*Z Y*Y Y*Z Z*Z 1 0 0 0 0 0.0833333 5 0 0 0.266667 0 0.133333 6 0 0 0.266667 0 0.133333 8 0 0 0.266667 0 0.133333 8 0 0 0.266667 0 0.133333 9 0 0 0.266667 0 0.133333 13 0 0 0.266667 0 0.133333 18 0 0 0.266667 1.15648e-18 0.133333 27 0 0 0.266667 1.15648e-18 0.133333 48 0 0 0.266667 0 0.133333 Order X^3 X*Y*Z Z*Z*Z X^4 X^2 Z^2 1 0 0 0.0208333 0 0 5 0 0 0.0766667 0.0632099 0.00740741 6 0 0 0.0773148 0.0634921 0.00740741 8 0 0 0.0666667 0.0632099 0.0118519 8 0 0 0.0647619 0.0632099 0.0126984 9 0 0 0.0669312 0.0634921 0.0126984 13 0 0 0.0666504 0.0664669 0.0126984 18 0 0 0.0666667 0.113778 0.0118519 27 0 0 0.0666667 0.114286 0.0126984 48 0 0 0.0666667 0.114286 0.0126984 Order Z^4 X^5 X^6 R SIN(X) 1 0.00520833 0 0 0.333333 0 5 0.0508889 0 0.0149831 0.9428 0 6 0.0523148 0 0.0151172 0.941763 0 8 0.0355556 0 0.015861 0.9419 0 8 0.0330884 0 0.0160282 0.941565 0 9 0.0392038 0 0.0164399 0.939009 0 13 0.0379673 0 0.0174323 0.936256 0 18 0.0355556 0 0.0513896 0.882331 0 27 0.0380952 0 0.0533163 0.880646 0 48 0.0380952 0 0.0634921 0.906432 0 Order EXP(X) 1/(1+R) SQRT(R) 1 1.33333 1.29352 0.666667 5 1.46932 1.08867 1.12119 6 1.46933 1.08904 1.12024 8 1.46932 1.08901 1.12038 8 1.46932 1.08913 1.12008 9 1.46934 1.09011 1.11779 13 1.46946 1.09094 1.11513 18 1.47148 1.10358 1.05469 27 1.4715 1.10428 1.05166 48 1.47152 1.10245 1.08854 TEST255 For the unit pyramid, PYRAMID_UNIT_MONOMIAL_3D returns the exact value of the integral of X^ALPHA Y^BETA Z^GAMMA Volume = 1.33333 ALPHA BETA GAMMA INTEGRAL 0 0 0 1.33333 0 0 1 0.333333 0 0 2 0.133333 0 0 3 0.0666667 0 0 4 0.0380952 0 1 0 0 0 1 1 0 0 1 2 0 0 1 3 0 0 2 0 0.266667 0 2 1 0.0444444 0 2 2 0.0126984 0 3 0 0 0 3 1 0 0 4 0 0.114286 1 0 0 0 1 0 1 0 1 0 2 0 1 0 3 0 1 1 0 0 1 1 1 0 1 1 2 0 1 2 0 0 1 2 1 0 1 3 0 0 2 0 0 0.266667 2 0 1 0.0444444 2 0 2 0.0126984 2 1 0 0 2 1 1 0 2 2 0 0.0634921 3 0 0 0 3 0 1 0 3 1 0 0 4 0 0 0.114286 TEST26 QMULT_1D approximates an integral on a one-dimensional interval. We use the interval: A = -1 B = 1 F(X) QMULT_1D 1 2 X 4.85723e-17 X^2 0.666667 X^3 0.4 X^4 0.4 X^5 1.38778e-17 X^6 0.285714 R 1.00303 SIN(X) -2.42861e-17 EXP(X) 2.3504 1/(1+R) 1.38328 SQRT(R) 1.34347 TEST27 SIMPLEX_ND approximates integrals inside an arbitrary simplex in ND. Spatial dimension N = 2 Simplex vertices: 0 1 0 0 0 1 F(X) SIMPLEX_ND 1 0.5 X 0.166667 X^2 0.0833333 X^3 0.0509259 X^4 0.033179 X^5 0.0219907 X^6 0.0146391 R 0.268345 SIN(X) 0.15836 EXP(X) 0.718409 1/(1+R) 0.332444 SQRT(R) 0.357237 Spatial dimension N = 3 Simplex vertices: 0 1 0 0 0 0 1 0 0 0 0 1 F(X) SIMPLEX_ND 1 0.166667 X 0.0416667 X^2 0.0166667 X^3 0.00868921 X^4 0.00493921 X^5 0.00287107 X^6 0.00167794 R 0.08712 SIN(X) 0.0402422 EXP(X) 0.218347 1/(1+R) 0.110915 SQRT(R) 0.118586 Spatial dimension N = 4 Simplex vertices: 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 F(X) SIMPLEX_ND 1 0.0416667 X 0.00833333 X^2 0.00277778 X^3 0.00127217 X^4 0.000647362 X^5 0.00033823 X^6 0.000177796 R 0.0208088 SIN(X) 0.00812411 EXP(X) 0.051631 1/(1+R) 0.0280364 SQRT(R) 0.0291118 TEST28 SIMPLEX_VOLUME_ND computes the volume of a simplex in N dimensions. Spatial dimension N = 2 Simplex vertices: 0 1 0 0 0 1 Volume is 0.5 Spatial dimension N = 3 Simplex vertices: 0 1 0 0 0 0 1 0 0 0 0 1 Volume is 0.166667 Spatial dimension N = 4 Simplex vertices: 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 Volume is 0.0416667 TEST29 For integrals in the unit simplex in ND, SIMPLEX_UNIT_01_ND uses a formula of degree 1. SIMPLEX_UNIT_03_ND uses a formula of degree 3. SIMPLEX_UNIT_05_ND uses a formula of degree 5. SIMPLEX_UNIT_05_2_ND uses a formula of degree 5. Check the integral of 1 N Volume #1 #3 #5 #5.2 2 0.5 0.5 0.5 0.5 0.5 3 0.166667 0.166667 0.166667 0.166667 0.166667 4 0.0416667 0.0416667 0.0416667 0.0416667 0.0416667 5 0.00833333 0.00833333 0.00833333 0.00833333 0.00833333 6 0.00138889 0.00138889 0.00138889 0.00138889 0.00138889 7 0.000198413 0.000198413 0.000198413 0.000198413 0.000198413 8 2.48016e-05 2.48016e-05 2.48016e-05 2.48016e-05 2.48016e-05 9 2.75573e-06 2.75573e-06 2.75573e-06 2.75573e-06 2.75573e-06 10 2.75573e-07 2.75573e-07 2.75573e-07 2.75573e-07 2.75573e-07 11 2.50521e-08 2.50521e-08 2.50521e-08 2.50521e-08 2.50521e-08 12 2.08768e-09 2.08768e-09 2.08768e-09 2.08768e-09 2.08768e-09 13 5.17584e-10 5.17584e-10 5.17584e-10 5.17584e-10 5.17584e-10 14 7.81894e-10 7.81894e-10 7.81894e-10 7.81894e-10 7.81894e-10 15 4.98925e-10 4.98925e-10 4.98925e-10 4.98925e-10 4.98925e-10 16 4.98955e-10 4.98955e-10 4.98955e-10 4.98955e-10 4.98955e-10 Check the integral of X N Volume #1 #3 #5 #5.2 2 0.5 0.25 0.166667 0.166667 0.166667 3 0.166667 0.0555556 0.0416667 0.0416667 0.0416667 4 0.0416667 0.0104167 0.00833333 0.00833333 0.00833333 5 0.00833333 0.00166667 0.00138889 0.00138889 0.00138889 6 0.00138889 0.000231481 0.000198413 0.000198413 0.000198413 7 0.000198413 2.83447e-05 2.48016e-05 2.48016e-05 2.48016e-05 8 2.48016e-05 3.1002e-06 2.75573e-06 2.75573e-06 2.75573e-06 9 2.75573e-06 3.06192e-07 2.75573e-07 2.75573e-07 2.75573e-07 10 2.75573e-07 2.75573e-08 2.50521e-08 2.50521e-08 2.50521e-08 11 2.50521e-08 2.27746e-09 2.08768e-09 2.08768e-09 2.08768e-09 12 2.08768e-09 1.73973e-10 1.6059e-10 1.6059e-10 1.6059e-10 13 5.17584e-10 3.98142e-11 3.69703e-11 3.69703e-11 3.69703e-11 14 7.81894e-10 5.58496e-11 5.21263e-11 5.21263e-11 5.21263e-11 15 4.98925e-10 3.32617e-11 3.11828e-11 3.11828e-11 3.11828e-11 16 4.98955e-10 3.11847e-11 2.93503e-11 2.93503e-11 2.93503e-11 Check the integral of X^2 N Volume #1 #3 #5 #5.2 2 0.5 0.125 0.0833333 0.0833333 0.0833333 3 0.166667 0.0185185 0.0166667 0.0166667 0.0166667 4 0.0416667 0.00260417 0.00277778 0.00277778 0.00277778 5 0.00833333 0.000333333 0.000396825 0.000396825 0.000396825 6 0.00138889 3.85802e-05 4.96032e-05 4.96032e-05 4.96032e-05 7 0.000198413 4.04924e-06 5.51146e-06 5.51146e-06 5.51146e-06 8 2.48016e-05 3.87525e-07 5.51146e-07 5.51146e-07 5.51146e-07 9 2.75573e-06 3.40214e-08 5.01042e-08 5.01042e-08 5.01042e-08 10 2.75573e-07 2.75573e-09 4.17535e-09 4.17535e-09 4.17535e-09 11 2.50521e-08 2.07042e-10 3.21181e-10 3.21181e-10 3.21181e-10 12 2.08768e-09 1.44977e-11 2.29415e-11 2.29415e-11 2.29415e-11 13 5.17584e-10 3.06263e-12 4.92937e-12 4.92937e-12 4.92937e-12 14 7.81894e-10 3.98926e-12 6.51579e-12 6.51579e-12 6.51579e-12 15 4.98925e-10 2.21744e-12 3.66856e-12 3.66856e-12 3.66856e-12 16 4.98955e-10 1.94904e-12 3.26114e-12 3.26114e-12 3.26114e-12 Check the integral of X^3 N Volume #1 #3 #5 #5.2 2 0.5 0.0625 0.05 0.05 0.05 3 0.166667 0.00617284 0.00833333 0.00833333 0.00833333 4 0.0416667 0.000651042 0.00119048 0.00119048 0.00119048 5 0.00833333 6.66667e-05 0.00014881 0.00014881 0.00014881 6 0.00138889 6.43004e-06 1.65344e-05 1.65344e-05 1.65344e-05 7 0.000198413 5.78463e-07 1.65344e-06 1.65344e-06 1.65344e-06 8 2.48016e-05 4.84406e-08 1.50313e-07 1.50313e-07 1.50313e-07 9 2.75573e-06 3.78015e-09 1.25261e-08 1.25261e-08 1.25261e-08 10 2.75573e-07 2.75573e-10 9.63543e-10 9.63543e-10 9.63543e-10 11 2.50521e-08 1.8822e-11 6.88245e-11 6.88245e-11 6.88245e-11 12 2.08768e-09 1.20815e-12 4.5883e-12 4.5883e-12 4.5883e-12 13 5.17584e-10 2.35587e-13 9.24257e-13 9.24257e-13 9.24257e-13 14 7.81894e-10 2.84947e-13 1.14984e-12 1.14984e-12 1.14984e-12 15 4.98925e-10 1.4783e-13 6.11427e-13 6.11427e-13 6.11427e-13 16 4.98955e-10 1.21815e-13 5.14917e-13 5.14917e-13 5.14917e-13 Check the integral of X^4 N Volume #1 #3 #5 #5.2 2 0.5 0.03125 0.0311111 0.0333333 0.0333333 3 0.166667 0.00205761 0.00434028 0.0047619 0.0047619 4 0.0416667 0.00016276 0.00053288 0.000595238 0.000595238 5 0.00833333 1.33333e-05 5.83871e-05 6.61376e-05 6.61376e-05 6 0.00138889 1.07167e-06 5.77391e-06 6.61376e-06 6.61376e-06 7 0.000198413 8.26375e-08 5.20144e-07 6.01251e-07 6.01251e-07 8 2.48016e-05 6.05508e-09 4.30188e-08 5.01042e-08 5.01042e-08 9 2.75573e-06 4.20017e-10 3.28809e-09 3.85417e-09 3.85417e-09 10 2.75573e-07 2.75573e-11 2.33586e-10 2.75298e-10 2.75298e-10 11 2.50521e-08 1.71109e-12 1.54992e-11 1.83532e-11 1.83532e-11 12 2.08768e-09 1.00679e-13 9.64719e-13 1.14707e-12 1.14707e-12 13 5.17584e-10 1.81221e-14 1.82238e-13 2.17472e-13 2.17472e-13 14 7.81894e-10 2.03533e-14 2.13435e-13 2.55521e-13 2.55521e-13 15 4.98925e-10 9.8553e-15 1.07212e-13 1.28722e-13 1.28722e-13 16 4.98955e-10 7.61345e-15 8.55539e-14 1.02983e-13 1.02983e-13 Check the integral of X^5 N Volume #1 #3 #5 #5.2 2 0.5 0.015625 0.0192593 0.0238095 0.0238095 3 0.166667 0.000685871 0.00224248 0.00297619 0.00297619 4 0.0416667 4.06901e-05 0.000236152 0.000330688 0.000330688 5 0.00833333 2.66667e-06 2.26487e-05 3.30688e-05 3.30688e-05 6 0.00138889 1.78612e-07 1.99129e-06 3.00625e-06 3.00625e-06 7 0.000198413 1.18054e-08 1.61469e-07 2.50521e-07 2.50521e-07 8 2.48016e-05 7.56884e-10 1.21414e-08 1.92709e-08 1.92709e-08 9 2.75573e-06 4.66686e-11 8.50728e-10 1.37649e-09 1.37649e-09 10 2.75573e-07 2.75573e-12 5.57893e-11 9.1766e-11 9.1766e-11 11 2.50521e-08 1.55554e-13 3.43748e-12 5.73537e-12 5.73537e-12 12 2.08768e-09 8.3899e-15 1.99701e-13 3.37375e-13 3.37375e-13 13 5.17584e-10 1.394e-15 3.5367e-14 6.0409e-14 6.0409e-14 14 7.81894e-10 1.45381e-15 3.89854e-14 6.72424e-14 6.72424e-14 15 4.98925e-10 6.5702e-16 1.84953e-14 3.21804e-14 3.21804e-14 16 4.98955e-10 4.7584e-16 1.39823e-14 2.45199e-14 2.45199e-14 TEST30 For integrals on the unit sphere in 3D: SPHERE_UNIT_07_3D uses a formula of degree 7. SPHERE_UNIT_11_3D uses a formula of degree 11. SPHERE_UNIT_14_3D uses a formula of degree 14. SPHERE_UNIT_15_3D uses a formula of degree 15. Unit sphere area = 12.5664 F(X) S3S07 S3S11 S3S14 S3S15 1 12.5664 12.5664 12.5664 12.5664 X -6.21277e-16 5.44979e-17 6.53975e-17 -6.78499e-16 Y -2.6159e-16 6.53975e-17 1.08996e-17 2.64315e-16 Z 0 -8.71967e-17 6.53975e-17 4.46883e-16 X*X 4.18879 4.18879 4.18879 4.18879 X*Y 3.86935e-16 -1.08996e-17 -2.17992e-17 -2.46944e-17 X*Z -2.17992e-17 4.35984e-17 0 2.04367e-17 Y*Y 4.18879 4.18879 4.18879 4.18879 Y*Z -2.17992e-17 -1.08996e-17 -2.17992e-17 -5.44979e-18 Z*Z 4.18879 4.18879 4.18879 4.18879 X^3 -3.88298e-17 6.81224e-18 1.90743e-17 -6.61213e-16 X*Y*Z -2.7249e-18 0 -3.26988e-17 -2.21398e-18 Z*Z*Z 0 0 -3.26988e-17 -4.35984e-17 X^4 2.51327 2.51327 2.51327 2.51327 X^2 Z^2 0.837758 0.837758 0.837758 0.837758 Z^4 2.51327 2.51327 2.51327 2.51327 X^5 -2.38109e-17 1.83931e-17 1.63494e-17 -6.62283e-16 X^6 1.7952 1.7952 1.7952 1.7952 R 12.5664 12.5664 12.5664 12.5664 SIN(X) 4.35984e-16 -8.71967e-17 -6.53975e-17 -6.40351e-16 EXP(X) 14.768 14.768 14.768 14.768 1/(1+R) 8.88577 8.88577 8.88577 8.88577 SQRT(R) 12.5664 12.5664 12.5664 12.5664 TEST31 For integrals on the unit sphere in ND: SPHERE_UNIT_03_ND uses a formula of degree 3; SPHERE_UNIT_04_ND uses a formula of degree 4; SPHERE_UNIT_05_ND uses a formula of degree 5. SPHERE_UNIT_07_1_ND uses a formula of degree 7. SPHERE_UNIT_07_2_ND uses a formula of degree 7. SPHERE_UNIT_11_ND uses a formula of degree 11. Spatial dimension N = 3 Unit sphere area = 12.5664 Rule: #3 #4 #5 #7.1 #7.2 #11 Function 1 12.5664 12.5664 12.5664 12.5664 12.5664 12.5664 X 0 -1.74393e-16 0 0 0 0 X^2 4.18879 4.18879 4.18879 4.18879 4.18879 4.18879 X^3 0 -8.71967e-17 0 0 0 0 X^4 4.18879 2.51327 2.51327 2.51327 2.51327 2.51327 X^5 0 0 0 0 0 0 X^6 4.18879 1.67552 1.95477 1.7952 1.7952 1.7952 R 12.5664 12.5664 12.5664 12.5664 12.5664 12.5664 SIN(X) 0 1.74393e-16 0 0 0 0 EXP(X) 14.8412 14.7678 14.7682 14.768 14.768 14.768 1/(1+R) 6.28319 6.28319 6.28319 6.28319 6.28319 6.28319 SQRT(R) 12.5664 12.5664 12.5664 12.5664 12.5664 12.5664 Spatial dimension N = 4 Unit sphere area = 19.7392 Rule: #3 #4 #5 #7.1 #7.2 #11 Function 1 19.7392 19.7392 19.7392 19.7392 19.7392 19.7392 X 0 1.36968e-16 0 0 0 0 X^2 4.9348 4.9348 4.9348 4.9348 4.9348 4.9348 X^3 0 -1.36968e-16 0 0 0 0 X^4 4.9348 2.4674 2.4674 2.4674 2.4674 2.4674 X^5 0 1.02726e-16 0 0 0 0 X^6 4.9348 1.2337 1.85055 1.54213 1.54213 1.54213 R 19.7392 19.7392 19.7392 19.7392 19.7392 19.7392 SIN(X) 0 -1.36968e-16 0 0 0 0 EXP(X) 22.4192 22.3111 22.312 22.3116 22.3116 22.3116 1/(1+R) 9.8696 9.8696 9.8696 9.8696 9.8696 9.8696 SQRT(R) 19.7392 19.7392 19.7392 19.7392 19.7392 19.7392 Spatial dimension N = 5 Unit sphere area = 26.3189 Rule: #3 #4 #5 #7.1 #7.2 #11 Function 1 26.3189 26.3189 26.3189 26.3189 26.3189 26.311 X 0 5.47873e-16 0 0 0 0 X^2 5.26379 5.26379 5.26379 5.26379 5.26379 5.26221 X^3 0 0 0 0 0 0 X^4 5.26379 2.25591 2.25591 2.25591 2.25591 2.25543 X^5 0 0 0 0 0 0 X^6 5.26379 0.75197 1.65433 1.25328 1.25328 1.25313 R 26.3189 26.3189 26.3189 26.3189 26.3189 26.311 SIN(X) 0 0 0 0 0 0 EXP(X) 29.1776 29.0459 29.0472 29.0466 29.0466 29.0379 1/(1+R) 13.1595 13.1595 13.1595 13.1595 13.1595 13.1555 SQRT(R) 26.3189 26.3189 26.3189 26.3189 26.3189 26.311 Spatial dimension N = 6 Unit sphere area = 31.0063 Rule: #3 #4 #5 #7.1 #7.2 #11 Function 1 31.0063 31.0063 31.0063 31.0063 31.0063 31.0063 X 0 -3.22724e-16 0 0 0 0 X^2 5.16771 5.16771 5.16771 5.16771 5.16771 5.16771 X^3 0 -1.07575e-16 0 0 0 0 X^4 5.16771 1.93789 1.93789 1.93789 1.93789 1.93789 X^5 0 1.88256e-16 0 0 0 0 X^6 5.16771 0.322982 1.39959 0.968946 0.968946 0.968946 R 31.0063 31.0063 31.0063 31.0063 31.0063 31.0063 SIN(X) 0 -5.37873e-16 0 0 0 0 EXP(X) 33.8128 33.6713 33.6729 33.6722 33.6722 33.6722 1/(1+R) 15.5031 15.5031 15.5031 15.5031 15.5031 15.5031 SQRT(R) 31.0063 31.0063 31.0063 31.0063 31.0063 31.0063 Spatial dimension N = 7 Unit sphere area = 33.0734 Rule: #3 #4 #5 #7.1 #7.2 #11 Function 1 33.0734 33.0734 33.0734 33.0734 33.0734 33.0502 X 0 0 0 0 0 0 X^2 4.72477 4.72477 4.72477 4.72477 4.72477 4.72146 X^3 0 -2.86866e-16 0 0 0 0 X^4 4.72477 1.57492 1.57492 1.57492 1.57492 1.57326 X^5 0 1.14746e-16 0 0 0 0 X^6 4.72477 -4.30299e-16 1.12494 0.715874 0.715874 0.714742 R 33.0734 33.0734 33.0734 33.0734 33.0734 33.0502 SIN(X) 0 0 0 0 0 0 EXP(X) 35.6393 35.5013 35.503 35.5024 35.5024 35.4775 1/(1+R) 16.5367 16.5367 16.5367 16.5367 16.5367 16.5251 SQRT(R) 33.0734 33.0734 33.0734 33.0734 33.0734 33.0502 Spatial dimension N = 8 Unit sphere area = 32.4697 Rule: #3 #4 #5 #7.1 #7.2 #11 Function 1 32.4697 32.4697 32.4697 32.4697 32.4697 32.4697 X 0 0 0 0 0 0 X^2 4.05871 4.05871 4.05871 4.05871 4.05871 4.05871 X^3 0 1.68978e-16 0 0 0 0 X^4 4.05871 1.21761 1.21761 1.21761 1.21761 1.21761 X^5 0 -8.44889e-17 0 0 0 0 X^6 4.05871 -0.202936 0.862476 0.507339 0.507339 0.507339 R 32.4697 32.4697 32.4697 32.4697 32.4697 32.4697 SIN(X) 0 0 0 0 0 0 EXP(X) 34.6739 34.5495 34.551 34.5505 34.5505 34.5505 1/(1+R) 16.2348 16.2348 16.2348 16.2348 16.2348 16.2348 SQRT(R) 32.4697 32.4697 32.4697 32.4697 32.4697 32.4697 Spatial dimension N = 9 Unit sphere area = 29.6866 Rule: #3 #4 #5 #7.1 #7.2 #11 Function 1 29.6866 29.6866 29.6866 29.6866 29.6866 29.6866 X 0 -2.5749e-16 0 0 0 0 X^2 3.29851 3.29851 3.29851 3.29851 3.29851 3.29851 X^3 0 5.1498e-17 0 0 0 0 X^4 3.29851 0.899593 0.899593 0.899593 0.899593 0.899593 X^5 0 1.28745e-17 0 0 0 0 X^6 3.29851 -0.299864 0.633047 0.345997 0.345997 0.345997 R 29.6866 29.6866 29.6866 29.6866 29.6866 29.6866 SIN(X) 0 3.60486e-16 0 0 0 0 EXP(X) 31.4779 31.3729 31.3742 31.3738 31.3738 31.3738 1/(1+R) 14.8433 14.8433 14.8433 14.8433 14.8433 14.8433 SQRT(R) 29.6866 29.6866 29.6866 29.6866 29.6866 29.6866 Spatial dimension N = 10 Unit sphere area = 25.5016 Rule: #3 #4 #5 #7.1 #7.2 #11 Function 1 25.5016 25.5016 25.5016 25.5016 25.5016 25.5016 X 0 -1.32715e-16 0 0 0 0 X^2 2.55016 2.55016 2.55016 2.55016 2.55016 2.55016 X^3 0 -2.21191e-17 0 0 0 0 X^4 2.55016 0.637541 0.637541 0.637541 0.637541 0.637541 X^5 0 4.42383e-17 0 0 0 0 X^6 2.55016 -0.318771 0.446279 0.227693 0.227693 0.227693 R 25.5016 25.5016 25.5016 25.5016 25.5016 25.5016 SIN(X) 0 2.21191e-16 0 0 0 0 EXP(X) 26.8866 26.8028 26.8039 26.8036 26.8036 26.8036 1/(1+R) 12.7508 12.7508 12.7508 12.7508 12.7508 12.7508 SQRT(R) 25.5016 25.5016 25.5016 25.5016 25.5016 25.5016 TEST32 For integrals on a sphere in ND: SPHERE_05_ND uses a formula of degree 5. SPHERE_07_1_ND uses a formula of degree 7. Spatial dimension N = 2 Sphere center = 1 1 Sphere radius = 2 Sphere area = 12.5664 Rule: #5 #7.1 Function 1 12.5664 12.5664 X 12.5664 12.5664 X^2 37.6991 37.6991 X^3 87.9646 87.9646 X^4 238.761 238.761 X^5 640.885 640.885 X^6 1771.86 1771.86 R 28.356 28.356 SIN(X) 2.36794 2.36794 EXP(X) 77.8701 77.8701 1/(1+R) 4.31321 4.31321 SQRT(R) 18.3442 18.3442 Spatial dimension N = 3 Sphere center = 1 1 1 Sphere radius = 2 Sphere area = 50.2655 Rule: #5 #7.1 Function 1 50.2655 50.2655 X 50.2655 50.2655 X^2 117.286 117.286 X^3 251.327 251.327 X^4 613.239 613.239 X^5 1524.72 1524.72 X^6 3968.74 3927.89 R 124.836 125.495 SIN(X) 19.19 19.2318 EXP(X) 247.961 247.786 1/(1+R) 16.1428 15.7078 SQRT(R) 77.1726 77.7929 Spatial dimension N = 4 Sphere center = 1 1 1 1 Sphere radius = 2 Sphere area = 157.914 Rule: #5 #7.1 Function 1 157.914 157.914 X 157.914 157.914 X^2 315.827 315.827 X^3 631.655 631.655 X^4 1421.22 1421.22 X^5 3316.19 3316.19 X^6 8211.51 8053.6 R 425.6 427.624 SIN(X) 76.4753 76.638 EXP(X) 683.474 682.799 1/(1+R) 47.5449 46.088 SQRT(R) 251.965 254.745 TEST322 SPHERE_CAP_AREA_3D computes the volume of a 3D spherical cap, defined by a plane that cuts the sphere to a thickness of H units. SPHERE_CAP_AREA_ND computes the volume of an ND spherical cap, defined by a plane that cuts the sphere to a thickness of H units. Area of the total sphere in 3D = 12.5664 R H Cap Cap area_3d area_nd 1 0 0 0 1 0.166667 1.0472 1.0472 1 0.333333 2.0944 2.0944 1 0.5 3.14159 3.14159 1 0.666667 4.18879 4.18879 1 0.833333 5.23599 5.23599 1 1 6.28319 6.28319 1 1.16667 7.33038 7.33038 1 1.33333 8.37758 8.37758 1 1.5 9.42478 9.42478 1 1.66667 10.472 10.472 1 1.83333 11.5192 11.5192 1 2 12.5664 12.5664 1 2.16667 12.5664 12.5664 TEST324 SPHERE_CAP_VOLUME_2D computes the volume (area) of a spherical cap, defined by a plane that cuts the sphere to a thickness of H units. SPHERE_CAP_VOLUME_ND does the same operation, but in N dimensions. Using a radius R = 1 Volume of the total sphere in 2D = 3.14159 H Cap Cap vol_2d vol_nd 0 0 0 0.166667 0.125043 0.125043 0.333333 0.344165 0.344165 0.5 0.614185 0.614185 0.666667 0.91669 0.91669 0.833333 1.23901 1.23901 1 1.5708 1.5708 1.16667 1.90258 1.90258 1.33333 2.2249 2.2249 1.5 2.52741 2.52741 1.66667 2.79743 2.79743 1.83333 3.01655 3.01655 2 3.14159 3.14159 2.16667 3.14159 3.14159 TEST326 SPHERE_CAP_VOLUME_3D computes the volume of a spherical cap, defined by a plane that cuts the sphere to a thickness of H units. SPHERE_CAP_VOLUME_ND does the same operation, but in N dimensions. Using a radius R = 1 Volume of the total sphere in 3D = 4.18879 H Cap Cap volume_3d volume_nd 0 0 0 0.166667 0.0824183 0.0824183 0.333333 0.310281 0.310281 0.5 0.654498 0.654498 0.666667 1.08598 1.08598 0.833333 1.57564 1.57564 1 2.0944 2.0944 1.16667 2.61315 2.61315 1.33333 3.10281 3.10281 1.5 3.53429 3.53429 1.66667 3.87851 3.87851 1.83333 4.10637 4.10637 2 4.18879 4.18879 2.16667 4.18879 4.18879 TEST33 For a sphere in ND: SPHERE_CAP_AREA_ND computes the area of a spherical cap. SPHERE_CAP_VOLUME_ND computes the volume of a spherical cap. Spatial dimension N = 2 Radius = 1 Area = 6.28319 Volume = 3.14159 Sphere Sphere cap cap H area volume 0 0 0 0.166667 1.17137 0.125043 0.333333 1.68214 0.344165 0.5 2.0944 0.614185 0.666667 2.46192 0.91669 0.833333 2.8067 1.23901 1 3.14159 1.5708 1.16667 3.47649 1.90258 1.33333 3.82127 2.2249 1.5 4.18879 2.52741 1.66667 4.60105 2.79743 1.83333 5.11181 3.01655 2 6.28319 3.14159 2.16667 6.28319 3.14159 Spatial dimension N = 3 Radius = 1 Area = 12.5664 Volume = 4.18879 Sphere Sphere cap cap H area volume 0 0 0 0.166667 1.0472 0.0824183 0.333333 2.0944 0.310281 0.5 3.14159 0.654498 0.666667 4.18879 1.08598 0.833333 5.23599 1.57564 1 6.28319 2.0944 1.16667 7.33038 2.61315 1.33333 8.37758 3.10281 1.5 9.42478 3.53429 1.66667 10.472 3.87851 1.83333 11.5192 4.10637 2 12.5664 4.18879 2.16667 12.5664 4.18879 Spatial dimension N = 4 Radius = 1 Area = 19.7392 Volume = 4.9348 Sphere Sphere cap cap H area volume 0 0 0 0.166667 0.78567 0.0490225 0.333333 2.16245 0.251526 0.5 3.85904 0.624672 0.666667 5.75973 1.1474 0.833333 7.78495 1.77893 1 9.8696 2.4674 1.16667 11.9543 3.15588 1.33333 13.9795 3.7874 1.5 15.8802 4.31013 1.66667 17.5768 4.68328 1.83333 18.9535 4.88578 2 19.7392 4.9348 2.16667 19.7392 4.9348 Spatial dimension N = 5 Radius = 1 Area = 26.3189 Volume = 5.26379 Sphere Sphere cap cap H area volume 0 0 0 0.166667 0.51785 0.0267809 0.333333 1.94955 0.186832 0.5 4.11234 0.544884 0.666667 6.82343 1.10475 0.833333 9.90007 1.82453 1 13.1595 2.63189 1.16667 16.4189 3.43926 1.33333 19.4955 4.15904 1.5 22.2066 4.7189 1.66667 24.3694 5.07696 1.83333 25.8011 5.23701 2 26.3189 5.26379 2.16667 26.3189 5.26379 TEST335 For integrals inside a spherical shell in ND: SPHERE_SHELL_03_ND approximates the integral. We compare these results with those computed by from the difference of two ball integrals: BALL_F1_ND approximates the integral; BALL_F3_ND approximates the integral Spatial dimension N = 2 Sphere center: 0 0 Inner sphere radius = 0 Outer sphere radius = 1 Spherical shell volume = 3.14159 Rule: #3 F1(R2)-F1(R1) F3(R2)-F3(R1) F(X) 1 3.14159 3.14159 3.14159 X 0 0 0 X^2 0.785398 0.785398 0.785398 X^3 0 0 0 X^4 0.392699 0.392699 0.392699 X^5 0 0 0 X^6 0.19635 0.229749 0.19635 R 2.22144 2.07465 1.92382 SIN(X) 0 0 0 EXP(X) 3.55093 3.55098 3.55093 1/(1+R) 1.8403 1.94254 2.08251 SQRT(R) 2.64175 2.49488 2.12906 Spatial dimension N = 3 Sphere center: 0 0 0 Inner sphere radius = 0 Outer sphere radius = 1 Spherical shell volume = 4.18879 Rule: #3 F1(R2)-F1(R1) F3(R2)-F3(R1) F(X) 1 4.18879 4.18879 4.18879 X 0 0 0 X^2 0.837758 0.837758 0.837758 X^3 0 0 0 X^4 0.502655 0.359039 0.359039 X^5 0 0 0 X^6 0.301593 0.194741 0.153874 R 3.24462 3.12359 2.97375 SIN(X) 0 0 0 EXP(X) 4.62904 4.6229 4.62284 1/(1+R) 2.36042 2.44033 2.57714 SQRT(R) 3.6866 3.57254 3.23471 Spatial dimension N = 2 Sphere center: 1 -1 Inner sphere radius = 2 Outer sphere radius = 3 Spherical shell volume = 15.708 Rule: #3 F1(R2)-F1(R1) F3(R2)-F3(R1) F(X) 1 15.708 15.708 15.708 X 15.708 15.708 15.708 X^2 66.7588 66.7588 66.7588 X^3 168.861 168.861 168.861 X^4 653.844 583.158 583.158 X^5 2185.37 1831.94 1831.94 X^6 7915.83 6147.21 5936.63 R 43.4471 42.9377 43.4548 SIN(X) 1.12497 -0.640965 -0.438804 EXP(X) 158.828 147.703 146.74 1/(1+R) 4.43688 4.62869 4.31425 SQRT(R) 25.748 25.4203 25.8669 Spatial dimension N = 3 Sphere center: 1 -1 2 Inner sphere radius = 2 Outer sphere radius = 3 Spherical shell volume = 79.587 Rule: #3 F1(R2)-F1(R1) F3(R2)-F3(R1) F(X) 1 79.587 79.587 79.587 X 79.587 79.587 79.587 X^2 256.354 256.354 256.354 X^3 609.888 609.888 609.888 X^4 2318.01 1879.45 1879.45 X^5 7736.39 5543.56 5543.56 X^6 28246.5 17553.4 16769.9 R 268.542 266.437 267.9 SIN(X) 25.7365 14.5341 15.3008 EXP(X) 623.423 555.792 552.271 1/(1+R) 19.71 20.6703 19.839 SQRT(R) 143.861 142.331 143.558 TEST34: SPHERE_UNIT_AREA_ND evaluates the area of the unit sphere in N dimensions. SPHERE_UNIT_AREA_VALUES returns some test values. dim_num Exact Computed Area Area 1 2 2 2 6.28319 6.28319 3 12.5664 12.5664 4 19.7392 19.7392 5 26.3189 26.3189 6 31.0063 31.0063 7 33.0734 33.0734 8 32.4697 32.4697 9 29.6866 29.6866 10 25.5016 25.5016 11 20.7251 20.7251 12 16.0232 16.0232 13 11.8382 11.8382 14 8.3897 8.3897 15 5.72165 5.72165 16 3.76529 3.76529 17 2.39668 2.39668 18 1.47863 1.47863 19 0.88581 0.88581 20 0.516138 0.516138 TEST345: SPHERE_UNIT_VOLUME_ND evaluates the area of the unit sphere in N dimensions. SPHERE_UNIT_VOLUME_VALUES returns some test values. dim_num Exact Computed Volume Volume 1 2 2 2 3.14159 3.14159 3 4.18879 4.18879 4 4.9348 4.9348 5 5.26379 5.26379 6 5.16771 5.16771 7 4.72477 4.72477 8 4.05871 4.05871 9 3.29851 3.29851 10 2.55016 2.55016 11 1.8841 1.8841 12 1.33526 1.33526 13 0.910629 0.910629 14 0.599265 0.599265 15 0.381443 0.381443 16 0.235331 0.235331 17 0.140981 0.140981 18 0.0821459 0.0821459 19 0.0466216 0.0466216 20 0.0258069 0.0258069 TEST35 SQUARE_UNIT_SET sets up a quadrature rule on a unit square. RECTANGLE_SUB_2D applies it to subrectangles of an arbitrary rectangle. The corners of the rectangle are: 1 2 3 3 Using unit square integration rule number 2 Order of rule is 4 Function Subdivisions Integral 1 1 2 2 1 2 4 2 1 3 6 2 1 4 8 2 1 5 10 2 Function Subdivisions Integral X 1 2 4 X 2 4 4 X 3 6 4 X 4 8 4 X 5 10 4 Function Subdivisions Integral X^2 1 2 8.66667 X^2 2 4 8.66667 X^2 3 6 8.66667 X^2 4 8 8.66667 X^2 5 10 8.66667 Function Subdivisions Integral X^3 1 2 20 X^3 2 4 20 X^3 3 6 20 X^3 4 8 20 X^3 5 10 20 Function Subdivisions Integral X^4 1 2 48.2222 X^4 2 4 48.3889 X^4 3 6 48.3978 X^4 4 8 48.3993 X^4 5 10 48.3997 Function Subdivisions Integral X^5 1 2 119.556 X^5 2 4 121.222 X^5 3 6 121.311 X^5 4 8 121.326 X^5 5 10 121.33 Function Subdivisions Integral X^6 1 2 301.407 X^6 2 4 311.574 X^6 3 6 312.144 X^6 4 8 312.241 X^6 5 10 312.267 Function Subdivisions Integral R 1 2 6.47668 R 2 4 6.47705 R 3 6 6.47706 R 4 8 6.47707 R 5 10 6.47707 Function Subdivisions Integral SIN(X) 1 2 1.52382 SIN(X) 2 4 1.52993 SIN(X) 3 6 1.53022 SIN(X) 4 8 1.53027 SIN(X) 5 10 1.53029 Function Subdivisions Integral EXP(X) 1 2 17.3103 EXP(X) 2 4 17.3634 EXP(X) 3 6 17.3665 EXP(X) 4 8 17.367 EXP(X) 5 10 17.3672 Function Subdivisions Integral 1/(1+R) 1 2 0.476772 1/(1+R) 2 4 0.476678 1/(1+R) 3 6 0.476673 1/(1+R) 4 8 0.476672 1/(1+R) 5 10 0.476672 Function Subdivisions Integral SQRT(R) 1 2 3.5912 SQRT(R) 2 4 3.59141 SQRT(R) 3 6 3.59142 SQRT(R) 4 8 3.59142 SQRT(R) 5 10 3.59142 TEST36 SQUARE_UNIT_SET sets up quadrature on the unit square; SQUARE_SUM carries it out on an arbitrary square. Square center: CENTER = ( 2, 2) Square radius is 3 Rule: 1 2 3 4 5 Function 1 36 36 36 36 36 X 72 72 72 72 72 X^2 144 252 252 252 252 X^3 288 936 936 936 936 X^4 576 3492 3751.2 3751.2 3751.2 X^5 1152 13032 15624 15624 15624 X^6 2304 48636 66365.3 66965.1 66965.1 R 101.823 118.262 122.814 122.507 123.004 SIN(X) 32.7347 -5.25577 2.11273 1.52586 1.54945 EXP(X) 266.006 775.295 880.2 888.093 888.38 1/(1+R) 9.40334 11.7565 9.67398 9.69178 9.47694 SQRT(R) 60.5445 61.0346 64.3299 64.2287 64.572 Rule: 6 Function 1 36 X 72 X^2 252 X^3 936 X^4 3751.2 X^5 15624 X^6 66965.1 R 122.496 SIN(X) 1.53984 EXP(X) 888.272 1/(1+R) 9.71664 SQRT(R) 64.2021 TEST37 SQUARE_UNIT_SET sets up quadrature on the unit square; SQUARE_UNIT_SUM carries it out on the unit square. Rule: 1 2 3 4 5 Function 1 1 1 1 1 1 X 0 0 0 0 0 X^2 0 0.333333 0.333333 0.333333 0.333333 X^3 0 0 0 0 0 X^4 0 0.111111 0.2 0.2 0.2 X^5 0 0 0 0 0 X^6 0 0.037037 0.12 0.142857 0.142857 R 0 0.816497 0.720617 0.774832 0.77346 SIN(X) 0 0 0 0 0 EXP(X) 1 1.17135 1.17517 1.1752 1.1752 1/(1+R) 1 0.55051 0.623098 0.575052 0.576522 SQRT(R) 0 0.903602 0.757659 0.868229 0.863466 Rule: 6 Function 1 1 X -1.30104e-18 X^2 0.333333 X^3 4.33681e-19 X^4 0.2 X^5 7.37257e-18 X^6 0.142857 R 0.766081 SIN(X) 1.17094e-17 EXP(X) 1.1752 1/(1+R) 0.582304 SQRT(R) 0.857542 TEST38 For integrals inside an arbitrary tetrahedron: TETRA_07 uses a formula of degree 7; TETRA_TPRODUCT uses a triangular product formula of varying degree. Tetrahedron vertices: 1 2 6 4 2 6 1 3 6 1 2 8 Tetrahedron unit volume = 0.166667 Tetrahedron Volume = 1 F(X) TETRA_07 TETRA_TPRODUCT(1:4) TETRA_TPRODUCT(5:8) TETRA_TPRODUCT(9) 1 1 1 1 1 1 1 1 1 1 1 X 1.75 1.75 1.75 1.75 1.75 1.75 1.75 1.75 1.75 1.75 Y 2.25 2.25 2.25 2.25 2.25 2.25 2.25 2.25 2.25 2.25 Z 6.5 6.5 6.5 6.5 6.5 6.5 6.5 6.5 6.5 6.5 X*X 3.4 3.0625 3.4 3.4 3.4 3.4 3.4 3.4 3.4 3.4 X*Y 3.9 3.9375 3.9 3.9 3.9 3.9 3.9 3.9 3.9 3.9 X*Z 11.3 11.375 11.3 11.3 11.3 11.3 11.3 11.3 11.3 11.3 Y*Y 5.1 5.0625 5.1 5.1 5.1 5.1 5.1 5.1 5.1 5.1 Y*Z 14.6 14.625 14.6 14.6 14.6 14.6 14.6 14.6 14.6 14.6 Z*Z 42.4 42.25 42.4 42.4 42.4 42.4 42.4 42.4 42.4 42.4 X^3 7.3 5.35938 7.3 7.3 7.3 7.3 7.3 7.3 7.3 7.3 X*Y*Z 25.15 25.5938 25.15 25.15 25.15 25.15 25.15 25.15 25.15 25.15 Z*Z*Z 277.6 274.625 277.6 277.6 277.6 277.6 277.6 277.6 277.6 277.6 X^4 17.1143 9.37891 16.9888 17.1143 17.1143 17.1143 17.1143 17.1143 17.1143 17.1143 X^2 Z^2 140.171 129.391 140.154 140.171 140.171 140.171 140.171 140.171 140.171 140.171 Z^4 1824.46 1785.06 1824.44 1824.46 1824.46 1824.46 1824.46 1824.46 1824.46 1824.46 X^5 43.1607 16.4131 41.8394 43.1607 43.1607 43.1607 43.1607 43.1607 43.1607 43.1607 X^6 115.429 28.7229 106.839 115.376 115.429 115.429 115.429 115.429 115.429 115.429 R 7.12747 7.09753 7.12751 7.12747 7.12747 7.12747 7.12747 7.12747 7.12747 7.12747 SIN(X) 0.835961 0.983986 0.83174 0.836018 0.835961 0.835962 0.835962 0.835962 0.835962 0.835962 EXP(X) 6.99838 5.7546 6.95252 6.9977 6.99838 6.99839 6.99839 6.99839 6.99839 6.99839 1/(1+R) 0.139196 0.139516 0.139194 0.139196 0.139196 0.139196 0.139196 0.139196 0.139196 0.139196 SQRT(R) 2.66909 2.66412 2.6691 2.66909 2.66909 2.66909 2.66909 2.66909 2.66909 2.66909 TEST39 TETRA_UNIT_SET sets quadrature rules for the unit tetrahedron; TETRA_UNIT_SUM applies them to the unit tetrahedron. Rule: 1 2 3 4 5 Function 1 0.166667 0.166667 0.166667 0.166667 0.166667 X 0.0416667 0.0416667 0.0416667 0.0416667 0.0416667 Y 0.0416667 0.0416667 0.0416667 0.0416667 0.0416667 Z 0.0416667 0.0416667 0.0416667 0.0416667 0.0416667 X*X 0.0104167 0.0416667 0.0166667 0.0166667 0.0166667 X*Y 0.0104167 0 0.00833333 0.00833333 0.00833333 X*Z 0.0104167 0 0.00833333 0.00833333 0.00833333 Y*Y 0.0104167 0.0416667 0.0166667 0.0166667 0.0166667 Y*Z 0.0104167 0 0.00833333 0.00833333 0.00833333 Z*Z 0.0104167 0.0416667 0.0166667 0.0166667 0.0166667 X^3 0.00260417 0.0416667 0.00868921 0.00416667 0.00833333 X*Y*Z 0.00260417 0 0.00150751 0 0.00138889 Z*Z*Z 0.00260417 0.0416667 0.00868921 0.00416667 0.00833333 X^4 0.000651042 0.0416667 0.00493921 -0.00208333 0.00434028 X^2 Z^2 0.000651042 0 0.000575819 0.00208333 0.000636574 Z^4 0.000651042 0.0416667 0.00493921 -0.00208333 0.00434028 X^5 0.00016276 0.0416667 0.00287107 -0.00520833 0.00224248 X^6 4.06901e-05 0.0416667 0.00167794 -0.00677083 0.00114415 R 0.0721688 0.125 0.08712 0.0957107 0.088289 SIN(X) 0.041234 0.0350613 0.0402422 0.0409303 0.0402964 EXP(X) 0.214004 0.238262 0.218347 0.21722 0.218257 1/(1+R) 0.152944 0.130055 0.146894 0.145081 0.14662 SQRT(R) 0.109673 0.125 0.118586 0.1298 0.119842 Rule: 6 7 8 Function 1 0.166667 0.166667 0.0277778 X 0.0416667 0.0416667 0.00694444 Y 0.0416667 0.0416667 0.00694444 Z 0.0416667 0.0416667 0.00694444 X*X 0.0166667 0.0166667 0.00277778 X*Y 0.00833333 0.00833333 0.00138889 X*Z 0.00833333 0.00833333 0.00138889 Y*Y 0.0166667 0.0166667 0.00277778 Y*Z 0.00833333 0.00833333 0.00138889 Z*Z 0.0166667 0.0166667 0.00277778 X^3 0.00833333 0.00833333 0.00138889 X*Y*Z 0.00138889 0.00138889 0.000231481 Z*Z*Z 0.00833333 0.00833333 0.00138889 X^4 0.00555556 0.0047619 0.000793651 X^2 Z^2 0.000925926 0.000793651 0.000132275 Z^4 0.00555556 0.0047619 0.000793651 X^5 0.00462963 0.00279018 0.000504889 X^6 0.00432099 0.0015067 0.000348891 R 0.0871836 0.0876566 0.0146428 SIN(X) 0.0403155 0.0403009 0.00671712 EXP(X) 0.218333 0.218279 0.0363804 1/(1+R) 0.147242 0.147032 0.0244873 SQRT(R) 0.118235 0.119963 0.0199252 TEST40 TETRA_UNIT_SET sets quadrature rules for the unit tetrahedron; TETRA_SUM applies them to an arbitrary tetrahedron. Tetrahedron vertices: 1 2 6 4 2 6 1 3 6 1 2 8 Rule: 1 2 3 4 5 Function 1 1 1 1 1 1 X 1.75 1.75 1.75 1.75 1.75 Y 2.25 2.25 2.25 2.25 2.25 Z 6.5 6.5 6.5 6.5 6.5 X*X 3.0625 4.75 3.4 3.4 3.4 X*Y 3.9375 3.75 3.9 3.9 3.9 X*Z 11.375 11 11.3 11.3 11.3 Y*Y 5.0625 5.25 5.1 5.1 5.1 Y*Z 14.625 14.5 14.6 14.6 14.6 Z*Z 42.25 43 42.4 42.4 42.4 X^3 5.35938 16.75 7.35765 6.625 7.3 X*Y*Z 25.5938 23.5 25.1543 25.1 25.15 Z*Z*Z 274.625 290 277.617 277.4 277.6 X^4 9.37891 64.75 17.4311 11.0875 16.9094 X^2 Z^2 129.391 178 139.954 142.45 140.138 Z^4 1785.06 1996 1824.88 1819 1824.42 X^5 16.4131 256.75 44.0148 7.84375 41.0664 X^6 28.7229 1024.75 115.615 -57.8656 102.262 R 7.09753 7.24385 7.12743 7.12869 7.12753 SIN(X) 0.983986 0.441903 0.834842 0.775585 0.828742 EXP(X) 5.7546 15.6882 7.0212 5.80282 6.92872 1/(1+R) 0.139516 0.138036 0.139197 0.139148 0.139194 SQRT(R) 2.66412 2.6881 2.66908 2.6694 2.6691 Rule: 6 7 8 Function 1 1 1 0.166667 X 1.75 1.75 0.291667 Y 2.25 2.25 0.375 Z 6.5 6.5 1.08333 X*X 3.4 3.4 0.566667 X*Y 3.9 3.9 0.65 X*Z 11.3 11.3 1.88333 Y*Y 5.1 5.1 0.85 Y*Z 14.6 14.6 2.43333 Z*Z 42.4 42.4 7.06667 X^3 7.3 7.3 1.21667 X*Y*Z 25.15 25.15 4.19167 Z*Z*Z 277.6 277.6 46.2667 X^4 17.5 17.1143 2.85238 X^2 Z^2 140.2 140.171 23.3619 Z^4 1824.53 1824.46 304.076 X^5 47.5 42.8895 7.20637 X^6 145.9 111.713 19.3952 R 7.12736 7.12747 1.18791 SIN(X) 0.847297 0.837317 0.139281 EXP(X) 7.16805 6.97426 1.16725 1/(1+R) 0.139201 0.139196 0.0231992 SQRT(R) 2.66906 2.66909 0.444848 TEST41 TRIANGLE_UNIT_SET sets up a quadrature rule on a triangle. TRIANGLE_SUB applies it to subtriangles of an arbitrary triangle. Triangle vertices: 0 0 0 1 1 0 Using unit triangle quadrature rule 3 Rule order = 3