This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

DistanceMatrix

DistanceMatrix[list]
gives a matrix of distances or dissimilarities between the elements of list.
  • The elements of list can be numeric lists, matrices, or tensors, lists of Boolean elements, or strings. All data elements must have the same dimensions.
  • The method used to compute dissimilarities can be selected with the DistanceFunction option.
  • The setting for DistanceFunction can be any distance or dissimilarity function or a pure function f defining a distance between two values.
Distance matrix for a list of numbers:
Needs["HierarchicalClustering`"]
Distance matrix for a list of numbers:
In[2]:=
Click for copyable input
Out[2]=
Distance matrix using ManhattanDistance: