WOLFRAM

CosineDistance[u,v]

gives the angular cosine distance between vectors u and v.

Details

Examples

open allclose all

Basic Examples  (2)Summary of the most common use cases

Cosine distance between two vectors:

Out[1]=1

Cosine distance between numeric vectors:

Out[1]=1

Scope  (2)Survey of the scope of standard use cases

Compute distance between any vectors of equal length:

Out[1]=1

Compute distance between vectors of any precision:

Out[1]=1

Applications  (1)Sample problems that can be solved with this function

Cluster data using cosine distance:

Out[1]=1

Properties & Relations  (3)Properties of the function, and connections to other functions

Cosine distance includes a dot product scaled by norms:

Out[1]=1
Out[2]=2

Cosine distance includes a dot product scaled by Euclidean distances from the origin:

Out[2]=2
Out[3]=3

CosineDistance of vectors shifted by their means is equivalent to CorrelationDistance:

Out[2]=2
Wolfram Research (2007), CosineDistance, Wolfram Language function, https://reference.wolfram.com/language/ref/CosineDistance.html.

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_2025_cosinedistance, author="Wolfram Research", title="{CosineDistance}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/CosineDistance.html}", note=[Accessed: 19-June-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_cosinedistance, organization={Wolfram Research}, title={CosineDistance}, year={2007}, url={https://reference.wolfram.com/language/ref/CosineDistance.html}, note=[Accessed: 19-June-2025 ]}