in reply to Re: sort function and parity of the permutation.
in thread sort function and parity of the permutation.

Thank you for this question.

I want to do computations in anticommutative algebras (ab=-ba). This anticommutativity guarantees that all elements are nilpotent (a^2=0). In order to know if two elements are the same, I wanted to order them, keeping track of permutations, the compare them stringwise (abc=cab). My main problem was to compute products (i.e string concatenations) then sorting them and multipliying by the parity for the sort permutation.

Thanks to your question, i realized that i was doing too much. If I have two ordered monomials 'abde' and 'chk', i can count for each letter of the first, how many leters for the second are smaller than it. That way i can easily keep track for parity.

But then I realized something cooler. If my algebra has N (ordered) generators (a1,..,an), i can represent each monomial(basis) with a number between 0 and 2^(n+1)-1 by taking its binary representation.

Thanks for all the help guys.
  • Comment on Re^2: sort function and parity of the permutation.

Replies are listed 'Best First'.
Re^3: sort function and parity of the permutation.
by BrowserUk (Patriarch) on Feb 15, 2011 at 18:11 UTC

    Skipping over all the bits of that I didn't understand...

    YW :)

      Well you did ask!