My current implementation for a totally antisymmetric function is like this:
g[a__] := Signature[{a}] (g @@ Sort@{a}) /; !OrderedQ[{a}];
g[a__] := 0 /; ! Unequal[a];
So I take the list of arguments of f and calculate the signature of the permutation, and put that factor out the front. I then sort to pick a canonical ordering which I put into f.
so I want that eg. f[1,3,2] = -f[1,2,3] and f[1,2,3] = f[2,3,1], and my code above achieves this. The second line sets any f with two arguments the same to be zero.
Then you could use this f for a wedge product or a minor of a matrix for example.
My code works, but is very slow when doing many rearrangments, as it needs to keep sorting and unioning the list of arguments.
Does anyone have an idea for a faster implementation?
Comments
Post a Comment