in reply to Re: The intersection of M hyperplanes (Ndim)
in thread The intersection of M hyperplanes (Ndim)

glad for that flashback

So, I understand that if a1=0 and a2=0 then the vectors are "parallel on that axis", and so I proceed to check the other coefficients in order to determine if the planes are parallel. If one of a1 OR a2 is zero then I conclude the vectors (and the planes) are not parallel and the test can stop right there.

Replies are listed 'Best First'.
Re^3: The intersection of M hyperplanes (Ndim)
by LanX (Saint) on Jul 19, 2024 at 09:42 UTC
    Look, similar to the rule you already stated:

    taking two vectors, for them to be collinear there must exist one k != 0 such that for all coordinate d: d1 = k * d2

    Obviously d1 == 0 iff d2 == 0 because k != 0 !!!

    But if one coordinate is 0 for both it doesn't matter which k is chosen for the other ones.

    Isn't it obvious now?

    You check all coordinates in a loop and break if

    • either only one is 0 (next if both are)
    • or the ratio k is not like before (unless undef)

    Edit
    FWIW: There is one edge case left, the zero vector. But a normal vector with all coordinates being 0 looks like a bug to me and should raise an exception.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    see Wikisyntax for the Monastery

      got it, thanks LanX

      fyi, I googled it a lot before asking this particular question. "when are 2 vectors / 2 planes are parallel". What I got was lots and lots of the ratio test but not mentioning at all any of the edge cases. I finally asked here for a clarification : https://math.stackexchange.com/questions/3925150/find-if-2-planes-are-parallel-or-not, the answeree has a huge XP but fails to complete their answer with common sense question.

        FYI, like many others, I did it in "high school" for 3D but most never apply it again. (When studying Math at uni this was covered in just a week at best)

        So while most think they still master it they are quite rusted. Or reluctant like I am.°

        I'm quite confident about 3D because it's very visual. The abstraction to higher dimensions is a door I never really actively passed.

        (It's "too trivial" for mathematicians ;)

        I hope my explanation was of help, do you need the algorithm as explicit code?

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        see Wikisyntax for the Monastery

        °) instead of remembering the rules like engineers do, we tend to deduce it from basic axioms