08-Jan-2022 10:39:18 triangle_monte_carlo_test() MATLAB/Octave version 9.8.0.1380330 (R2020a) Update 2 Test triangle_monte_carlo(). TRIANGLE_MONTE_CARLO_TEST01 Sample using TRIANGLE_UNIT_SAMPLE_01 Integrate TRIANGLE_UNIT_INTEGRAND_03 Integration region is the unit triangle. Use an increasing number of points P_NUM. Note that the sample routine is a "bad" sampler. P_NUM X^2 X*Y Y^2 1 0.002362 0.015155 0.097235 2 0.072988 0.029221 0.083336 4 0.099962 0.064380 0.064015 8 0.102804 0.039269 0.062885 16 0.071709 0.054356 0.078098 32 0.074916 0.045340 0.059035 64 0.071729 0.041977 0.048139 128 0.078317 0.048822 0.062405 256 0.074254 0.049288 0.066442 512 0.066216 0.049063 0.079806 1024 0.071681 0.047470 0.069161 2048 0.073691 0.047051 0.069387 4096 0.072366 0.047112 0.071863 8192 0.071152 0.047684 0.071920 16384 0.072154 0.047535 0.071283 32768 0.071152 0.047334 0.071527 65536 0.071746 0.047316 0.071518 TRIANGLE_MONTE_CARLO_TEST02 Sample using TRIANGLE_UNIT_SAMPLE_02 Integrate TRIANGLE_UNIT_INTEGRAND_03 Integration region is the unit triangle. Use an increasing number of points P_NUM. Note that the sample routine is a good" sampler. P_NUM X^2 X*Y Y^2 1 0.043467 0.089396 0.183858 2 0.036660 0.062652 0.128791 4 0.117047 0.044003 0.058116 8 0.054545 0.041444 0.101841 16 0.067835 0.057317 0.116015 32 0.111296 0.042570 0.094795 64 0.083960 0.039889 0.074165 128 0.086054 0.042628 0.077642 256 0.089945 0.041133 0.075903 512 0.085863 0.041777 0.082363 1024 0.078222 0.040519 0.080209 2048 0.087703 0.041004 0.083008 4096 0.084249 0.042100 0.081161 8192 0.082765 0.041148 0.083472 16384 0.084304 0.041584 0.082741 32768 0.082716 0.041854 0.083463 65536 0.082926 0.041883 0.084053 TRIANGLE_MONTE_CARLO_TEST03 Sample using TRIANGLE_UNIT_SAMPLE_03 Integrate TRIANGLE_UNIT_INTEGRAND_03 Integration region is the unit triangle. Use an increasing number of points P_NUM. Note that the sample routine is a good" sampler. P_NUM X^2 X*Y Y^2 1 0.147506 0.079724 0.043090 2 0.049564 0.057661 0.172511 4 0.019948 0.045569 0.155217 8 0.062862 0.029988 0.039159 16 0.097167 0.029120 0.076485 32 0.094558 0.051861 0.109623 64 0.078049 0.039688 0.086695 128 0.093827 0.041212 0.077718 256 0.083132 0.041190 0.081408 512 0.083301 0.040904 0.080829 1024 0.087932 0.041893 0.081633 2048 0.080998 0.040096 0.088489 4096 0.084299 0.042431 0.084108 8192 0.082765 0.040872 0.082568 16384 0.084074 0.041466 0.082637 32768 0.082918 0.041678 0.083252 65536 0.083641 0.041513 0.083138 TRIANGLE_MONTE_CARLO_TEST04 Sample using TRIANGLE_UNIT_SAMPLE_04 Integrate TRIANGLE_UNIT_INTEGRAND_03 Integration region is the unit triangle. Use an increasing number of points P_NUM. Note that the sample routine is a good" sampler. P_NUM X^2 X*Y Y^2 1 0.284322 0.072171 0.018320 2 0.043264 0.052163 0.071047 4 0.053012 0.035206 0.036651 8 0.068670 0.041385 0.058729 16 0.090512 0.048634 0.057551 32 0.084818 0.036972 0.055874 64 0.061229 0.031910 0.087366 128 0.075815 0.047763 0.091917 256 0.069315 0.037504 0.091177 512 0.092820 0.040963 0.081288 1024 0.082400 0.041395 0.084869 2048 0.085291 0.041771 0.080843 4096 0.083327 0.041779 0.083880 8192 0.083600 0.041921 0.082290 16384 0.083020 0.041940 0.083341 32768 0.082941 0.041397 0.082881 65536 0.083546 0.041817 0.083347 TRIANGLE_MONTE_CARLO_TEST05 Sample using TRIANGLE_UNIT_SAMPLE_01 Integrate TRIANGLE_INTEGRAND_USER Integration region is over a general triangle. Use an increasing number of points P_NUM. Note that the sample routine is a "bad" sampler. Triangle vertices: Row: 1 2 Col 1: 4 1 2: 8 3 3: 0 9 P_NUM 1 20.000000 97.194239 71.422622 472.336000 347.093370 255.059549 1686.773788 6023.690361 2 20.000000 85.382367 80.539093 381.640106 334.744749 329.146053 1459.267523 5655.945374 4 20.000000 94.944075 72.284064 458.921768 340.090214 264.518057 1628.024669 5846.876161 8 20.000000 89.511667 82.474506 435.767374 341.777129 369.270648 1545.108908 6013.093279 16 20.000000 61.969566 103.306511 232.564534 290.442995 567.070180 1003.482221 4596.778269 32 20.000000 78.224505 85.038379 332.501595 318.595302 387.886583 1297.152753 5552.059594 64 20.000000 80.875783 82.113985 353.257429 317.195218 360.289130 1339.379651 5412.549204 128 20.000000 81.988145 82.756634 367.020067 319.105550 370.326516 1356.114228 5410.663435 256 20.000000 80.306134 87.158790 351.852168 327.933094 411.441898 1361.027837 5688.678979 512 20.000000 80.851077 86.011847 359.780460 320.664528 408.159559 1351.174476 5516.752186 1024 20.000000 78.941600 87.266142 342.704630 320.691454 414.240260 1318.312120 5495.355394 2048 20.000000 79.844503 86.797331 350.961574 322.634466 410.035932 1343.952337 5571.775824 4096 20.000000 80.225711 86.330307 353.832261 322.690491 406.516320 1346.151134 5565.205217 8192 20.000000 80.006618 86.449499 351.048210 322.470950 407.508088 1340.667337 5553.141606 16384 20.000000 79.967438 86.546887 350.913552 322.584217 408.292311 1340.242912 5556.566675 32768 20.000000 79.957320 86.793670 350.531318 323.943997 410.032994 1346.142110 5606.314510 65536 20.000000 80.040480 86.768373 351.462079 323.907161 410.002536 1347.484391 5604.535613 TRIANGLE_MONTE_CARLO_TEST06 Sample using TRIANGLE_UNIT_SAMPLE_02 Integrate TRIANGLE_INTEGRAND_USER Integration region is over a general triangle. Use an increasing number of points P_NUM. Note that the sample routine is a "good" sampler. Triangle vertices: Row: 1 2 Col 1: 4 1 2: 8 3 3: 0 9 P_NUM 1 20.000000 58.967979 72.652444 173.861127 214.208389 263.918879 631.571788 2294.261691 2 20.000000 40.705226 135.942745 83.572435 275.477566 926.007927 563.162808 3802.954020 4 20.000000 69.678740 98.181225 271.724976 316.623494 513.762664 1121.185908 5097.439093 8 20.000000 83.979258 82.298038 392.983178 301.018965 417.340499 1274.084323 5254.776271 16 20.000000 88.711465 82.534126 454.573814 331.880975 374.336624 1610.474146 6045.806459 32 20.000000 79.429978 91.604344 371.656197 322.174311 475.333609 1410.986877 5868.160860 64 20.000000 77.412556 87.624103 350.523745 303.485959 438.329525 1286.504536 5176.509318 128 20.000000 82.691136 85.808263 404.857100 310.995533 426.034196 1428.945307 5535.001081 256 20.000000 77.771304 87.819526 362.162682 292.503945 454.504576 1261.846011 4927.094017 512 20.000000 80.271170 86.776192 373.730223 309.665530 432.289972 1340.370284 5348.952041 1024 20.000000 79.048601 88.037498 366.707696 306.825413 444.865477 1323.103308 5278.327010 2048 20.000000 79.988334 87.524897 373.688943 310.698290 439.183629 1351.568674 5418.437812 4096 20.000000 80.774206 86.736225 380.333327 310.071113 433.591120 1361.898904 5407.919414 8192 20.000000 79.556093 87.225775 371.228115 305.316776 439.816879 1325.901479 5260.848022 16384 20.000000 79.851683 86.652127 372.230051 305.879995 433.312908 1327.778233 5268.759990 32768 20.000000 80.042339 86.778644 374.313953 306.788685 434.898166 1337.144467 5306.655693 65536 20.000000 80.032356 86.752856 373.661085 307.078277 434.068560 1335.674252 5308.925484 TRIANGLE_MONTE_CARLO_TEST07 Sample using TRIANGLE_UNIT_SAMPLE_03 Integrate TRIANGLE_INTEGRAND_USER Integration region is over a general triangle. Use an increasing number of points P_NUM. Note that the sample routine is a "good" sampler. Triangle vertices: Row: 1 2 Col 1: 4 1 2: 8 3 3: 0 9 P_NUM 1 20.000000 88.669350 110.426256 393.112685 489.571221 609.697906 2170.498109 11983.999037 2 20.000000 43.632741 119.926741 99.032688 263.484219 720.009683 601.894953 3661.904601 4 20.000000 62.748854 114.514340 242.099300 300.892264 731.719966 991.222316 4748.396080 8 20.000000 80.125997 89.854127 361.939759 329.824037 452.293312 1404.070882 5976.057371 16 20.000000 84.386135 84.484225 423.957975 313.847425 413.433728 1473.606313 5615.332630 32 20.000000 82.977482 87.435971 411.450205 308.173156 450.323854 1412.130259 5444.036026 64 20.000000 76.472823 91.596516 348.570099 303.445670 481.882736 1283.262660 5199.045088 128 20.000000 76.683327 86.649108 344.065154 294.526677 433.680739 1236.376800 4909.728782 256 20.000000 78.381667 90.519249 366.921463 306.076582 477.362960 1326.959914 5340.237222 512 20.000000 77.667532 89.360752 356.577746 305.769288 456.280333 1302.142706 5247.907617 1024 20.000000 79.454448 87.083192 368.394861 306.384859 435.370927 1319.027486 5252.151999 2048 20.000000 80.531299 86.614624 377.072240 309.852592 430.931921 1351.914537 5379.308475 4096 20.000000 79.368832 87.243541 368.114248 305.714164 438.941932 1317.747964 5253.697288 8192 20.000000 79.491966 86.856867 369.484117 304.480836 436.777965 1316.933878 5234.628877 16384 20.000000 80.148563 86.522049 374.591801 306.657523 432.019703 1335.077871 5291.458560 32768 20.000000 80.011737 86.626509 373.432102 306.540914 433.113547 1333.167214 5290.330788 65536 20.000000 80.139251 86.635576 374.638285 307.132121 432.807611 1337.472933 5305.515287 TRIANGLE_MONTE_CARLO_TEST08 Sample using TRIANGLE_UNIT_SAMPLE_04 Integrate TRIANGLE_INTEGRAND_USER Integration region is over a general triangle. Use an increasing number of points P_NUM. Note that the sample routine is a "good" sampler. Triangle vertices: Row: 1 2 Col 1: 4 1 2: 8 3 3: 0 9 P_NUM 1 20.000000 39.019718 129.068773 76.126921 251.811358 832.937408 491.280412 3170.447997 2 20.000000 75.389542 74.908009 286.133911 281.406623 281.029412 1064.468255 3966.534928 4 20.000000 71.343949 98.526664 314.604396 318.577977 532.028841 1327.525802 5886.756074 8 20.000000 80.528707 87.609736 361.887808 323.519587 426.474886 1329.552435 5576.336867 16 20.000000 79.060794 89.541298 367.361547 307.449444 479.269319 1289.404378 5319.630516 32 20.000000 75.307248 92.664477 335.777940 311.518750 480.380989 1294.927092 5511.306817 64 20.000000 81.563539 91.067308 390.812985 327.810079 465.630923 1467.510656 5949.129611 128 20.000000 80.297706 84.148448 361.007414 309.249983 403.239077 1311.186046 5277.604788 256 20.000000 79.376889 86.448120 367.198208 304.700768 430.492024 1312.229902 5211.592462 512 20.000000 77.127418 88.704770 353.069727 297.315432 459.303172 1255.880062 5013.153713 1024 20.000000 79.017522 87.220750 367.218399 302.175026 440.461306 1302.607888 5145.972060 2048 20.000000 78.682843 88.458869 366.261938 304.548818 452.167163 1315.425864 5247.117595 4096 20.000000 79.628735 86.814665 370.984183 304.393086 436.244718 1317.903093 5213.649535 8192 20.000000 80.162791 86.395851 374.456239 306.352502 430.992188 1334.166046 5282.209414 16384 20.000000 80.647105 86.271562 378.903541 308.309113 428.948221 1350.894556 5349.391294 32768 20.000000 79.812913 86.813000 371.834292 306.377129 434.664255 1328.881742 5283.001807 65536 20.000000 80.083460 86.591833 373.757984 307.080497 432.310660 1335.838784 5307.980477 triangle_monte_carlo_test(): Normal end of execution. 08-Jan-2022 10:39:20