[ home ] [ math / cs / ai / phy / as / chem / bio / geo ] [ civ / aero / mech / ee / hdl / os / dev / web / app / sys / net / sec ] [ med / fin / psy / soc / his / lit / lin / phi / arch ] [ off / vg / jp / 2hu / tc / ts / adv / hr / meta / tex ] [ chat ] [ wiki ]

/math/ - Mathematics


Name
Email
Subject
Comment
Verification
Instructions:
  • Press the Get Captcha button to get a new captcha
  • Find the correct answer and type the key in TYPE CAPTCHA HERE
  • Press the Publish button to make a post
  • Incorrect answer to the captcha will result in an immediate ban.
File
Password (For file deletion.)

25 Dec 2021Mathchan is launched into public

3 / 2 / 2 / ?

File: image.png ( 736.33 KB , 800x647 , 1643053076107.png )

Image
What the heck is a Euclid distance? Why is it different from the Minsk distance and Cosine distance?
If i have a matrix as so, i'm expected to make all three distance matrices from it

X=[02203151] X = \begin{bmatrix} 0 & 2 \\ 2 & 0 \\ 3 & 1 \\ 5 & 1 \end{bmatrix}


Also this probably has something to do with statistics idk
>>
>>113
Cosine similarity is
k=1nxkykk=1nxk2k=1nyk2\frac{\sum_{k=1}^n x_ky_k}{\sqrt{\sum_{k=1}^n x_k^2}\cdot\sqrt{\sum_{k=1}^n y_k^2}}


Minkowski distance is
(k=1nxkykp)1p\left(\sum_{k=1}^n|x_k - y_k|^p\right)^\frac{1}{p}


Euclidean distance is a speacial case of Minkowski distance when
p=2p=2
i.e.
k=1n(xkyk)2\sqrt{\sum_{k=1}^n (x_k - y_k)^2}



Your matrix is
XX
means:
[x1y1x2y2x3y3x4y4]\begin{bmatrix} x_1 & y_1\\x_2 & y_2\\x_3 & y_3\\x_4 & y_4\\\end{bmatrix}
>>

File: image.png ( 891.54 KB , 707x1000 , 1643060754913.png )

Image
>>113
I'm a dumbass, it's actually minkowski distance

Anyways, for the euclidian distance, apparently you do:
(x1y1)2+(x2y2)2\sqrt{ (x_1-y_1)^2+(x_2-y_2)^2}

or for those playing along in calc,
=SQRT((B$3-B3)^2+(C$3-C3)^2)
and apply to the appropriate cells.

[0.02.83.25.12.80.01.43.23.21.40.02.05.13.22.00.0] \begin{bmatrix} 0.0 & 2.8&3.2&5.1\\ 2.8&0.0&1.4&3.2\\ 3.2&1.4&0.0&2.0\\ 5.1&3.2&2.0&0.0 \end{bmatrix}


Since i was working in calc, the table containing the data spans over the
B3:C6
range

Then, for the minkowski distance, there's something called the P value, and if it's equal to 1, then it becomes the manhattan distance, so in this example the equation would be
x1y1 + x2y2|x1-y1|\ +\ |x2-y2|

and the corresponding calc formula for a particular cell (i'm not saying which one hehe)
=(($B$3-$B3)^1+($C$3-$C3)^1)^(1/RIGHT($E$14,1))


[0024002422024420]\begin{bmatrix} 0&0&2&4\\0&0&2&4\\-2&-2&0&2\\-4&-4&-2&0 \end{bmatrix}



And for the cosine similarity or distance idk, just do a vector dot product
xyxy\frac{x \cdot y}{|x|\cdot|y|}

This time it was a bit more difficult in calc, and the formula for the left upper cell is
=SUMPRODUCT(B$3:C$3,B3:C3)/(SQRT(SUMSQ(B$3:C$3))*SQRT(SUMSQ(B3:C3)))


[1.000.000.320.200.001.000.950.980.320.951.000.990.200.980.991.00]\begin{bmatrix} 1.00&0.00&0.32&0.20\\0.00&1.00&0.95&0.98\\0.32&0.95&1.00&0.99\\0.20&0.98&0.99&1.00\\ \end{bmatrix}



Cool.
>>
>>114
Thanks for the info. I probably made some mistake here but it's probably good