BinaryDistance[u,v]
gives the binary distance between vectors u and v, equal to 0 if they are identical and 1 otherwise.
BinaryDistance
BinaryDistance[u,v]
gives the binary distance between vectors u and v, equal to 0 if they are identical and 1 otherwise.
Details
- BinaryDistance[u,v] is equivalent to Boole[!uv].
Examples
open all close allBasic Examples (2)
Scope (4)
Compute distance between arbitrary expressions:
BinaryDistance["text", {1, 2, 3}]Binary distance between numeric vectors of different length:
BinaryDistance[{1, 2, 3}, {1, 2}]Binary distance between symbolic inputs:
BinaryDistance[a, b]Binary distance between two vectors:
BinaryDistance[{a, b, c}, {x, y, z}]Applications (1)
Cluster data using BinaryDistance:
FindClusters[{{2, 3}, {5, 10}, {4, 5}, {2, 3}}, DistanceFunction -> BinaryDistance]Properties & Relations (3)
Approximate numbers may be considered identical:
BinaryDistance[1, 1.]BinaryDistance is effectively related to Equal:
BinaryDistance[1, 1.] == Boole[Not[1 == 1.]]Demonstrate the triangle inequality:
d1 = BinaryDistance[{a, b}, {a, c}]d2 = BinaryDistance[{a, c}, {d, c}]d3 = BinaryDistance[{a, b}, {d, c}]Simplify[d3 ≤ d1 + d2]Tech Notes
Related Guides
History
Text
Wolfram Research (2015), BinaryDistance, Wolfram Language function, https://reference.wolfram.com/language/ref/BinaryDistance.html.
CMS
Wolfram Language. 2015. "BinaryDistance." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/BinaryDistance.html.
APA
Wolfram Language. (2015). BinaryDistance. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/BinaryDistance.html
BibTeX
@misc{reference.wolfram_2026_binarydistance, author="Wolfram Research", title="{BinaryDistance}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/BinaryDistance.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_binarydistance, organization={Wolfram Research}, title={BinaryDistance}, year={2015}, url={https://reference.wolfram.com/language/ref/BinaryDistance.html}, note=[Accessed: 13-June-2026]}