本文介绍了计算4维向量之间的欧几里得距离的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设我有两个4维矢量(即a和b),如下所示:
Let's say I have two 4-dimensional vectors (i.e. a and b) as follows:
a = {a1, a2, a3, a4}
b= {b1, b2, b3, b4}
如何计算这些向量之间的欧几里得距离?
How do I compute the Euclidean distance between these vectors?
推荐答案
欧几里德距离演算与维数无关.
The euclidian distance calculus is independent of dimensions.
在您的情况下,a和b之间的欧式距离可以写为:d(a,b)= sqrt(sum_ {i = 1} ^ {4}(a [i]-b [i])^ 2).
In your case, the euclidian distance between a and b can be written as: d(a,b) = sqrt(sum_{i=1}^{4} (a[i] - b[i])^2).
或者,更具体地说:d(a,b)= sqrt((a1-b1)^ 2 +(a2-b2)^ 2 +(a3-b3)^ 2 +(a4-b4)^ 2).
Or, more specifically: d(a,b) = sqrt( (a1-b1)^2 + (a2-b2)^2 + (a3-b3)^2 + (a4-b4)^2 ).
这篇关于计算4维向量之间的欧几里得距离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!