• incanter

# minkowski-distance

## incanter.stats

• (minkowski-distance a b p)
http://en.wikipedia.org/wiki/Minkowski_distance
http://en.wikipedia.org/wiki/Lp_space

The Minkowski distance is a metric on Euclidean space which can be considered as a generalization of both the Euclidean distance and the Manhattan distance.

Minkowski distance is typically used with p being 1 or 2. The latter is the Euclidean distance, while the former is sometimes known as the Manhattan distance.

In the limiting case of p reaching infinity we obtain the Chebyshev distance.

### Source incanter/stats.clj:2931 top

```(defn minkowski-distance
"http://en.wikipedia.org/wiki/Minkowski_distance
http://en.wikipedia.org/wiki/Lp_space

The Minkowski distance is a metric on Euclidean space which can be considered as a generalization of both the Euclidean distance and the Manhattan distance.

Minkowski distance is typically used with p being 1 or 2. The latter is the Euclidean distance, while the former is sometimes known as the Manhattan distance.

In the limiting case of p reaching infinity we obtain the Chebyshev distance."
[a b p]
(let [_ (assert (= (count a) (count b)))]

(pow
(apply
tree-comp-each
+
(fn [[x y]]
(pow
(abs
(- x y))
p))
(map vector a b))
(/ 1 p))))```
Vars in incanter.stats/minkowski-distance: + - / apply defn fn let map vector
Used in 0 other vars