2

I am trying to solve a linear equation in x, where the equation is given by Det[M]==0. The M is a symmetric matrix (dimensions 47x47) with an element equal to x and all other elements are equal to numbers ranging from 1 to 10^4. So, Det[M] is a linear equation in x. I could get a solution for a 11x11 matrix using 'Solve', but when the dimensions goes to 47 the program does not return anything for the time I let it run (about a day). I suspect it is the large size that causes the problem, any suggestion to solve it quickly (~ mins) using Mathematica? Thanks. Jayajit

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
user8978
  • 33
  • 4

2 Answers2

7

Evaluate M at two substituted values for 'x', say 0 and 1. Interpolate to find the linear form for Det[M]. Set that linear polynomial to zero and solve for 'x'.

Daniel Lichtblau
  • 58,970
  • 2
  • 101
  • 199
  • I didn't even notice that "linear equation" in this case meant just linear in x. So obviously this is the blindingly simple answer. – Jens Aug 10 '13 at 23:29
4

Reorder the rows and columns (maintaining symmetry) to put x into either the (47,47) position or the (46,47) and (47,46) positions, then use the theorems on determinants of partitioned matrices.

EDIT I too didn't notice the linearity in x, which implies that x must a diagonal element.
In that case, if m is the matrix in question and x is the kth diagonal, the solution is
With[{r = Delete[Range@47,k]}, m[[k,r]].LinearSolve[m[[r,r]],m[[k,r]]]]
Note that it is not necessary to reorder m or to set m[[k,k]] = x symbolically.
Whatever is in m[[k,k]] is simply ignored.

That's not as elegant as Daniel's solution, but it's about 30% faster on my system (although it hardly matters -- they're both well under 1 sec, compared to > 1 day).

Ray Koopman
  • 3,306
  • 14
  • 13