sequence function: distance
description:
distance(ket, ket)
the Euclidean distance function
the algorithm:
r = sqrt((x1 - y1)^2 + (x2 - y2)^2 + ... + (xn - yn)^2 )
examples:
-- without categories:
distance(|0: 0>, |0: 7>)
|number: 7>
-- using categories, and a Pythagorean triple:
distance(|grid: 0: 0>, |grid: 3: 4>)
|number: 5>
-- if categories are different, return don't know ket:
distance(|grid: 0: 0>, |position: 3: 4>)
|>
-- another Pythagorean triple:
distance(|grid: 0: 0>, |grid: 5: 12>)
|number: 13>
-- sqrt(2):
distance(|0: 0>, |1: 1>)
|number: 1.414>
distance(|0: 0>, |1: 2>)
|number: 2.236>
see also:
simm
future:
maybe change the number of decimal points in the result, currently set to 3
maybe remove the number prefix too?
Home