3
$\begingroup$

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]}
}
$\endgroup$
9
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ Thanks for your help. How about the inverse problem? $\endgroup$ – Orders Mar 12 '13 at 2:05
  • $\begingroup$ Could try with Method -> "OneStepRowReduction" but it will take a considerable amount of memory. $\endgroup$ – Daniel Lichtblau Mar 12 '13 at 2:36

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.