f[n_] := Map[# // MatrixForm &,maps $n$ to $S_n$, the symmetric group of $n$ elements, and displays its elements as a list of permutation matrices.
Map[SparseArray[{i_, i_} \Rightarrow 1, {n, n}][[#]] &,
Permutations[Array[# &, n]]]]
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.
Tidak ada komentar:
Posting Komentar