# Last edited on 2022-10-20 18:07:23 by stolfi TEST RESULTS 120_distance The distance squared between two corners {x,y} of the canonical tetrahedron is {z = SUM{(x[c] - y[c])^2 : c \in 0..2}}, that is {z = SUM{ x[c]^2 - 2*x[c]*y[c] + y[c]^2 : c \in 0..2}}. Since the coordinates are all {±1}, that is {z(x,y) = 6 - 2*dot(x,y)}. The value of {dot(x,y)} when {x} and {y} are corners of the tetrahedron is either {3} (same corner) of {-1} (different corners). So the value of {z} is either 0 or 8. The goal is to find a formula that takes /filtered/ datums {X[i][0..2]} and {Y[i][0..2]} and gives the best possible estimate for the distance squared of the original (unfiltered) datums {z[j] = |x[j] - y[j]|^2 = SUM{(x[j][c] - y[j][c])^2 : c \in 0..2}} where {x[j],y[j]} are the datums of the original sequences that correspond to the filtered datums {X[i],Y[i]}. Tested with datum filtering weight table of 11 entries {FILTER_WEIGHTS := 2 18 105 366 774 994 774 366 105 18 2} Result: the best estimator for {z[j] = |x[j] - y[j]|^2} is about {U1(X,Y) = 6 - 4*dot(X,Y)} Since {dot} is bilinear, and {X,Y} (with non-negative smoothing weights) are convex combinations of original datum vectors, the value of {dot(X,Y)} has the same range as {dot(x,y)}, namely {-1} to {3}. Thus {U1(X,Y)} varies from Also computed the best estimator for the smoothed version {Z[i]} of the {z} signal, that is, the RMS local mean discrepancy between the two original sequences. This value too ranges between 0 and 8. Using weights DIFF_SQR_WEIGHTS := 0 0 11 133 599 988 599 133 11 0 0 to smooth the {z} signal, the best estimator for {Z} from {X,Y} turned out to be V1(X,Y) = 6 - 2.833*dot(X,Y) and 2.833 is about 17/6. This estimate ranges from When the {DIFF_SQR_WEIGHTS} weights were the same as the datum filter weights, the best estimate for {Z} mas V2(X,Y) = 6 - 2.31*dot(X,Y) 125_dm_lav_to_cdv 127_dm_chop_cands 128_dm_scramble_cands 130_dm_analyse_cdv 150_scoring 160_dm_show_alignments 180_discrim 190_candfilter 220_refining 250_extract 270_weights 330_dm_cand_view 500_simple Running dm_test_120_distance