hermann on Sun, 11 Feb 2024 01:44:28 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
GP cross product? |
I searched mailing lists unsuccessfully as well. First I came up with this:? cross=(a,b)->{m=matdet(Mat([[i,j,k]~,a~,b~]));[polcoef(m,1,i),polcoef(m,1,j),polcoef(m,1,k)]};
? cross([1,2,3],[2,3,4]) [-1, 2, -1] ? Then by Wikipedia definition perhaps simpler:? cross=(a,b)->[a[2]*b[3]-a[3]*b[2],a[3]*b[1]-a[1]*b[3],a[1]*b[2]-a[2]*b[1]];
? cross([1,2,3],[2,3,4]) [-1, 2, -1] ?Is there something builtin in GP that can compute cross product of two vectors?
Regards, Hermann.