Wolfram Research

Function Repository Resource:

RealEuclideanDistance

Source Notebook

Get the Euclidean distance between two real vectors without using absolute value

Contributed by: Ed Pegg Jr

ResourceFunction["RealEuclideanDistance"][u,v]

gives the Euclidean distance between real vectors u and v without using Abs.

Examples

Basic Examples

Compute the real Euclidean distance between two points:

In[1]:=
ResourceFunction["RealEuclideanDistance"][{0, 0}, {x, y}]
Out[1]=

Compute in three dimensions:

In[2]:=
ResourceFunction["RealEuclideanDistance"][{0, 0, 0}, {x, y, z}]
Out[2]=

Using numeric values:

In[3]:=
ResourceFunction["RealEuclideanDistance"][{1, 4, -3}, {2, -2, 6}]
Out[3]=

Properties and Relations

EuclideanDistance adds Abs for variables and complicated expressions, making them more complicated. Often, that extra complication will make Simplify more difficult:

In[4]:=
EuclideanDistance[{0, 0}, {x, y}]
Out[4]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Resource History

License Information