Skip to main content
14-Alexandrite
August 10, 2021
Question

Comparing two vectors of length N - fundamental math question

  • August 10, 2021
  • 1 reply
  • 6952 views

To all

 

Not really a Mathcad specific question but a “fundamental “ math question. I know that some of the regular contributors to this forum have the expertise.

 

I am comparing 2 vectors {v1} and {v2} of length N using the formula

     [{v1}T*{v2}]^2 / [{v1}T{v1}*{v2}T{v2}] 

where T = Transpose

 

I did a check using 2 very simple vectors of length 11 so that for x = [0,1..10]

V1 = x^2 and v2 = 10*x

Using the formula I get 0.938 thus suggesting that these 2 vectors are very similar. But clearly they are not!

Has anyone got “insight” on this? It’s quite common to use this formula in some engineering field and setting-up a threshold of > 0.9 as acceptable to assume that the vectors are similar. in this case this is telling me that a stragith line is almost as good as a parabola.

 

Thanks

Regards

 

a link: here

1 reply

23-Emerald IV
August 10, 2021

I have my doubts. I created two equal vectors and did the test:

LucMeekes_0-1628591273282.png

Would this indicate they're not even nearly equal?

 

Success!
Luc

JXBWk14-AlexandriteAuthor
14-Alexandrite
August 10, 2021

My apologies I mis-typed the equation. It should read [{v1}T*{v2}]^2 / [{v1}T{v1}*{v2}T{v2}] 

I'll correct the orignal post

23-Emerald IV
August 10, 2021

I still have my doubts, but I suggest an alternative, which is simpler:

LucMeekes_0-1628592219792.png

Got the idea from: https://math.stackexchange.com/questions/1277288/what-is-the-best-way-to-see-if-vectors-are-equal

Where it says:

"You could compute the dot product of the two vectors, and if they are parallel (same direction) their dot product will be equal to the product of their individual norms."

Success!
Luc