当前位置:网站首页>Distance measurement - Euclidean distance

Distance measurement - Euclidean distance

2022-06-11 10:52:00 Fanyi

Python Learning Series Catalog

 Insert picture description here

summary

Euclidean distance , Also known as Euclid distance , We started from primary school 、 Junior high school 、 Distance measurement, which is used in high school and even now .

The shortest line between two points ” Everyone has learned it , Here is just a big English name , It's the formula that we use to calculate the distance on the junior and advanced examination paper

Calculation formula

① Euclidean distance on a two-dimensional plane

hypothesis Two dimensional plane There are two points inside : a ( x 1 , y 1 ) a(x_{1},y_{1}) a(x1,y1) And b ( x 2 , y 2 ) b(x_{2},y_{2}) b(x2,y2)

Then the distance formula of the two-dimensional plane is :

d 12 = ( x 1 − x 2 ) 2 + ( y 1 − y 2 ) 2 d_{12}=\sqrt{(x_{1}-x_{2})^2+(y_{1}-y_{2})^2} d12=(x1x2)2+(y1y2)2

 Insert picture description here

for instance , Like the one above A ( 2 , 2 ) A(2,2) A(2,2) And B ( 6 , 6 ) B(6,6) B(6,6) At two o 'clock , Calculation A B AB AB The distance between two points is :
d A B = ( 6 − 2 ) 2 + ( 6 − 2 ) 2 = 4 2 + 4 2 = 4 2 \begin{aligned} d_{AB} &=\sqrt{(6-2)^2+(6-2)^2}\\ &=\sqrt{4^2+4^2}\\ &= 4\sqrt{2} \end{aligned} dAB=(62)2+(62)2=42+42=42

② Euclidean distance in three-dimensional space

hypothesis three-dimensional space There are two points inside : a ( x 1 , y 1 , z 1 ) a(x_{1},y_{1},z_{1}) a(x1,y1,z1) And b ( x 2 , y 2 , z 2 ) b(x_{2},y_{2},z_{2}) b(x2,y2,z2)

Then the distance formula of three-dimensional space is :

d 12 = ( x 1 − x 2 ) 2 + ( y 1 − y 2 ) 2 + ( z 1 − z 2 ) 2 d_{12}=\sqrt{(x_{1}-x_{2})^2+(y_{1}-y_{2})^2+(z_{1}-z_{2})^2} d12=(x1x2)2+(y1y2)2+(z1z2)2

 Insert picture description here

for instance , Like the one above A ( 0 , 0 , 4 ) A(0,0,4) A(0,0,4) And B ( 0 , 2 , 0 ) B(0,2,0) B(0,2,0) At two o 'clock , Calculation A B AB AB The distance between two points is :

d A B = ( 0 − 0 ) 2 + ( 0 − 2 ) 2 + ( 4 − 0 ) 2 = 0 + 4 + 16 = 2 5 \begin{aligned} d_{AB} &=\sqrt{(0-0)^2+(0-2)^2+(4-0)^2}\\ &=\sqrt{0+4+16}\\ &= 2\sqrt{5} \end{aligned} dAB=(00)2+(02)2+(40)2=0+4+16=25

③ n Euclidean distance in dimensional space

hypothesis n Dimensional space There are two points inside : a ( x 11 , x 12 , . . . , x 1 n ) a(x_{11},x_{12},...,x_{1n}) a(x11,x12,...,x1n) And b ( x 21 , y 22 , . . . , z 2 n ) b(x_{21},y_{22},...,z_{2n}) b(x21,y22,...,z2n)

be n The distance formula of dimensional space is :

d 12 = ∑ k = 1 n ( x 1 k − x 2 k ) 2 d_{12}=\sqrt{\sum_{k=1}^n(x_{1k}-x_{2k})^2} d12=k=1n(x1kx2k)2

Empathy ,n Dimensional space is also , Do the above operations on the corresponding vector .(n Wei's painting doesn't come out , Need to be expressed in other forms , Just like the picture below ).

 Insert picture description here

 Insert picture description here

原网站

版权声明
本文为[Fanyi]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206111041505258.html