{"id":11153,"date":"2022-04-20T01:36:52","date_gmt":"2022-04-20T05:36:52","guid":{"rendered":"https:\/\/spinor.info\/weblog\/?p=11153"},"modified":"2022-04-20T01:36:52","modified_gmt":"2022-04-20T05:36:52","slug":"fun-with-computer-algebra","status":"publish","type":"post","link":"https:\/\/spinor.info\/weblog\/?p=11153","title":{"rendered":"Fun with computer algebra"},"content":{"rendered":"<p>Came across a question tonight: How do you construct the matrix<\/p>\n<p>$$\\begin{pmatrix}1&amp;2&amp;&#8230;&amp;n\\\\n&amp;1&amp;&#8230;&amp;n-1\\\\&#8230;\\\\2&amp;3&amp;&#8230;&amp;1\\end{pmatrix}?$$<\/p>\n<p>Here&#8217;s a bit of Maxima code to make it happen:<\/p>\n<pre>(%i1) M(n):=apply(matrix,makelist(makelist(mod(x-k+n,n)+1,x,0,n-1),k,0,n-1))$\r\n(%i2) M(5);\r\n                               [ 1  2  3  4  5 ]\r\n                               [               ]\r\n                               [ 5  1  2  3  4 ]\r\n                               [               ]\r\n(%o2)                          [ 4  5  1  2  3 ]\r\n                               [               ]\r\n                               [ 3  4  5  1  2 ]\r\n                               [               ]\r\n                               [ 2  3  4  5  1 ]\r\n<\/pre>\n<p>I also ended up wondering about the determinants of these matrices:<\/p>\n<pre>(%i3) makelist(determinant(M(i)),i,1,10);\r\n(%o3) [1, - 3, 18, - 160, 1875, - 27216, 470596, - 9437184, 215233605, - 5500000000]\r\n<\/pre>\n<p>I became curious if this sequence of numbers was known, and indeed that is the case. It is sequence number <a href=\"http:\/\/oeis.org\/A052182\">A052182<\/a> in the Encyclopedia of Integer Sequences: &#8220;Determinant of n X n matrix whose rows are cyclic permutations of 1..n.&#8221; D&#8217;oh.<\/p>\n<p>As it turns out, this sequence also has another name: it&#8217;s the Smarandache cyclic determinant sequence. In closed form, it is given by<\/p>\n<p>$${\\rm SCDNS}(n)=(-1)^{n+1}\\frac{n+1}{2}n^{n-1}.$$<\/p>\n<pre>(%i4) SCDNS(n):=(-1)^(n+1)*(n+1)\/2*n^(n-1);\r\n                                      n + 1\r\n                                 (- 1)      (n + 1)   n - 1\r\n(%o4)               SCDNS(n) := (------------------) n\r\n                                         2\r\n(%i5) makelist(determinant(SCDNS(i)),i,1,10);\r\n(%o5) [1, - 3, 18, - 160, 1875, - 27216, 470596, - 9437184, 215233605, - 5500000000]\r\n<\/pre>\n<p>Surprisingly, apart from the alternating sign it shares the first several values with another sequence, <a href=\"https:\/\/oeis.org\/A212599\">A212599<\/a>. But then they deviate.<\/p>\n<p>Don&#8217;t let anyone tell you that math is not fun.<\/p>\n<fb:like href='https:\/\/spinor.info\/weblog\/?p=11153' send='false' layout='button_count' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida grande'><\/fb:like>","protected":false},"excerpt":{"rendered":"<p>Came across a question tonight: How do you construct the matrix $$\\begin{pmatrix}1&amp;2&amp;&#8230;&amp;n\\\\n&amp;1&amp;&#8230;&amp;n-1\\\\&#8230;\\\\2&amp;3&amp;&#8230;&amp;1\\end{pmatrix}?$$ Here&#8217;s a bit of Maxima code to make it happen: (%i1) M(n):=apply(matrix,makelist(makelist(mod(x-k+n,n)+1,x,0,n-1),k,0,n-1))$ (%i2) M(5); [ 1 2 3 4 5 ] [ ] [ 5 1 2 3 4 ] [ ] (%o2) [ 4 5 1 2 3 ] [ ] [ <a href='https:\/\/spinor.info\/weblog\/?p=11153' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[49],"tags":[],"class_list":["post-11153","post","type-post","status-publish","format-standard","hentry","category-computer-algebra","category-49-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=\/wp\/v2\/posts\/11153","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11153"}],"version-history":[{"count":5,"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=\/wp\/v2\/posts\/11153\/revisions"}],"predecessor-version":[{"id":11158,"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=\/wp\/v2\/posts\/11153\/revisions\/11158"}],"wp:attachment":[{"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11153"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}