Wolfram Language & System 11.0 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)

DistanceMatrix

DistanceMatrix[{u1,u2,}]
gives the matrix of distances between each pair of elements ui, uj.

DistanceMatrix[{u1,u2,},{v1,v2,}]
gives the matrix of distances between each pair of elements ui, vj.

Details and OptionsDetails and Options

ExamplesExamplesopen allclose all

Basic Examples  (3)Basic Examples  (3)

Compute a distance matrix from a list of integers:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]//MatrixForm=

Compute a distance matrix from two lists of integers:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]//MatrixForm=

Compute a distance matrix from real-valued numerical vectors:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]//MatrixForm=
Introduced in 2015
(10.3)