Home License -- for personal use only. Not for government, academic, research, commercial, or other organizational use. 06-Nov-2026 17:07:01 montecarlo_partition_test(): MATLAB/Octave version 9.11.0.2358333 (R2021b) Update 7 Test montecarlo_partition(). Estimate the area of the quarter circle of radius 0.500000 True area: 0.1963505.8 Graphics saved as "problem1.png" Method 1: inside or outside n estimate error error*sqrt(n) 10 0.200000 3.650459e-03 1.154377e-02 100 0.195000 -1.349541e-03 -1.349541e-02 1000 0.193500 -2.849541e-03 -9.011039e-02 10000 0.194775 -1.574541e-03 -1.574541e-01 100000 0.195853 -4.970408e-04 -1.571781e-01 True area: 0.1963505.8 Method 2: average value n estimate error error*sqrt(n) 10 0.185251 -1.109864e-02 -3.509700e-02 100 0.192966 -3.383449e-03 -3.383449e-02 1000 0.196111 -2.381692e-04 -7.531571e-03 10000 0.195213 -1.136565e-03 -1.136565e-01 100000 0.196177 -1.723074e-04 -5.448839e-02 Function quad gives an error of -0.000448 with 13 function evaluations The area estimates: 0.162500 from Method 1 and 0.173533 from Method 2. problem2(): Estimate the area of a quarter circle of radius 0.5 using importance sampling. Monte Carlo Importance Sampling n estimate error error*sqrt(n) estimate error error*sqrt(n) 10 0.185251 1.109864e-02 0.035097 0.201020 4.670227e-03 0.014769 100 0.192966 3.383449e-03 0.033834 0.197374 1.024084e-03 0.010241 1000 0.196111 2.381692e-04 0.007532 0.196337 1.217123e-05 0.000385 10000 0.195213 1.136565e-03 0.113657 0.196175 1.748613e-04 0.017486 100000 0.196177 1.723074e-04 0.054488 0.196364 1.441943e-05 0.004560 Graphics saved as "problem2.png" The area estimate from the figure are 0.192001 from Method 3. problem3(): Compare pseudorandom and quasirandom values in 6 dimensions. Graphics saved as "quasirand.png" problem4(): Use quasirandom numbers to estimate the area of a quarter circle. Compute the area of the quarter circle of radius 0.500000 True area: 0.19634954 Method 4: quasirandom Monte Carlo n estimate error error*n 10 0.211360 1.501042e-02 1.501042e-01 100 0.198840 2.490747e-03 2.490747e-01 1000 0.196650 3.001461e-04 3.001461e-01 10000 0.196391 4.098532e-05 4.098532e-01 100000 0.196355 5.139678e-06 5.139678e-01 problem5(): Estimate the harmonic oscillator potential partition function with several values for the number of particles. Generating quasirandom numbers. Computing estimates using 100 points. Computing estimates using 1000 points. Computing estimates using 10000 points. Computing estimates using 100000 points. Generating random numbers. Computing estimates using 100 points. Computing estimates using 1000 points. Computing estimates using 10000 points. Computing estimates using 100000 points. Estimates of Partition Function Using Quasirandom Samples n d=1 d=2 d=4 d=8 d=16 100 9.01e-01 1.21e+00 1.14e+00 5.76e-02 6.90e-05 1000 7.30e-01 6.98e-01 9.11e-01 8.76e-01 5.98e-02 10000 8.07e-01 7.74e-01 7.32e-01 6.20e-01 2.76e-01 100000 8.19e-01 8.04e-01 7.86e-01 7.55e-01 4.32e-01 Estimates of Partition Function Using Quasirandom Samples n d=1 d=2 d=4 d=8 d=16 100 8.23e-01 8.75e-01 2.91e-01 2.48e-01 2.82e+02 1000 8.16e-01 8.08e-01 8.05e-01 1.17e+00 2.83e+01 10000 8.16e-01 8.09e-01 7.99e-01 7.38e-01 2.90e+00 100000 8.16e-01 8.09e-01 8.03e-01 7.59e-01 5.34e-01 montecarlo_partition_test(): Normal end of execution. 06-Nov-2026 17:07:14