17-Dec-2022 17:32:19 hypersphere_test(): MATLAB/Octave version 4.2.2 Test hypersphere(). hypersphere_test01(): Test the coordinate conversion routines: cartesian_to_hypersphere(): X -> R,Theta hypersphere_to_cartesian(): R,Theta -> X. Pick a random X, and compute X2 by converting X to hypersphere and back. Consider norm of difference. M | X - X2 | 1 0 1 0 1 0 1 0 1 0 1x -0.37631 -0.34463 2r 0.51027 3theta 0 4theta 0 5theta 0 6top 0.13397 7theta -2.4001 2 0 1x -0.161535 -0.074395 2r 0.17784 3theta 0 4theta 0 5theta 0 6top 0.016308 7theta -2.7100 2 5.55112e-17 1x -0.093687 0.086719 2r 0.12766 3theta 0 4theta 0 5theta 0 6top 0.033974 7theta 2.3948 2 1.38778e-17 1x -0.59127 0.15743 2r 0.61187 3theta 0 4theta 0 5theta 0 6top 0.020600 7theta 2.8814 2 3.92523e-16 1x 0.68214 -0.57869 2r 0.89454 3theta 0 4theta 0 5theta 0 6top 1.5767 7theta -0.70353 2 5.55112e-17 1x 0.85382 -0.71046 0.43425 2r 1.1926 3theta 0.50475 0.00000 4theta 0.69332 0.00000 5theta 0.77285 0.00000 6top 0.12220 7theta 0.77285 2.59296 3 4.62986e-16 1x 0.229615 0.065810 0.387086 2r 0.45485 3theta 0.0043309 0.0000000 4theta 0.15417 0.00000 5theta 1.04163 0.00000 6top 0.45845 7theta 1.0416 1.4024 3 7.85046e-17 1x -0.0046098 -0.6350356 -0.1625192 2r 0.65552 3theta 0.40327 0.00000 4theta 0.42968 0.00000 5theta 1.57783 0.00000 6top 0.020466 7theta 1.5778 -2.8910 3 1.249e-16 1x -0.580935 -0.080247 -0.172608 2r 0.61133 3theta 0.0064395 0.0000000 4theta 0.036233 0.000000 5theta 2.82496 0.00000 6top 0.11010 7theta 2.8250 -2.0060 3 1.76089e-16 1x -0.46270 -0.26664 -0.61185 2r 0.81213 3theta 0.071099 0.000000 4theta 0.44546 0.00000 5theta 2.17698 0.00000 6top 0.40078 7theta 2.1770 -1.9818 3 1.8411e-16 1x 0.31423 0.59323 0.52151 -0.66164 2r 1.0772 3theta 0.62389 0.27197 0.00000 4theta 1.06166 0.70974 0.00000 5theta 1.27479 0.95728 0.00000 6top 1.3640 7theta 1.27479 0.95728 -0.90329 4 2.35514e-16 1x 0.13125 0.28445 -0.30484 -0.57347 2r 0.72106 3theta 0.17384 0.09293 0.00000 4theta 0.50270 0.42179 0.00000 5theta 1.38775 1.15799 0.00000 6top 0.34462 7theta 1.3877 1.1580 -2.0594 4 1.24127e-16 1x 0.342072 0.052309 -0.557336 0.157167 2r 0.67459 3theta 0.31336 0.31062 0.00000 4theta 0.33806 0.33532 0.00000 5theta 1.03900 1.48071 0.00000 6top 0.021737 7theta 1.0390 1.4807 2.8667 4 3.36805e-16 1x -7.7332e-01 2.4383e-01 3.4130e-01 -3.5074e-04 2r 0.87975 3theta 0.17594 0.11648 0.00000 4theta 0.17594 0.11649 0.00000 5theta 2.64460 0.95046 0.00000 6top 0.68260 7theta 2.6446033 0.9504607 -0.0010277 4 8.88612e-17 1x -0.095976 -0.345258 -0.810424 -0.409441 2r 0.97614 3theta 0.77599 0.65679 0.00000 4theta 0.94363 0.82443 0.00000 5theta 1.66928 1.93416 0.00000 6top 0.097557 7theta 1.6693 1.9342 -2.6738 4 2.99118e-16 1x -0.555507 -0.022309 0.115562 -0.213752 0.502802 2r 0.78800 3theta 0.059543 0.059045 0.045690 0.000000 4theta 0.31235 0.31185 0.29850 0.00000 5theta 2.35316 1.61072 1.36235 0.00000 6top 0.33260 7theta 2.3532 1.6107 1.3624 1.9728 5 2.35514e-16 1x 0.769263 0.169305 -0.739063 0.192762 -0.054012 2r 1.0985 3theta 0.61204 0.58337 0.03716 0.00000 4theta 0.61495 0.58629 0.04007 0.00000 5theta 0.79501 1.35318 2.87707 0.00000 6top 0.39295 7theta 0.79501 1.35318 2.87707 -0.27319 5 1.88758e-16 1x -0.685837 0.221614 0.481938 -0.162988 0.065572 2r 0.88466 3theta 0.30794 0.25883 0.02657 0.00000 4theta 0.31224 0.26313 0.03086 0.00000 5theta 2.45792 1.16299 0.34957 0.00000 6top 0.012696 7theta 2.45792 1.16299 0.34957 2.75909 5 1.62435e-16 1x 0.24806 0.52850 -0.24583 -0.43988 0.82573 2r 1.1299 3theta 0.53324 0.25393 0.19350 0.00000 4theta 1.21507 0.93577 0.87533 0.00000 5theta 1.34945 1.07077 1.82774 0.00000 6top 0.49571 7theta 1.3494 1.0708 1.8277 2.0603 5 2.00148e-16 1x 0.088929 0.252878 0.311422 -0.205950 0.932056 2r 1.0392 3theta 0.20335 0.13940 0.04242 0.00000 4theta 1.07208 1.00813 0.91114 0.00000 5theta 1.48512 1.32407 1.25543 0.00000 6top 0.74859 7theta 1.4851 1.3241 1.2554 1.7883 5 1.11022e-16 hypersphere_test02 hypersphere_01_surface_uniform() samples uniformly from the surface of the unit hypersphere Random hypersphere point: -1 Random hypersphere point: -1 Random hypersphere point: -1 Random hypersphere point: -0.095337 -0.995445 Random hypersphere point: -0.263647 -0.964619 Random hypersphere point: -0.967009 -0.254744 Random hypersphere point: 0.581426 -0.810617 0.0695983 Random hypersphere point: -0.725226 0.506225 -0.466672 Random hypersphere point: -0.04886 -0.803468 -0.593339 Random hypersphere point: -0.856208 -0.00552127 -0.47228 -0.209355 Random hypersphere point: 0.28634 0.534439 -0.266865 -0.749111 Random hypersphere point: -0.917069 -0.174457 -0.346694 0.0913899 Random hypersphere point: -0.253001 0.22233 0.0165611 0.722547 -0.603499 Random hypersphere point: -0.0926253 0.556197 0.350163 -0.695997 -0.273934 Random hypersphere point: -0.298223 0.186119 -0.681495 0.635003 -0.0935902 hypersphere_test03(): hypersphere_01_area() evaluates the area of the unit hypersphere in M dimensions. M Exact Computed Area Area 1 2.000000 2.000000 2 6.283185 6.283185 3 12.566371 12.566371 4 19.739209 19.739209 5 26.318945 26.318945 6 31.006277 31.006277 7 33.073362 33.073362 8 32.469697 32.469697 9 29.686580 29.686580 10 25.501640 25.501640 11 20.725143 20.725143 12 16.023153 16.023153 13 11.838174 11.838174 14 8.389703 8.389703 15 5.721649 5.721649 16 3.765290 3.765290 17 2.396679 2.396679 18 1.478626 1.478626 19 0.885810 0.885810 20 0.516138 0.516138 hypersphere_test04(): hypersphere_01_volume() evaluates the area of the unit hypersphere in M dimensions. hypersphere_01_volume_values() returns some test values. M Exact Computed Volume Volume 1 2.000000 2.000000 2 3.141593 3.141593 3 4.188790 4.188790 4 4.934802 4.934802 5 5.263789 5.263789 6 5.167713 5.167713 7 4.724766 4.724766 8 4.058712 4.058712 9 3.298509 3.298509 10 2.550164 2.550164 11 1.884104 1.884104 12 1.335263 1.335263 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.082146 0.082146 19 0.046622 0.046622 20 0.025807 0.025807 hypersphere_test05(): For a hypersphere in M dimensions: hypersphere_area() computes the area; hypersphere_volume() computes the volume. Notice that both quantities eventually decrease! We use a radius of R = 1.500000 M Area Volume Area / Volume 1 2 3 0.666667 2 9.42478 7.06858 1.33333 3 28.2743 14.1372 2 4 66.6198 24.9824 2.66667 5 133.24 39.9719 3.33333 6 235.454 58.8635 4 7 376.726 80.7271 4.66667 8 554.775 104.02 5.33333 9 760.835 126.806 6 10 980.369 147.055 6.66667 11 1195.12 162.97 7.33333 12 1385.96 173.245 8 13 1535.96 177.226 8.66667 14 1632.8 174.943 9.33333 15 1670.32 167.032 10 16 1648.8 154.575 10.6667 17 1574.24 138.903 11.3333 18 1456.83 121.403 12 19 1309.13 103.353 12.6667 20 1144.19 85.8145 13.3333 hypersphere_test06(): Test the stereographic mapping: hypersphere_stereograph() maps hypersphere points to the plane. hypersphere_stereograph_inverse() inverts the mapping. Pick a random X1 on the hypersphere. Map it to a point X2 on the plane. Map it back to a point X3 on the hypersphere. Consider norm of difference. M || X1 - X3 || 2 2.77556e-17 2 6.75322e-16 2 1.24127e-16 2 1.14439e-16 2 5.97873e-16 3 1.11022e-16 3 8.77708e-17 3 1.24127e-16 3 1.12048e-16 3 2.22045e-16 4 1.66533e-16 4 7.85046e-17 4 2.86098e-17 4 1.14439e-16 4 1.67111e-16 5 2.07704e-16 5 3.388e-16 5 3.27307e-17 5 8.99383e-17 5 5.55112e-17 hypersphere_test(): Normal end of execution. 17-Dec-2022 17:32:19