If you keyin help magic command window, you will obtain the answer of your question about magic function.
MAGIC Magic square. MAGIC(N) is an N-by-N matrix constructed from the integers 1 through N^2 with equal row, column, and diagonal sums. Produces valid magic squares for all N > 0 except N = 2.
If you keyin help magic command window, you will obtain the answer of your question about magic function.
回覆刪除MAGIC Magic square.
MAGIC(N) is an N-by-N matrix constructed from the integers 1 through N^2 with equal row, column, and diagonal sums. Produces valid magic squares for all N > 0 except N = 2.
magic(N) 這個神奇的函數會產生一個 N*N 的矩陣, 其中的元素值剛好從 1 到 N*N, 矩陣中的每一列, 每一行, 甚至是對角線的總合都是相同的! 很神奇吧!!
回覆刪除