3

For example, the following is a $12\times 12$ symmetric matrix. Det and Inverse take too much time and don't even work on my computer. I don't consider the numerical case.

mat = {
  {a[1, 1], 0, 0, a[1, 4], 0, 0, a[1, 7], 0, 0, a[1, 10], 0, 0},
  {0, a[1, 1], 0, 0, a[1, 4], 0, 0, a[1, 7], 0, 0, a[1, 10], 0}, 
  {0, 0, a[3, 3], 0, 0, a[1, 4], 0, 0, a[1, 7], 0, 0, a[1, 10]}, 
  {a[1, 4], 0, 0, a[4, 4], 0, 0, a[4, 7], 0, 0, a[4, 10], 0, 0}, 
  {0, a[1, 4], 0, 0, a[4, 4], 0, 0, a[4, 7], 0, 0, a[4, 10], 0},
  {0, 0, a[1, 4], 0, 0, a[6, 6], 0, 0, a[4, 7], 0, 0, a[4, 10]}, 
  {a[1, 7], 0, 0, a[4, 7], 0, 0, a[7, 7], a[7, 8], a[7, 9], a[7, 10], 0, 0}, 
  {0, a[1, 7], 0, 0, a[4, 7], 0, a[7, 8], a[8, 8], a[8, 9], 0, a[7, 10], 0},
  {0, 0, a[1, 7], 0, 0, a[4, 7], a[7, 9], a[8, 9], a[9, 9], 0, 0, a[7, 10]},
  {a[1, 10], 0, 0, a[4, 10], 0, 0, a[7, 10], 0, 0,  a[10, 10], a[10, 11], a[10, 12]}, 
  {0, a[1, 10], 0, 0, a[4, 10], 0, 0, a[7, 10], 0, a[10, 11], a[11, 11], a[11, 12]}, 
  {0, 0, a[1, 10], 0, 0, a[4, 10], 0, 0, a[7, 10], a[10, 12], a[11, 12], a[12, 12]}
}
m_goldberg
  • 107,779
  • 16
  • 103
  • 257
Orders
  • 1,247
  • 11
  • 20

1 Answers1

9

The determinant computation is a matter of memory use in terms of how much we want to store for subdeterminants of a Laplace expansion. Mathematica simply refuses to go that route after 11x11. YOu can do your own as below.

myDet[mat_] /; Length[mat] <= 4 := Det[mat]
myDet[mat_] := 
 myDet[mat] = 
  Sum[mat[[1, j]]*myDet[Drop[mat, {1}, {j}]], {j, Length[mat]}]

Timing[dd = myDet[mat];]

(* Out[79]= {0.870000, Null} *)

Using this matrix in solving linear equations will be harder. Might try playing with the Method option, e.g.

SeedRandom[1111];
rhs = RandomInteger[{-100, 100}, Length[mat]];

Timing[
 soln = LinearSolve[mat, rhs, Method -> "OneStepRowReduction"];]

(* Out[83]= {236.080000, Null} *)

LeafCount[soln]

(* Out[84]= 14521350 *)

Slow, and a huge result. No surprises there.

Daniel Lichtblau
  • 58,970
  • 2
  • 101
  • 199