# Solving System of Equations

I want to solve a huge system of equations which is generated using the Finite-Difference-Method. The Problem with that system is that it is badly conditioned and so NSolve is not able to find solutions.

There are already some posts dealing with that kind of problem:

Badly conditioned matrix

Solving using LinearSolve

Solving a linear system with a badly conditioned matrix

Sadly non of that posts can actually help me with my Problem. Because of the size of the system calculating the condition number takes a lot of time and so I'm not able to "prove" that the system is badly conditioned. The final question would be if somebody know a way to solve that equations.

## 1 Answer

Are this equations linear ? If so you can try to transform the equations.

If you have a nearly linear dependent basis for your equations, it may help, first to search for a new orthogonalized basis, write the equation in this basis and then solve the equations.

As an example we solve a 3D problem: Given a not orthogonal badly conditioned basis: bas and a vector v, we are searching coefficients: coef, so that coef.bas == v:

b1 = {1., 0, 0}; b2 = {1., 1. 10^-12, 0}; b3 = {1, 0, 1. 10^-12};
bas = {b1, b2, b3};
v = a + 10^12 b + 10^12 c;
coef = {c1, c2, c3};
sol = Solve[coef.bas == v , coef][[1]];
Print["error= ", (coef /. sol).bas - v]
(*error= {1.08677*10^20,-1.90735*10^-6,0.}*)


This results in an error message: "General::luc: Result for 1 of badly conditioned matrix 2 may contain significant numerical errors." and trimendous errors.

On the other nad, if we first calculate a better, orthogonal basis, we obtain:

newbas = Orthogonalize[bas];
sol = Solve[coef.newbas == v, coef][[1]];
Print["Error= ", (coef /. sol).newbas - v];
(*Error= {0.,0.,0.}*)

• Thanks for your answer Daniel. For the last 2 days I thought about the Problem and how to solve it or how to describe it better so others could understand it. The conclusion was that I don't have enough knowledge to fully understand the underlaying Problem and ho to describe it so there will be plenty more days of lerning ahead. For your Question: Yes the equations are linear.
– CR36
Oct 15, 2020 at 6:34