CosineDistance[u,v]
gives the angular cosine distance between vectors u and v.
CosineDistance
CosineDistance[u,v]
gives the angular cosine distance between vectors u and v.
Details
- CosineDistance[u,v] is equivalent to 1-u.v*/(Norm[u]Norm[v]). »
Examples
open all close allBasic Examples (2)
Scope (2)
Applications (1)
Properties & Relations (3)
Cosine distance includes a dot product scaled by norms:
CosineDistance[{a, b, c}, {x, y, z}]1 - {a, b, c}.Conjugate[{x, y, z}] / (Norm[{a, b, c}]Norm[{x, y, z}])Cosine distance includes a dot product scaled by Euclidean distances from the origin:
u = {a, b, c};
v = {x, y, z};scale = (EuclideanDistance[u, {0, 0, 0}]EuclideanDistance[v, {0, 0, 0}])CosineDistance[u, v] == 1 - u.Conjugate[v] / scaleCosineDistance of vectors shifted by their means is equivalent to CorrelationDistance:
u = {a, b, c};
v = {x, y, z};CosineDistance[u - Mean[u], v - Mean[v]] == CorrelationDistance[u, v]Tech Notes
Related Guides
History
Text
Wolfram Research (2007), CosineDistance, Wolfram Language function, https://reference.wolfram.com/language/ref/CosineDistance.html.
CMS
Wolfram Language. 2007. "CosineDistance." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CosineDistance.html.
APA
Wolfram Language. (2007). CosineDistance. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CosineDistance.html
BibTeX
@misc{reference.wolfram_2026_cosinedistance, author="Wolfram Research", title="{CosineDistance}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/CosineDistance.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_cosinedistance, organization={Wolfram Research}, title={CosineDistance}, year={2007}, url={https://reference.wolfram.com/language/ref/CosineDistance.html}, note=[Accessed: 12-June-2026]}