As of May 4 2007 the scripts will autodetect your timezone settings. Nothing here has to be changed, but there are a few things

Please follow this blog

Search this blog

Thursday, March 24, 2011

Generating a list of permutation matrices with Mathematica

The following function defined by
f[n_] := Map[# // MatrixForm &, 
  Map[SparseArray[{i_, i_} \Rightarrow 1, {n, n}][[#]] &, 
   Permutations[Array[# &, n]]]]
maps $n$ to $S_n$, the symmetric group of $n$ elements, and displays its elements as a list of permutation matrices.


Mathematica keeps surprising me.

The function above is basically a one line function in Mathematica. ( Mathematica is a functional programming language. Every Mathematica instruction is a function, including IF and WHILE. Compare Microsoft Excel. All data in Mathematica is essentially a list. )

M381 Mathematical Logic is about the Universal Register Machine, the URM. It is a theoretical computer with only four instructions. Z(n): zero Register n, S(n) add 1 to Register n, C(m,n) copy register m to n and J(m,n,p) if the contents of Registers m and n are equal then jump to the instruction at line p. - The function above is computable and thus can be implemented in the form of an URM program. I don't know how many registers and instructionlines would be involved but it will be in the hundreds if not thousands. Just think of programming the one line function in a ( higher ) programming language like Java without using any third party imports.

P.S.
All Mathematica output can be copied as LaTeX and pasted in your LaTeX IDE, unfortunately MathJax leaves the handling of tables and matrices to HTML ( not entirely logical because you are publishing to the web and not to a PDF document ). That is the reason I included a printscreen image of a Mathematica notebook in this post.

No comments:

Post a Comment

Popular Posts

Welcome to The Bridge

Mathematics: is it the fabric of MEST?
This is my voyage
My continuous mission
To uncover hidden structures
To create new theorems and proofs
To boldly go where no man has gone before




(Raumpatrouille – Die phantastischen Abenteuer des Raumschiffes Orion, colloquially aka Raumpatrouille Orion was the first German science fiction television series. Its seven episodes were broadcast by ARD beginning September 17, 1966. The series has since acquired cult status in Germany. Broadcast six years before Star Trek first aired in West Germany (in 1972), it became a huge success.)