({{, (RefLink[BinaryDistance, paclet:ref/BinaryDistance])[u,v]
 gives the binary distance between vectors u and v, equal to 0 if they are identical and 1 otherwise.}})

OpenersNotesSection(Spacer1)Details

(RefLink[BinaryDistance, paclet:ref/BinaryDistance])[u,v] is equivalent to (RefLink[Boole, paclet:ref/Boole])[!u==v].

OpenersPrimaryExamplesSection(Spacer1)Examples  (11)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Binary distance between numeric vectors:

BinaryDistance[{1,2,3},{2,4,6}]

Binary distance between two identical symbolic vectors:

BinaryDistance[{a,b,c},{a,b,c}]

OpenersExampleSection1(Spacer1)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}]

OpenersExampleSection3(Spacer1)Applications  (1)

Cluster data using (RefLink[BinaryDistance, paclet:ref/BinaryDistance]):

FindClusters[{{2,3},{5,10},{4,5},{2,3}},DistanceFunction->BinaryDistance]

OpenersExampleSection4(Spacer1)Properties & Relations  (3)

Approximate numbers may be considered identical:

BinaryDistance[1,1.]

(RefLink[BinaryDistance, paclet:ref/BinaryDistance]) is effectively related to (RefLink[Equal, paclet:ref/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]

OpenersExampleSection5(Spacer1)Possible Issues  (1)

The returned distance may not be completely simplified:

BinaryDistance[{Gamma[x] Gamma[1 - x]},{π Csc[π x]}]

Simplify the result further:

FullSimplify[%]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[EuclideanDistance, paclet:ref/EuclideanDistance])  ▪  (RefLink[Norm, paclet:ref/Norm])  ▪  (RefLink[GroupBy, paclet:ref/GroupBy])  ▪  (RefLink[Unitize, paclet:ref/Unitize])  ▪  (RefLink[Boole, paclet:ref/Boole])  ▪  (RefLink[Equal, paclet:ref/Equal])  ▪  (RefLink[Unequal, paclet:ref/Unequal])  ▪  (RefLink[SameQ, paclet:ref/SameQ])  ▪  (RefLink[MatchingDissimilarity, paclet:ref/MatchingDissimilarity])  ▪  (RefLink[ContainsAll, paclet:ref/ContainsAll])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Partitioning Data into Clusters, paclet:tutorial/PartitioningDataIntoClusters])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Distance and Similarity Measures, paclet:guide/DistanceAndSimilarityMeasures])}})}})