1
$\begingroup$

This code can only solve the 3 * 3 matrix:

list = Permutations[Range[9], {9}];
matrix = Partition[#, 3] & /@ list;
answer = Det /@ matrix;
m = Max[answer];
pos = Flatten[Position[answer, m]];
matrix[[#]] & /@ pos
Det[%[[1]]] 

But how to quickly and efficiently find the solution in the case of 5 * 5 or even 6 * 6 matrix.

Click on the link to see a specific statement of this problem.

 Needs["Combinatorica`"]; 
    n = 3; n2 = n^2; dMax = 0; mMax = {}; p = 
     Range[n2]; Do[m = Partition[p, n]; d = Det[m]; 
     If[d > dMax, dMax = d; mMax = m]; 
     p = Combinatorica`NextPermutation[p], {k, n2!}];
     {dMax, mMax}

The MaximizeOverPermutations function in this link can't find the exact value of 6 * 6 quickly.

The mathematical method in this article may be beneficial to reduce the amount of calculation:

enter image description here

detM[n_] := n^n (n^2 + 1)/2 ((n^3 + n^2 + n + 1)/12)^((n - 1)/2)
detM[6.]
$\endgroup$
3
  • 2
    $\begingroup$ Why do you expect to get this "quickly"? There are, factoring out row and column permutations and transposition of the matrix (these change the determinant only by sign), $(6^2)! / 6! / 6! / 2 = 358789859943963365613425393664000000$ different matrices. So as long as nobody comes up with a clever mathematical idea, this has to take very long. Just for comparison: for $3 \times 3$-matrices, there are only $(3^2)!/3!/3!/2 = 5040$ matrices to check $\endgroup$ Feb 1, 2020 at 7:21
  • 5
    $\begingroup$ What makes you believe that it can be found quickly? Also, it is a good habit to cite your source when you copy paste code (ie T.D. Noe from oeis.org/A085000). $\endgroup$
    – anderstood
    Feb 1, 2020 at 7:21
  • $\begingroup$ @HenrikSchumacher We can see this article to learn how to estimate the upper bound of the maximum value of this problem mathematically: emis.de/journals/JIPAM/images/064_09_JIPAM/064_09_www.pdf $\endgroup$ Feb 1, 2020 at 7:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.