11 May 2014 08:31:29 AM HYPERSPHERE_PROPERTIES_PRB: C++ version Test the HYPERSPHERE_PROPERTIES library. 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 6.93889e-18 2 5.92859e-17 2 1.69136e-17 2 2.81004e-16 2 5.82167e-17 2 6.7318e-16 3 0 3 0 3 6.20634e-17 3 1.24127e-16 3 1.57009e-16 4 1.77722e-16 4 1.04083e-17 4 1.57009e-16 4 1.80445e-16 4 1.57009e-16 5 1.24127e-16 5 4.55225e-16 5 2.66945e-16 5 1.27381e-16 5 6.20634e-17 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.770686 0.637215 Random hypersphere point: -0.666173 -0.745798 Random hypersphere point: -0.950157 0.311771 Random hypersphere point: 0.0262807 -0.894727 0.44584 Random hypersphere point: -0.1243 0.169395 0.977678 Random hypersphere point: 0.14063 -0.21901 0.965535 Random hypersphere point: 0.527168 -0.323123 -0.46844 0.63107 Random hypersphere point: -0.0632185 0.585015 -0.748625 -0.305485 Random hypersphere point: -0.753564 0.225138 -0.504373 -0.356457 Random hypersphere point: 0.0552638 -0.764025 0.225495 0.523923 -0.296426 Random hypersphere point: -0.300054 0.355691 -0.184445 -0.812472 -0.298865 Random hypersphere point: 0.113546 -0.224028 -0.233026 -0.926416 0.156113 TEST03: HYPERSPHERE_01_AREA evaluates the area of the unit hypersphere in M dimensions. M 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 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 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 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.5 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 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 5.55112e-17 2 1.11022e-16 2 1.11022e-16 2 0 2 0 3 7.97973e-17 3 1.24127e-16 3 2.96348e-16 3 1.57009e-16 3 1.67111e-16 4 1.35974e-16 4 1.11022e-16 4 2.00148e-16 4 1.38778e-16 4 2.02064e-16 5 1.01032e-16 5 5.55112e-17 5 2.0015e-16 5 1.38778e-17 5 7.47342e-17 HYPERSPHERE_PROPERTIES_PRB: Normal end of execution. 11 May 2014 08:31:29 AM