08-Oct-2025 12:18:01 permutation_distance_test(): MATLAB/Octave version 6.4.0 Test permutation_distance() Graphics saved as "permutation_distance_histogram.png" permutation_distance_stats_test(): Test permutation_distance_stats(). Using N = 1000 sample permutations. Permutation order is M Compute mean and variance of Ulam permutation distance. M Mean Predicted Variance 1 0 -1 0 2 0.488 -0.11486 0.250106 3 1.015 0.0299442 0.34512 4 1.553 0.0453884 0.411603 5 2.221 0.201604 0.486646 6 2.87 0.258215 0.56967 7 3.57 0.348889 0.5997 8 4.228 0.34042 0.684701 9 4.913 0.346058 0.762193 10 5.612 0.349932 0.818274 11 6.436 0.509855 0.886791 12 7.108 0.440167 0.909245 13 7.923 0.552565 0.925997 14 8.737 0.648683 0.990822 15 9.426 0.566358 1.03756 16 10.217 0.609808 1.03294 17 10.941 0.556436 1.05257 18 11.789 0.656023 1.16965 19 12.575 0.667249 1.14152 20 13.402 0.723748 1.23363 21 14.094 0.602395 1.24441 22 15.002 0.748483 1.27527 23 15.761 0.701025 1.30919 24 16.637 0.794696 1.3666 25 17.438 0.789766 1.25942 26 18.263 0.810046 1.55138 27 19.09 0.828421 1.48939 28 19.967 0.90389 1.43134 29 20.712 0.814088 1.43649 30 21.59 0.883008 1.45736 31 22.415 0.883896 1.56634 32 23.181 0.81033 1.50975 33 24.073 0.885849 1.74542 34 24.955 0.945996 1.69667 35 25.8 0.95874 1.73974 36 26.537 0.839815 1.73036 37 27.465 0.946412 1.64042 38 28.229 0.855194 1.60817 39 29.255 1.07258 1.63761 40 30.059 1.02422 1.80132 Graphics saved as "permutation_distance_stats.png" permutation_distance_ulam(): permutation_distance_ulam() computes the Ulam metric distance between two permutations of (1,...,N). Permutation P1 1 2 3 4 5 6 7 8 9 10 10 6 1 8 5 9 7 4 3 2 Permutation P2 1 2 3 4 5 6 7 8 9 10 9 5 10 6 4 7 1 2 3 8 Permutation P3 1 2 3 4 5 6 7 8 9 10 8 3 10 1 4 6 2 9 7 5 K(P1,P1) should be 0. K(P1,P1) = 0 K(P1,P2) should equal K(P2,P1). K(P1,P2) = 6 K(P2,P1) = 6 K(P1,P3) <= K(P1,P2) + K(P2,P3). K(P1,P3) = 6 K(P1,P2) = 6 K(P2,P3) = 7 K(P1,P2) + K(P2,P3) = 13 permutation_distance_test(): Normal end of execution. 08-Oct-2025 12:18:41