Tue May 20 22:32:52 2025 square_monte_carlo_test(): python version: 3.10.12 numpy version: 1.26.4 Test square_monte_carlo(). square01_area_test(): square01_area() returns the area of the unit square. square01_area() = 1 square01_monomial_integral_test(): square01_monomial_integral() returns the integral of a monomial over the interior of the unit square in 2D. Compare with a Monte Carlo estimate. Number of sample points used is 4192 Ex Ey MC-Estimate Exact Error 4 2 0.0657924 0.0666667 0.00087 5 5 0.0274882 0.0277778 0.00029 1 5 0.0828298 0.0833333 0.0005 4 0 0.197645 0.2 0.0024 7 6 0.0176835 0.0178571 0.00017 2 5 0.0549539 0.0555556 0.0006 0 0 1 1 0 7 6 0.0176835 0.0178571 0.00017 5 5 0.0274882 0.0277778 0.00029 1 7 0.0623511 0.0625 0.00015 0 4 0.201347 0.2 0.0013 2 3 0.0820646 0.0833333 0.0013 5 5 0.0274882 0.0277778 0.00029 2 1 0.164234 0.166667 0.0024 5 6 0.023575 0.0238095 0.00023 2 7 0.0413659 0.0416667 0.0003 7 1 0.0624908 0.0625 9.2e-06 0 4 0.201347 0.2 0.0013 3 4 0.0493182 0.05 0.00068 4 5 0.0329587 0.0333333 0.00037 square01_monte_carlo_test(): Use square01_sample to estimate integrals along the interior of the unit square in 2D. N 1 X^2 Y^2 X^4 X^2Y^2 Y^4 X^6 1 1 0.924057 0.742084 0.853881 0.685728 0.550689 0.789034 2 1 0.0633216 0.288781 0.00771923 0.0258976 0.0990122 0.000958591 4 1 0.437888 0.369535 0.214884 0.132195 0.183954 0.111164 8 1 0.35767 0.350918 0.166541 0.10303 0.210124 0.0841779 16 1 0.248233 0.38513 0.11368 0.10472 0.274913 0.0636406 32 1 0.323477 0.354632 0.196814 0.118605 0.211634 0.144031 64 1 0.403975 0.333369 0.255601 0.135253 0.204559 0.19109 128 1 0.359706 0.351066 0.219203 0.129778 0.218454 0.159887 256 1 0.355283 0.357609 0.22057 0.124766 0.209868 0.15908 512 1 0.336299 0.321061 0.201415 0.11029 0.198866 0.144831 1024 1 0.336974 0.319566 0.204245 0.10869 0.189232 0.145814 2048 1 0.328865 0.324808 0.196214 0.10573 0.194406 0.139997 4096 1 0.334753 0.34119 0.202559 0.113733 0.207835 0.145776 8192 1 0.336441 0.333457 0.202067 0.110706 0.199707 0.144183 16384 1 0.340074 0.331407 0.204871 0.112002 0.197785 0.146545 32768 1 0.332901 0.331027 0.199612 0.110111 0.197913 0.142323 65536 1 0.333858 0.333028 0.200525 0.111205 0.199986 0.143337 Exact %14.6g 1.0 %14.6g 0.3333333333333333 %14.6g 0.3333333333333333 %14.6g 0.2 %14.6g 0.1111111111111111 %14.6g 0.2 %14.6g 0.14285714285714285 square01_sample_test square01_sample samples the unit square. Sample points in the unit square. Row: 0 1 Col 0 : 0.595748 0.704298 1 : 0.663021 0.534449 2 : 0.835559 0.643228 3 : 0.120352 0.435957 4 : 0.0434471 0.901757 5 : 0.665355 0.238101 6 : 0.426232 0.0800136 7 : 0.8006 0.19622 8 : 0.949216 0.566958 9 : 0.0134298 0.667262 square_monte_carlo_test(): Normal end of execution. Tue May 20 22:32:52 2025