# Solving a Large Sparse ill Conditioned Linear System of Equations?

Recently, I have been working on my code to optimize the run time. In that code, I have several linear system of equations which start from small ones (5 equations- 5 unknowns) to large ones (5000 equations - 5000 unknowns). I have used the Solve command for finding the solution of these systems.

It may worth mentioning that the systems are sparse and ill conditioned (the condition number of the coefficient matrix is fairly large).

Now, I am wondering that if there is any other command which solve these systems faster? Any other hints for improving the run time is appreciated.

• Try Root or, if appropriate, FindInstance. Simplify and FullSimplify can be of use too. Jun 4, 2017 at 22:37
• Or how about LinearSolve? Jun 4, 2017 at 22:37
• @bills: Does that perform faster than solve? I thought that solve may call that function itself. Jun 5, 2017 at 5:51
• @bills: Do you know what solution methods in LinearSolve are appropriate for large sparse ill conditioned systems? Jun 8, 2017 at 8:09
• @DavidG.Stork: How Simplify and FullSimplify can be useful!? Do you any further experience with Root and FindInstance? Jun 8, 2017 at 8:11

As suggested in the comments, using LinearSolve is a good option. I could reduce the run time from 1.9 minutes to 0.6 minutes. Here is a simple procedure which uses LinearSolve and give an output in the format of rules which can be used for further substitution of the solution. Also, one can play around with the method of solution. In my case, Method -> "Multifrontal" was the best.
LinSol[Eqs_, Vars_] := Module[{b, A, Sol, SolRule},

• SolRule = {}; Do[SolRule = Union[SolRule, {Vars[[i]] -> Sol[[i]]}], {i,1,Length[Vars]}]; SolRule can be simplified to SolRule = Thread[Vars -> Sol] Jun 5, 2017 at 10:24