Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Revisions

3 of 4
save 11 bytes; matrix diagonal entries automatically zero for antisymmetric indexing
dharr
  • 1.1k
  • 2
  • 8

Maple, (削除) 187 (削除ここまで) 176 bytes

(s,t)->eval(s^+.Matrix([[],[-e3],[e2,-e1],[-e5,-e6,-e7],[e4,-e7,e6,-e1],[e7,e4,-e5,-e2,e3],[-e6,e5,e4,-e3,-e2,e1,0]],shape=antisymmetric).t,{seq(e||i=Vector(7,{i=1}),i=1..7)});

If the two vectors are s and t, and Q is the multiplication table as a matrix, then the result in the form a*e1+b*e2+... is sT.Q.t. Then substitute e1, e2 etc for the unit vectors [1,0,0,0,0,0,0]T, [0,1,0,0,0,0,0]T etc. to get the final result.

dharr
  • 1.1k
  • 2
  • 8

AltStyle によって変換されたページ (->オリジナル) /