cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
%3CLINGO-SUB%20id%3D%22lingo-sub-236281%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%EB%B2%A1%ED%84%B0%20%EC%99%B8%EC%A0%81%20%EA%B3%84%EC%82%B0%20%EB%B0%A9%EB%B2%95%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-236281%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%EB%AC%B8%EC%84%9C%EC%97%90%20%EB%94%B0%EB%A5%B4%EB%A9%B4%20*%20%EC%97%B0%EC%82%B0%EC%9E%90%EB%8A%94%20%EA%B5%90%EC%B0%A8%EA%B3%B1%EC%9D%84%20%EC%88%98%ED%96%89%ED%95%98%EA%B3%A0%20%3B*%EB%8A%94%20%EB%82%B4%EC%A0%81%EC%9D%84%20%EC%88%98%ED%96%89%ED%95%98%EB%8A%94%20%EA%B2%83%EC%B2%98%EB%9F%BC%20%EB%B3%B4%EC%9E%85%EB%8B%88%EB%8B%A4.%20%EB%82%98%EB%8A%94%20%EB%8B%A4%EC%9D%8C%EA%B3%BC%20%EA%B0%99%EC%9D%B4%20%EC%95%8C%EB%A0%A4%EC%A7%84%20%EB%B2%A1%ED%84%B0%20%EC%8C%8D%EC%97%90%20%EB%8C%80%ED%95%9C%20%EB%B2%A1%ED%84%B0%20%EB%B2%95%EC%84%A0%EC%9D%84%20%EA%B2%B0%EC%A0%95%ED%95%98%EA%B8%B0%20%EC%9C%84%ED%95%B4%20%EC%99%B8%EC%A0%81%EC%9D%84%20%EC%82%AC%EC%9A%A9%ED%95%98%EA%B3%A0%20%EC%8B%B6%EC%8A%B5%EB%8B%88%EB%8B%A4.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Ep1%20%3D%20%5B1%2C%202%2C%204%5D%3B%0Ap2%20%3D%20%5B2%2C%201%2C%204%5D%3B%0Ap3%20%3D%20%5B2%2C%202%2C%204%5D%3B%0A%0Av1%20%3D%20p3%20-%20p1%3B%0Av2%20%3D%20p2%20-%20p1%3B%0A%0AxProd%20%3D%20v1*v2%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E3%EA%B0%9C%EC%9D%98%20%EC%A0%90%EC%9D%80%20%ED%8F%89%EB%A9%B4%EC%9D%84%20%EC%A0%95%EC%9D%98%ED%95%98%EA%B3%A0%2C%20%ED%95%B4%EB%8B%B9%20%EC%A0%90%EC%97%90%EC%84%9C%20%EA%B0%80%EC%A0%B8%EC%98%A8%20%EB%91%90%20%EA%B0%9C%EC%9D%98%20%EB%B2%A1%ED%84%B0%EB%8A%94%20%EB%8F%99%EC%9D%BC%ED%95%9C%20%EC%97%AD%ED%95%A0%EC%9D%84%20%ED%95%98%EB%A9%B0%2C%20%EA%B5%90%EC%B0%A8%EA%B3%B1%EC%9D%80%20%ED%95%B4%EB%8B%B9%20%ED%8F%89%EB%A9%B4%EC%9D%98%20%EB%B2%95%EC%84%A0%20%EB%B2%A1%ED%84%B0%EB%A5%BC%20%EC%A0%9C%EA%B3%B5%ED%95%B4%EC%95%BC%20%ED%95%A9%EB%8B%88%EB%8B%A4.%20%EB%AC%B8%EC%A0%9C%EB%8A%94%20%EA%B3%B1%ED%95%B4%EC%A7%80%EB%8A%94%20%EB%91%90%20%ED%96%89%EB%A0%AC(v1%EA%B3%BC%20v2)%EC%9D%98%20%EC%B0%A8%EC%9B%90%EC%9D%B4%20%EC%9D%BC%EC%B9%98%ED%95%98%EC%A7%80%20%EC%95%8A%EB%8A%94%EB%8B%A4%EB%8A%94%20%EA%B2%83%EC%9E%85%EB%8B%88%EB%8B%A4.%20nRows(v1)%EB%8A%94%20nCols(v2)%EC%99%80%20%EA%B0%99%EC%95%84%EC%95%BC%20%ED%95%A9%EB%8B%88%EB%8B%A4.%20%EB%B2%A1%ED%84%B0%20%EC%99%B8%EC%A0%81%EC%97%90%20%EB%8C%80%ED%95%9C%20%EB%8B%A8%EC%88%9C%ED%99%94%EB%90%9C%20%EA%B3%B5%EC%8B%9D%EC%9D%84%20%EC%82%AC%EC%9A%A9%ED%95%98%EC%97%AC%20%EC%9D%B4%EB%A5%BC%20%EC%88%98%EB%8F%99%EC%9C%BC%EB%A1%9C%20%EA%B5%AC%ED%98%84%ED%95%A0%20%EC%88%98%20%EC%9E%88%EC%A7%80%EB%A7%8C%20%ED%96%89%EB%A0%AC%20%EA%B3%B1%EC%85%88%EC%9D%84%20%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0%20%EC%9C%84%ED%95%B4%20%EC%9D%B4%EB%A5%BC%20%EB%8B%A4%EB%A5%B4%EA%B2%8C%20%ED%98%95%EC%8B%9D%ED%99%94%ED%95%98%EB%8A%94%20%EB%B0%A9%EB%B2%95%EC%9D%84%20%EC%95%84%EB%8A%94%20%EC%82%AC%EB%9E%8C%EC%9D%B4%20%EC%9E%88%EC%8A%B5%EB%8B%88%EA%B9%8C%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-611821%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20%EB%B2%A1%ED%84%B0%20%EC%99%B8%EC%A0%81%EC%9D%84%20%EA%B3%84%EC%82%B0%ED%95%98%EB%8A%94%20%EB%B0%A9%EB%B2%95%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-611821%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%EC%97%B4%EC%95%85%ED%95%9C%20%EC%84%B1%EB%8A%A5%EC%9D%80%20%EB%86%80%EB%9D%BC%EC%9A%B4%20%EC%9D%BC%EC%9D%B4%20%EC%95%84%EB%8B%99%EB%8B%88%EB%8B%A4.%20%EB%B6%80%ED%98%B8%20%EC%A1%B0%EC%A0%95%EC%9D%84%20%EC%82%BD%EC%9E%85%ED%95%B4%20%EC%A3%BC%EC%85%94%EC%84%9C%20%EA%B0%90%EC%82%AC%ED%95%A9%EB%8B%88%EB%8B%A4.%20%EB%AC%B4%EC%8B%AC%EC%BD%94%20%22%ED%91%9C%EC%A7%80%ED%8C%90%22%EC%9D%84%20%EC%83%9D%EB%9E%B5%ED%96%88%EC%8A%B5%EB%8B%88%EB%8B%A4.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIMO%20%EC%9D%B4%EA%B2%83%EC%9D%80%20%22%ED%95%A0%20%EC%88%98%20%EC%9E%88%EB%8B%A4%EA%B3%A0%20%ED%95%B4%EC%84%9C%20%EB%B0%98%EB%93%9C%EC%8B%9C%20%ED%95%B4%EC%95%BC%20%ED%95%9C%EB%8B%A4%EB%8A%94%20%EC%9D%98%EB%AF%B8%EB%8A%94%20%EC%95%84%EB%8B%99%EB%8B%88%EB%8B%A4%22%EA%B0%80%20%EC%A0%81%EC%9A%A9%EB%90%98%EB%8A%94%20%EC%82%AC%EB%A1%80%20%EC%A4%91%20%ED%95%98%EB%82%98%EC%9E%85%EB%8B%88%EB%8B%A4...%20%7B%EB%A9%8B%EC%A7%80%EB%8B%A4%2C%20%EC%9E%AC%EB%AF%B8%EC%9E%88%EB%8B%A4%2C%20%EC%A7%A7%EB%8B%A4%7D%EB%8A%94%20%7B%EC%9D%B4%ED%95%B4%20%EA%B0%80%EB%8A%A5%ED%95%98%EB%8B%A4%2C%20%EC%9C%A0%EC%A7%80%20%EA%B4%80%EB%A6%AC%20%EA%B0%80%EB%8A%A5%ED%95%98%EB%8B%A4%2C%20%EB%B9%A0%EB%A5%B4%EB%8B%A4%7D%EB%B3%B4%EB%8B%A4%20%EC%A4%91%EC%9A%94%ED%95%98%EC%A7%80%20%EC%95%8A%EC%8A%B5%EB%8B%88%EB%8B%A4.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-611720%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20%EB%B2%A1%ED%84%B0%20%EC%99%B8%EC%A0%81%EC%9D%84%20%EA%B3%84%EC%82%B0%ED%95%98%EB%8A%94%20%EB%B0%A9%EB%B2%95%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-611720%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F3552%22%20target%3D%22_blank%22%3E%40brady_brady%3C%2FA%3E%20%EC%8B%9C%EC%9B%90%ED%95%9C!%20%EC%82%AC%EC%9A%A9%ED%95%98%EB%A0%A4%EB%A9%B4%20%EC%A1%B0%EC%A0%95%EC%9D%B4%20%ED%95%84%EC%9A%94%ED%95%A9%EB%8B%88%EB%8B%A4.%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%20i%20%3D%201%3B%0A%20j%20%3D%20-1%3B%0A%20J(%203%2C%201%2C%20(j%20*%3D%20-1)%20*%20Det(%20(v1%20%7C%7C%20v2)%5BRemove(%20%5B1%2C%202%2C%203%5D%2C%20i%2B%2B%20)%2C%200%5D%20)%20)%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%3C%2FCODE%3E%3CA%20href%3D%22https%3A%2F%2Fmathinsight.org%2Fcross_product_formula%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fmathinsight.org%2Fcross_product_formula%3C%2FA%3E%20%EC%A4%91%EA%B0%84%20%EC%9A%94%EC%86%8C%EA%B0%80%20%EC%96%B4%EB%96%BB%EA%B2%8C%20%EC%9D%8C%EC%88%98%EA%B0%80%20%EB%90%98%EC%96%B4%EC%95%BC%20%ED%95%98%EB%8A%94%EC%A7%80%20%EB%B3%B4%EC%97%AC%EC%A4%8D%EB%8B%88%EB%8B%A4.%EC%9C%84%EC%97%90%EC%84%9C%20j%EB%8A%94%20%EB%B6%80%ED%98%B8(1%2C%20-1%2C%201)%EB%A5%BC%20%EB%B2%88%EA%B0%88%EC%95%84%20%ED%91%9C%EC%8B%9C%ED%95%98%EA%B3%A0%20i%EB%8A%94%20(1%2C%202%2C%203)%20%EC%A6%9D%EA%B0%80%ED%95%A9%EB%8B%88%EB%8B%A4.%20J(...)%20%ED%95%A8%EC%88%98%EC%97%90%EB%8A%94%20%EA%B0%81%20%EC%9A%94%EC%86%8C%EC%9D%98%20%EC%84%B8%20%EB%B2%88%EC%A7%B8%20%EC%9D%B8%EC%88%98%EB%A5%BC%20%ED%8F%89%EA%B0%80%ED%95%98%EB%8A%94%20%EC%95%94%EC%8B%9C%EC%A0%81%20%EB%A3%A8%ED%94%84%EA%B0%80%20%EC%9E%88%EC%8A%B5%EB%8B%88%EB%8B%A4.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%EA%B0%84%EB%8B%A8%ED%95%98%EA%B2%8C%20%EC%88%98%EC%A0%95%EB%90%9C%20%EA%B3%B5%EC%8B%9D%EC%9D%80%20%EB%8B%A4%EC%9D%8C%EA%B3%BC%20%EA%B0%99%EC%8A%B5%EB%8B%88%EB%8B%A4.%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F11962%22%20target%3D%22_blank%22%3E%20%40klk%3C%2FA%3E%20%EC%95%BD%203%EB%B0%B0%20%EB%8D%94%20%EB%B9%A0%EB%A5%B4%EA%B3%A0%20%EC%9D%B4%ED%95%B4%ED%95%98%EA%B8%B0%20%EC%95%BD%20N%EB%B0%B0%20%EB%8D%94%20%EC%89%BD%EC%8A%B5%EB%8B%88%EB%8B%A4.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%ED%85%8C%EC%8A%A4%ED%8A%B8%20%EC%BD%94%EB%93%9C.%3C%2FP%3E%0A%3CDIV%20class%3D%22lia-spoiler-container%22%3E%3CA%20class%3D%22lia-spoiler-link%22%20href%3D%22%23%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3E%EB%8D%94%EB%B3%B4%EA%B8%B0...%3C%2FA%3E%3CNOSCRIPT%3E%3CDIV%20class%3D%22lia-spoiler-content%22%3E%3CBR%20%2F%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Ev1%20%3D%20%5B0%2C%200%2C%201%5D%3B%0Av2%20%3D%20%5B0%2C%201%2C%200%5D%3B%0A%0Astart%20%3D%20HP%20Time()%3B%0AFor(%20t%20%3D%201%2C%20t%20%26lt%3B%201e6%2C%20t%20%2B%3D%201%2C%0A%20i%20%3D%201%3B%0A%20j%20%3D%20-1%3B%0A%20J(%203%2C%201%2C%20(j%20*%3D%20-1)%20*%20Det(%20(v1%20%7C%7C%20v2)%5BRemove(%20%5B1%2C%202%2C%203%5D%2C%20i%2B%2B%20)%2C%200%5D%20)%20)%3B%0A)%3B%0Astop%20%3D%20HP%20Time()%3B%0AShow(%20(stop%20-%20start)%20%2F%201e6%20)%3B%2F%2F9.3s%0A%0A%0Astart%20%3D%20HP%20Time()%3B%0AFor(%20t%20%3D%201%2C%20t%20%26lt%3B%201e6%2C%20t%20%2B%3D%201%2C%0A%20Matrix(%20%7Bv1%5B2%5D%20*%20v2%5B3%5D%20-%20v1%5B3%5D%20*%20v2%5B2%5D%2C%20v1%5B3%5D%20*%20v2%5B1%5D%20-%20v1%5B1%5D%20*%20v2%5B3%5D%2C%20v1%5B1%5D%20*%20v2%5B2%5D%20-%20v1%5B2%5D%20*%20v2%5B1%5D%7D%20)%0A)%3B%0Astop%20%3D%20HP%20Time()%3B%0AShow(%20(stop%20-%20start)%20%2F%201e6%20)%3B%2F%2F3.2s%0A%0A%0AFor(%20q%20%3D%201%2C%20q%20%26lt%3B%2010000%2C%20q%20%2B%3D%201%2C%0A%20v1%20%3D%20J(%203%2C%201%2C%20Random%20Uniform(%20-1%2C%201%20)%20)%3B%0A%20v2%20%3D%20J(%203%2C%201%2C%20Random%20Uniform(%20-1%2C%201%20)%20)%3B%0A%20If(%0A%20%20All(%0A%20%20%20Round(%20Matrix(%20%7Bv1%5B2%5D%20*%20v2%5B3%5D%20-%20v1%5B3%5D%20*%20v2%5B2%5D%2C%20v1%5B3%5D%20*%20v2%5B1%5D%20-%20v1%5B1%5D%20*%20v2%5B3%5D%2C%20v1%5B1%5D%20*%20v2%5B2%5D%20-%20v1%5B2%5D%20*%20v2%5B1%5D%7D%20)%2C%2010%20)%20%2F%2F%0A%20%20%20%3D%3D%20%2F%2F%0A%20%20%20(i%20%3D%201%3B%20j%20%3D%20-1%20%3B%20Round(%20J(%203%2C%201%2C%20(j%20*%3D%20-1)%20*%20Det(%20(v1%20%7C%7C%20v2)%5BRemove(%20%5B1%2C%202%2C%203%5D%2C%20i%2B%2B%20)%2C%200%5D%20)%20)%2C%2010%20)%20%3B%20)%20%2F%2F%0A%20%20)%20%3D%3D%200%2F%2F%0A%20%2C%20%2F%2F%0A%20%20Throw(%20Char(%20q%20)%20)%0A%20)%3B%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%ED%9D%A5%EB%AF%B8%EB%A1%AD%EA%B2%8C%EB%8F%84%2011%EC%9E%90%EB%A6%AC%EB%A1%9C%20%EB%B0%98%EC%98%AC%EB%A6%BC%ED%95%B4%EB%8F%84%20%EA%B2%B0%EA%B3%BC%EA%B0%80%20%EC%9D%BC%EC%B9%98%ED%95%98%EC%A7%80%20%EC%95%8A%EB%8A%94%20%EA%B2%BD%EC%9A%B0%EA%B0%80%20%EC%9E%88%EC%8A%B5%EB%8B%88%EB%8B%A4.%20%EC%95%84%EB%A7%88%EB%8F%84%20%EA%B1%B0%EC%9D%98%20%EB%8F%99%EC%9D%BC%EC%84%A0%EC%83%81%EC%97%90%20%EC%9E%88%EB%8A%94%20%EB%B2%A1%ED%84%B0%EC%9D%BC%20%EA%B2%83%EC%9E%85%EB%8B%88%EB%8B%A4.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FDIV%3E%3CNOSCRIPT%3E%3CDIV%20class%3D%22lia-spoiler-noscript-content%22%3Ev1%20%3D%20%5B0%2C%200%2C%201%5D%3B%20v2%20%3D%20%5B0%2C%201%2C%200%5D%3B%20%EC%8B%9C%EC%9E%91%20%3D%20HP%20%EC%8B%9C%EA%B0%84()%3B%20For(%20t%20%3D%201%2C%20t%20%26lt%3B%201e6%2C%20t%20%2B%3D%201%2C%20i%20%3D%201%3B%20j%20%3D%20-1%3B%20J(%203%2C%201%2C%20(j%20*%3D%20-1)%20*%20Det(%20(v1%20%7C%7C%20v2)%5B%EC%A0%9C%EA%B1%B0(%20%5B%201%2C%202%2C%203%5D%2C%20i%2B%2B%20)%2C%200%5D%20)%20)%3B%20)%3B%20%EC%A4%91%EC%A7%80%20%3D%20HP%20%EC%8B%9C%EA%B0%84()%3B%20Show(%20(%EC%A4%91%EC%A7%80%20-%20%EC%8B%9C%EC%9E%91)%20%2F%201e6%20)%3B%2F%2F9.3s%20start%20%3D%20HP%20Time()%3B%20For(%20t%20%3D%201%2C%20t%20%26lt%3B%201e6%2C%20t%20%2B%3D%201%2C%20%ED%96%89%EB%A0%AC(%20%7Bv1%5B2%5D%20*%20v2%5B3%5D%20-%20v1%5B3%5D%20*%20v2%5B2%5D%2C%20v1%5B3%5D%20*%20v2%5B1%5D%20-%20v1%5B%201%5D%20*%20v2%5B3%5D%2C%20v1%5B1%5D%20*%20v2%5B2%5D%20-%20v1%5B2%5D%20*%20v2%5B1%5D%7D%20)%20)%3B%20%EC%A4%91%EC%A7%80%20%3D%20HP%20%EC%8B%9C%EA%B0%84()%3B%20%ED%91%9C%EC%8B%9C(%20(%EC%A4%91%EC%A7%80%20-%20%EC%8B%9C%EC%9E%91)%20%2F%201e6%20)%3B%2F%2F3.2s%20For(%20q%20%3D%201%2C%20q%20%26lt%3B%2010000%2C%20q%20%2B%3D%201%2C%20v1%20%3D%20J(%203%2C%201%2C%20Random%20%EA%B7%A0%EC%9D%BC(%20-1%2C%201%20)%20)%3B%20v2%20%3D%20J(%203%2C%201%2C%20%EB%AC%B4%EC%9E%91%EC%9C%84%20%EA%B7%A0%EC%9D%BC(%20-1%2C%201%20)%20)%3B%20If(%20All(%20Round(%20%ED%96%89%EB%A0%AC(%20%7Bv1%5B2%5D%20*%20v2%5B3%5D%20-%20v1%5B3%5D%20*%20v2%5B2%5D%2C%20v1%5B3%5D%20*%20v2%5B1%5D%20-%20v1%5B1%5D%20*%20v2%5B3%5D%2C%20v1%5B1%5D%20*%20v2%5B2%5D%20-%20v1%5B2%5D%20*%20v2%5B1%5D%7D%20)%2C%2010%20)%20%2F%2F%20%3D%3D%20%2F%2F%20(i%20%3D%201%3B%20j%20%3D%20-1%20%3B%20Round(%20J(%203%2C%201%2C%20(j%20*%3D%20-1)%20*%20Det(%20(v1%20%7C%7C%20v2)%5B%EC%A0%9C%EA%B1%B0(%20%5B1%2C%202%2C%203%5D%2C%20i%2B%2B%20)%2C%200%5D%20)%20)%2C%2010%20)%20%3B%20)%20%2F%2F%20)%20%3D%3D%200%2F%2F%20%2C%20%2F%2F%20Throw(%20Char(%20q%20)%20)%20)%3B%20)%3B%20%ED%9D%A5%EB%AF%B8%EB%A1%AD%EA%B2%8C%EB%8F%84%2011%EC%9E%90%EB%A6%AC%EB%A1%9C%20%EB%B0%98%EC%98%AC%EB%A6%BC%ED%95%B4%EB%8F%84%20%EA%B2%B0%EA%B3%BC%EA%B0%80%20%EC%9D%BC%EC%B9%98%ED%95%98%EC%A7%80%20%EC%95%8A%EB%8A%94%20%EA%B2%BD%EC%9A%B0%EA%B0%80%20%EC%9E%88%EC%8A%B5%EB%8B%88%EB%8B%A4.%20%EC%95%84%EB%A7%88%EB%8F%84%20%EA%B1%B0%EC%9D%98%20%EB%8F%99%EC%9D%BC%EC%84%A0%EC%83%81%EC%97%90%20%EC%9E%88%EB%8A%94%20%EB%B2%A1%ED%84%B0%EC%9D%BC%20%EA%B2%83%EC%9E%85%EB%8B%88%EB%8B%A4.%3C%2FDIV%3E%3C%2FNOSCRIPT%3E%3C%2FNOSCRIPT%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-611656%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20%EB%B2%A1%ED%84%B0%20%EC%99%B8%EC%A0%81%EC%9D%84%20%EA%B3%84%EC%82%B0%ED%95%98%EB%8A%94%20%EB%B0%A9%EB%B2%95%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-611656%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%EA%B7%B8%EB%9F%B0%EB%8D%B0%2C%20%EB%B6%80%ED%99%9C%ED%95%9C%20%EC%A2%80%EB%B9%84%EA%B0%80%20%EB%82%98%EB%A5%BC%20%EC%9E%A1%EC%95%98%EC%8A%B5%EB%8B%88%EB%8B%A4.%20%EB%8B%A4%EC%9D%8C%EA%B3%BC%20%EA%B0%99%EC%9D%B4%20%ED%96%89%EB%A0%AC%EC%8B%9D%EC%9D%84%20%ED%86%B5%ED%95%B4%20%EC%9D%B4%EB%A5%BC%20%EC%88%98%ED%96%89%ED%95%98%EB%8A%94%20%EB%B0%A9%EB%B2%95%EC%9D%B4%20%EC%9E%88%EC%8A%B5%EB%8B%88%EB%8B%A4.%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F982%22%20target%3D%22_blank%22%3E%20%40Craige_Hales%3C%2FA%3E%20%EB%A7%90%ED%95%98%EB%8A%94.%20%EC%A7%A7%EC%A7%80%EB%A7%8C%20%EC%9E%98%20%EB%AA%A8%EB%A5%B4%EA%B2%A0%EC%8A%B5%EB%8B%88%EB%8B%A4...%20%EB%B3%84%EB%A1%9C%20%EA%B0%84%EB%8B%A8%ED%95%98%EC%A7%80%20%EC%95%8A%EC%8A%B5%EB%8B%88%EB%8B%A4.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EcrossP%20%3D%20Function(%20%7Bx%2C%20y%2C%20i%20%3D%201%7D%2C%0A%20Return(%20J(%203%2C%201%2C%20Det(%20(x%20%7C%7C%20y)%5BRemove(%20%5B1%2C%202%2C%203%5D%2C%20i%2B%2B%20)%2C%200%5D%20)%20)%20)%0A)%3B%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%EC%A6%89%2C%20%EC%9B%90%EB%9E%98%20%EC%A0%9C%EA%B3%B5%EB%90%9C%20%EB%8D%B0%EC%9D%B4%ED%84%B0%EB%A5%BC%20%EC%82%AC%EC%9A%A9%ED%95%A9%EB%8B%88%EB%8B%A4.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22brady_brady_0-1678770863902.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22brady_brady_0-1678770863902.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22brady_brady_0-1678770863902.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F50994iC68731CC95838C56%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22brady_brady_0-1678770863902.png%22%20alt%3D%22brady_brady_0-1678770863902.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-610312%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20%EB%B2%A1%ED%84%B0%20%EC%99%B8%EC%A0%81%EC%9D%84%20%EA%B3%84%EC%82%B0%ED%95%98%EB%8A%94%20%EB%B0%A9%EB%B2%95%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-610312%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%EC%9D%B4%20%EC%A2%80%EB%B9%84%20%EC%8A%A4%EB%A0%88%EB%93%9C%EB%A5%BC%20%EB%B6%80%ED%99%9C%EC%8B%9C%EC%BC%9C%EC%84%9C%20%EC%A3%84%EC%86%A1%ED%95%A9%EB%8B%88%EB%8B%A4.%20%ED%95%98%EC%A7%80%EB%A7%8C%20%EC%97%AC%EA%B8%B0%20%EB%91%90%20%EB%B2%88%EC%A7%B8%20%EC%9A%94%EC%86%8C%EC%97%90%20%EC%84%9C%EB%AA%85%20%EC%98%A4%EB%A5%98%EA%B0%80%20%EC%9E%88%EC%8A%B5%EB%8B%88%EB%8B%A4.%EB%82%98%EB%8A%94%20%EA%B7%B8%EB%9E%98%EC%95%BC%20%ED%95%9C%EB%8B%A4%EA%B3%A0%20%EB%AF%BF%EB%8A%94%EB%8B%A4%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EMatrix(%0A%20%20%7Bv1%5B2%5D%20*%20v2%5B3%5D%20-%20v1%5B3%5D%20*%20v2%5B2%5D%2C%20v1%5B3%5D%20*%20v2%5B1%5D%20-%20v1%5B1%5D%20*%20v2%5B3%5D%2C%20v1%5B1%5D%20*%20v2%5B2%5D%20-%20v1%5B2%5D%20*%20v2%5B1%5D%7D%3CBR%20%2F%3E)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%EB%B9%A0%EB%A5%B8%20%EB%B3%B5%EC%82%AC-%EB%B6%99%EC%97%AC%EB%84%A3%EA%B8%B0%EB%A5%BC%20%EC%9C%84%ED%95%B4%20%ED%95%A8%EA%BB%98%20%EC%98%A4%EC%8B%9C%EB%8A%94%20%EB%8B%A4%EB%A5%B8%20%EB%B6%84%EB%93%A4%EC%9D%84%20%EC%9C%84%ED%95%B4%20%EC%97%AC%EA%B8%B0%EC%97%90%20%EB%82%A8%EA%B2%A8%EB%91%90%EA%B3%A0%20%EC%8B%B6%EC%8A%B5%EB%8B%88%EB%8B%A4.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-236315%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20%EB%B2%A1%ED%84%B0%20%EC%99%B8%EC%A0%81%EC%9D%84%20%EA%B3%84%EC%82%B0%ED%95%98%EB%8A%94%20%EB%B0%A9%EB%B2%95%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-236315%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%EA%B0%90%EC%82%AC%ED%95%A9%EB%8B%88%EB%8B%A4%20cwillden%2C%20%EC%9D%B4%EA%B2%83%EC%9D%B4%20%EB%B3%B8%EC%A7%88%EC%A0%81%EC%9C%BC%EB%A1%9C%20%EC%A0%9C%EA%B0%80%20%EA%B5%AC%ED%98%84%ED%95%9C%20%EA%B2%83%EC%9E%85%EB%8B%88%EB%8B%A4.%20%EB%82%98%EB%8A%94%203D%20%EB%B2%A1%ED%84%B0%EC%97%90%EB%A7%8C%20%EA%B4%80%EC%8B%AC%EC%9D%B4%20%EC%9E%88%EA%B8%B0%20%EB%95%8C%EB%AC%B8%EC%97%90%20%EA%B7%B8%EA%B2%83%EC%9D%80%20%EB%82%98%EC%97%90%EA%B2%8C%20%ED%9A%A8%EA%B3%BC%EC%A0%81%EC%9D%B4%EC%A7%80%EB%A7%8C%20%EC%9D%B4%EA%B2%83%EC%9D%B4%20%EB%82%B4%EC%9E%A5%EB%90%9C%20%EA%B8%B0%EB%8A%A5%EC%9D%B4%20%EC%95%84%EB%8B%88%EB%9D%BC%EB%8A%94%20%EC%82%AC%EC%8B%A4%EC%97%90%20%EB%86%80%EB%9E%90%EC%8A%B5%EB%8B%88%EB%8B%A4.%20%EB%8B%A4%EB%A5%B8%20%EC%82%AC%EB%9E%8C%EC%9D%B4%20%EA%B7%B8%EB%9F%B0%20%EB%B0%A9%EB%B2%95%EC%9D%84%20%EC%95%8C%EA%B3%A0%20%EC%9E%88%EB%8A%94%EC%A7%80%20%ED%99%95%EC%9D%B8%ED%95%98%EA%B8%B0%20%EC%9C%84%ED%95%B4%20%EC%9D%B4%EA%B2%83%EC%9D%84%20%EC%9E%A0%EC%8B%9C%20%EC%97%B4%EC%96%B4%20%EB%91%90%EA%B2%A0%EC%8A%B5%EB%8B%88%EB%8B%A4.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-236298%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20%EB%B2%A1%ED%84%B0%20%EC%99%B8%EC%A0%81%EC%9D%84%20%EA%B3%84%EC%82%B0%ED%95%98%EB%8A%94%20%EB%B0%A9%EB%B2%95%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-236298%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%EB%88%84%EA%B5%B0%EA%B0%80%EA%B0%80%20%EC%9D%B4%EB%A5%BC%20%EC%88%98%ED%96%89%ED%95%98%EB%8A%94%20%EC%98%81%EB%A6%AC%ED%95%9C%20%EB%B0%A9%EB%B2%95%EC%9D%84%20%EC%83%9D%EA%B0%81%ED%95%B4%20%EB%82%B4%EA%B8%B0%EB%A5%BC%20%EB%B0%94%EB%9E%8D%EB%8B%88%EB%8B%A4.%20det()%20%ED%95%A8%EC%88%98%EB%8A%94%20%EB%B0%80%EC%A0%91%ED%95%98%EA%B2%8C%20%EA%B4%80%EB%A0%A8%EB%90%98%EC%96%B4%20%EC%9E%88%EC%A7%80%EB%A7%8C%20det(3x3%20%ED%96%89%EB%A0%AC)%EC%9D%84%20%EC%82%AC%EC%9A%A9%ED%95%98%EC%97%AC%20%EC%8A%A4%EC%B9%BC%EB%9D%BC%20%EA%B0%92%20%EC%9D%B4%EC%83%81%EC%9D%84%20%EB%B0%98%ED%99%98%ED%95%98%EB%8A%94%20%EB%B0%A9%EB%B2%95%EC%9D%84%20%EC%9D%B4%ED%95%B4%ED%95%98%EC%A7%80%20%EB%AA%BB%ED%95%A9%EB%8B%88%EB%8B%A4.%20%EC%A0%9C%20%EC%83%9D%EA%B0%81%EC%97%90%EB%8A%94%20det(2x2%20sub-matrix)%EB%A5%BC%20%EC%84%B8%20%EB%B2%88%20%EC%82%AC%EC%9A%A9%ED%95%A0%20%EC%88%98%20%EC%9E%88%EC%9D%84%20%EA%B2%83%20%EA%B0%99%EC%A7%80%EB%A7%8C%2C%20%EC%A0%9C%20%EC%83%9D%EA%B0%81%EC%97%90%EB%8A%94%20%EA%B0%84%EB%8B%A8%ED%95%A9%EB%8B%88%EB%8B%A4.%3CA%20href%3D%22https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FCross_product%23Mnemonic%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%20xyzzy%3C%2FA%3E%20%EC%A0%91%EA%B7%BC%20%EB%B0%A9%EC%8B%9D%EC%9D%B4%20%EB%8D%94%20%EA%B0%84%EB%8B%A8%ED%95%98%EA%B3%A0%20%EB%B9%A0%EB%A6%85%EB%8B%88%EB%8B%A4.%3C%2FP%3E%3CP%3E3D%20%EC%9E%A5%EB%A9%B4%EC%9D%98%20%ED%91%9C%EB%A9%B4%20%EB%B2%95%EC%84%A0%EC%97%90%20%EC%82%AC%EC%9A%A9%ED%95%A9%EB%8B%88%EB%8B%A4.%20JSL%EC%9D%B4%20%EC%95%BD%EA%B0%84%20%EC%9E%88%EC%8A%B5%EB%8B%88%EB%8B%A4.%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2FUncharted%2FCustom-Visualization%2Fba-p%2F191559%22%20target%3D%22_blank%22%3E%20https%3A%2F%2Fcommunity.jmp.com%2Ft5%2FUncharted%2FCustom-Visualization%2Fba-p%2F191559%3C%2FA%3E%20.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-236294%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20%EB%B2%A1%ED%84%B0%20%EC%99%B8%EC%A0%81%EC%9D%84%20%EA%B3%84%EC%82%B0%ED%95%98%EB%8A%94%20%EB%B0%A9%EB%B2%95%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-236294%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E3x1(%EB%98%90%EB%8A%94%201x3)%20%EB%B2%A1%ED%84%B0%EB%A7%8C%20%EB%8B%A4%EB%A3%A8%EB%8A%94%20%EA%B2%BD%EC%9A%B0%20%EA%B3%84%EC%82%B0%20%ED%9A%A8%EC%9C%A8%EC%84%B1%EC%9D%B4%EB%82%98%20%EC%9A%B0%EC%95%84%ED%95%A8%EC%9D%80%20%EA%B7%B8%EB%8B%A4%EC%A7%80%20%EC%A4%91%EC%9A%94%ED%95%98%EC%A7%80%20%EC%95%8A%EB%8B%A4%EA%B3%A0%20%EC%83%9D%EA%B0%81%ED%95%A9%EB%8B%88%EB%8B%A4.%EC%9D%B4%20%EC%A0%95%EB%8F%84%EB%A9%B4%20%EC%B6%A9%EB%B6%84%ED%95%A0%EA%B9%8C%EC%9A%94%3F%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Ecross_prod%20%3D%20function(%7Bv1%2C%20v2%7D%2C%0A%20matrix(%7Bv1%5B2%5D*v2%5B3%5D%20-%20v1%5B3%5D*v2%5B2%5D%2C%20v1%5B1%5D*v2%5B3%5D%20-%20v1%5B3%5D*v2%5B1%5D%2C%20v1%5B1%5D*v2%5B2%5D%20-%20v1%5B2%5D*v2%5B1%5D%7D)%3B%0A)%3B%0A%0Across_prod(v1%2C%20v2)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
CaseyL
Level II

How to calculate Vector Cross Product

From the documentation it looks like the * operator will perform a cross product and ;* will perform a dot product. I want to use a cross product to determine the vector normal to a pair of known vectors like this:

 

p1 = [1, 2, 4];
p2 = [2, 1, 4];
p3 = [2, 2, 4];

v1 = p3 - p1;
v2 = p2 - p1;

xProd = v1*v2;

 3 points define a plane, two vectors taken from those points do the same, the cross-product should give the normal vector of that plane. The problem seems to be that the dimensions of the two matrices being multiplied (v1 and v2) do not agree -- nRows(v1) should equal nCols(v2). I can implement this manually with a simplified formula for vector cross products but does anyone know how to format this differently to work with matrix multiplication?

7 REPLIES 7
cwillden
Super User (Alumni)

Re: How to calculate Vector Cross Product

If you're only ever dealing 3x1 (or 1x3) vectors, then I would think computational efficiency or elegance is not too important.  Would this be sufficient?

cross_prod = function({v1, v2},
	matrix({v1[2]*v2[3] - v1[3]*v2[2], v1[1]*v2[3] - v1[3]*v2[1], v1[1]*v2[2] - v1[2]*v2[1]});
);

cross_prod(v1, v2);
-- Cameron Willden
Craige_Hales
Super User

Re: How to calculate Vector Cross Product

I hope someone comes up with a clever way to do this. The det() function is closely related, but I don't understand how to use det(3x3 matrix) to get back more than a scalar value. I think you could use det(2x2 sub-matrix) three times, but I think the straight-forward xyzzy approach is simpler and just as fast.

I use it for the surface normals in 3D scenes, there is some JSL in https://community.jmp.com/t5/Uncharted/Custom-Visualization/ba-p/191559 .

Craige
CaseyL
Level II

Re: How to calculate Vector Cross Product

Thanks cwillden, this is essentially what  I have implemented. It does work for me since I am only concerned with 3D vectors, but I am supprised this isn't a built in function. I'm going to leave this open for a bit to see if anyone else knows of such a way. 

klk
klk
Level III

Re: How to calculate Vector Cross Product

Sorry for reviving this zombie thread, but there is a sign error in the second element here.  I believe it should be

Matrix(
		{v1[2] * v2[3] - v1[3] * v2[2], v1[3] * v2[1] - v1[1] * v2[3], v1[1] * v2[2] - v1[2] * v2[1]}
)

Just want to leave this here for anyone else who comes along for a quick copy-paste.

Re: How to calculate Vector Cross Product

Well, the revived zombie caught me. Here is a way to do it via determinants as @Craige_Hales mentioned. It is short, but I don't know... it isn't very simple.

 

crossP = Function( {x, y, i = 1},
	Return( J( 3, 1, Det( (x || y)[Remove( [1, 2, 3], i++ ), 0] ) ) )
);

 

i.e., using the originally-supplied data:

brady_brady_0-1678770863902.png

 

Craige_Hales
Super User

Re: How to calculate Vector Cross Product

@brady_brady  Cool! It needs a tweak if you are going to use it:

	i = 1;
	j = -1;
	J( 3, 1, (j *= -1) * Det( (v1 || v2)[Remove( [1, 2, 3], i++ ), 0] ) );

 https://mathinsight.org/cross_product_formula shows how the middle element needs to be negative.  Above, j will alternate sign (1, -1, 1), and i increases (1, 2, 3). The J(...) function has an implicit loop that evaluates the 3rd argument for each element.

 

The straight forward corrected formula from @klk  is about 3 times faster and about N times easier to understand.

 

Test code.

View more...

v1 = [0, 0, 1];
v2 = [0, 1, 0];

start = HP Time();
For( t = 1, t < 1e6, t += 1,
	i = 1;
	j = -1;
	J( 3, 1, (j *= -1) * Det( (v1 || v2)[Remove( [1, 2, 3], i++ ), 0] ) );
);
stop = HP Time();
Show( (stop - start) / 1e6 );//9.3s


start = HP Time();
For( t = 1, t < 1e6, t += 1,
	Matrix( {v1[2] * v2[3] - v1[3] * v2[2], v1[3] * v2[1] - v1[1] * v2[3], v1[1] * v2[2] - v1[2] * v2[1]} )
);
stop = HP Time();
Show( (stop - start) / 1e6 );//3.2s


For( q = 1, q < 10000, q += 1,
	v1 = J( 3, 1, Random Uniform( -1, 1 ) );
	v2 = J( 3, 1, Random Uniform( -1, 1 ) );
	If(
		All(
			Round( Matrix( {v1[2] * v2[3] - v1[3] * v2[2], v1[3] * v2[1] - v1[1] * v2[3], v1[1] * v2[2] - v1[2] * v2[1]} ), 10 ) //
			== //
			(i = 1; j = -1 ; Round( J( 3, 1, (j *= -1) * Det( (v1 || v2)[Remove( [1, 2, 3], i++ ), 0] ) ), 10 ) ; ) //
		) == 0//
	, //
		Throw( Char( q ) )
	);
);
Curiously, rounding to 11 places occasionally fails to match results. Probably nearly collinear vectors.

Craige

Re: How to calculate Vector Cross Product

The inferior performance doesn't surprise... thanks for inserting the sign adjustment. I omitted the "sign checkerboard" inadvertently.

 

IMO this is one of those instances where "just because you can, doesn't mean you should" applies... {cool, fun, short} doesn't outweigh {understandable, maintainable, speedy}.