({{, (RefLink[ChessboardDistance, paclet:ref/ChessboardDistance])[u,v]
gives the chessboard, Chebyshev, or sup norm distance between vectors u and v.}})

OpenersNotesSection(Spacer1)Details

(RefLink[ChessboardDistance, paclet:ref/ChessboardDistance])[u,v] is equivalent to (RefLink[Max, paclet:ref/Max])[(RefLink[Abs, paclet:ref/Abs])[u-v]]. »

OpenersPrimaryExamplesSection(Spacer1)Examples  (10)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

The chessboard distance between two vectors:

ChessboardDistance[{a,b,c},{x,y,z}]

Chessboard distance between numeric vectors:

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

OpenersExampleSection1(Spacer1)Scope  (2)

Compute the distance between any vectors of equal length:

ChessboardDistance[RandomReal[5,100],RandomReal[5,100]]

Compute the distance between vectors of any precision:

ChessboardDistance[N[{1,5,2,3,10},50],N[{4,15,20,5,5},50]]

OpenersExampleSection3(Spacer1)Applications  (1)

Cluster data using chessboard distance:

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

OpenersExampleSection4(Spacer1)Properties & Relations  (5)

Chessboard distance is the maximum of absolute differences:

ChessboardDistance[{a,b,c},{x,y,z}]

Max[Abs[{a,b,c}-{x,y,z}]]

Demonstrate the triangle inequality:

d1=ChessboardDistance[{a,b},{a,c}]

d2=ChessboardDistance[{a,c},{d,c}]

d3=ChessboardDistance[{a,b},{d,c}]

Simplify[d3<=d1+d2]

(RefLink[ChessboardDistance, paclet:ref/ChessboardDistance]) is equivalent to a (RefLink[Norm, paclet:ref/Norm]) of a difference:

ChessboardDistance[{a,b,c},{x,y,z}]

Norm[{a,b,c}-{x,y,z},Infinity]

(RefLink[ChessboardDistance, paclet:ref/ChessboardDistance]) is less than or equal to (RefLink[ManhattanDistance, paclet:ref/ManhattanDistance]):

u={a,b,c};
v={x,y,z};

Simplify[ChessboardDistance[u,v]≤ManhattanDistance[u,v]]

(RefLink[ChessboardDistance, paclet:ref/ChessboardDistance]) is less than or equal to (RefLink[EuclideanDistance, paclet:ref/EuclideanDistance]):

u={a,b,c};
v={x,y,z};

Simplify[ChessboardDistance[u,v]≤EuclideanDistance[u,v]]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[ManhattanDistance, paclet:ref/ManhattanDistance])  ▪  (RefLink[EuclideanDistance, paclet:ref/EuclideanDistance])  ▪  (RefLink[SquaredEuclideanDistance, paclet:ref/SquaredEuclideanDistance])  ▪  (RefLink[BrayCurtisDistance, paclet:ref/BrayCurtisDistance])  ▪  (RefLink[CanberraDistance, paclet:ref/CanberraDistance])  ▪  (RefLink[CornerNeighbors, paclet:ref/CornerNeighbors])}})}})

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

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