1

Hi I am trying to solve a linear system of equations with mathematica. I have 18 equations and 18 Unknowns and the coefficient matrix has full rank. All entries are symbolic since I am trying to solve the problem analytically. Unfortunately Mathematica never stops the evaluation. I have prepared a minimal working example:

n = 18
A = Table[AA[i, j], {i, 1, n}, {j, 1, n}];
A // MatrixForm
x = Table[xx[i], {i, 1, n}]
b = Table[bb[i], {i, 1, n}]
MatrixRank[A]
sol = Timing[Solve[{A.x == b}, x, Reals]]
A.x == b //. sol[[2]][[1]] // Simplify

For n=2,3,4,.. all works perfectly well. But with n=10... nothing works anymore. Why has mathematica such problems solving this? Is there a way to solve this problem?

Thanks for help,

Andreas

  • you might try linearsolve, but it is simply not practical to symbolically solve such large systems. – agentp Sep 19 '14 at 11:49
  • LinearSolve unfortunately also doesn't work with the following error message: No more memory available. Mathematica kernel has shut down. Try quitting other applications and then retry. – Madprofessor Sep 19 '14 at 12:20
  • What is your larger goal here? It is probably impossible to solve an 18 by 18 system of equations in full generality. For what purpose do you want to solve it? We may be able to give some advice if we know what the big picture is. – Robert Dodier Sep 19 '14 at 17:14
  • I have a boundary value problem with 18 boundary conditions. So I have to solve a system of 18 equations. The problem has almost no zero values in the system matrix. The code above is only an example. I tried solving the system of equations with numerical values but the outcomes were not reasonable. I think the reason was that I have very large and very small numbers in the system matrix if I evaluate it numerically. This was the reason why I tried to solve it in an analytical manner. – Madprofessor Sep 22 '14 at 07:07
  • (1) An analytic solution is not going to fix issues with numeric error. It will simply defer them until such time as you substitute numbers for the variables. (2) For 10x10 you might get a result if you specify a `Method` option such as `"OneStepRowReduction"` or maybe `"CofactorExpansion"`. (3) No method will handle the 18x18 setup you show. Just consider what it would look like in terms of cofactors, and how many distinct terms they must have. (4) If you post an indicative numerical example people might have ideas for what approach to use in order to keep numerical error at bay. – Daniel Lichtblau Sep 25 '14 at 22:45

1 Answers1

2

You simply need more memory:

The symbolic solution involves n+1 determinants, here is an estimate of the memory needed.

 bc[n_] := (A = Det[Array[a, {n, n}]];ByteCount[A])
 ListLogPlot[
     t = Table[ {n, (n + 1) bc[n] /1024^3 // N} , {n,2,10}], Joined -> True]

enter image description here

extrapolating to n=18 we can see you'll need only about 10^8 Gigabytes..

(thats 1000x more than the largest supercomputers for anyone not getting the point )

agentp
  • 6,849
  • 2
  • 19
  • 37