# Numerical: solve a linear system with a badly conditioned matrix or reduce the calculation time

I have a linear system Ax = B, and matrix A is a bad matrix. If I use the code "X= Inverse

The[[A].second"or"X= LinearSolve

The[[A].second", I will get an obviously incorrect result like the top image, but if I use the code X= Inverse[Rationalize

The[Rationalize[[Rationalize[A, 10 ^ -16]].second, I will get a much better result, like the image below. The question is that the computation time is too long. When the matrix is ​​only 200 * 200. So, I want to ask, how can I reduce the computation time or use other codes to solve the linear system?
I'm sorry that the original code is very long, I can not put it here.
There is a small simple matrix, 12 * 12

``````A = {{150869.85480902853` - 232538.29630896242` I, -391089.2645485263`
6.469745510123445` * ^ - 11 I, 0,
264364.9958612759` - 712689.3442556316` I,
627231.0125907313`
1.6298266019401785` * ^ 6 I, -1.345546743295786` * ^ 6 -
1.0652730659247206` * ^ 6 I,
4.922421633176686` * ^ 9 +
3.181192263419026` * ^ 7 I, -1.9935907340970628` * ^ 9 -
2.931608935576437` * ^ 9 I}, {-391089.2645485263` +
6.469745510123445` * ^ - 11 I,
150869.85480902853` + 232538.29630896242` I,
264364.9958612759` + 712689.3442556316` I,
0, -1.345546743295786` * ^ 6 + 1.0652730659247206` * ^ 6 I,
627231.0125907313` +
1.6298266019401785` * ^ 6 I, -1.9935907340970628` * ^ 9 +
2.931608935576437` * ^ 9 I,
4.922421633176686` * ^ 9 - 3.181192263419026` * ^ 7 I}, {0,
264364.995861218` + 712689.3442556171` I,
2.7636147858277716` * ^ 11 +
2.0364295813231016` * ^ 12 I, -2.89952165839177` * ^ 12 +
0.006331751876821655` I, -7.371596562146723` * ^ 6 +
7.741782016730528` * ^ 6 I, -3.6319250211948287` * ^ 6 -
6.788506993107284` * ^ 6 I,
2.7177039977179045` * ^ 15 - 5.306585167886013` * ^ 15 I,
5.796117521256515` * ^ 15 -
8.563755277562708` * ^ 14 I}, {264364.995861218` -
712689.3442556171` I,
0, -2.89952165839177` * ^ 12 - 0.006331751876821655` I,
2.7636147858277716` * ^ 11 -
2.0364295813231016` * ^ 12 I, -3.6319250211948287` * ^ 6 +
6.788506993107284` * ^ 6 I, -7.371596562146723` * ^ 6 -
7.741782016730528` * ^ 6 I,
5.796117521256515` * ^ 15 + 8.563755277562708` * ^ 14 I,
2.7177039977179045` * ^ 15 +
5.306585167886013` * ^ 15 I}, {627231.012590726` -
1.6298266019401834` * ^ 6 I, -1.345546743295793` * ^ 6 +
1.0652730659247246` * ^ 6 I, -7.371596562146611` * ^ 6 +
7.741782016730661` * ^ 6 I, -3.6319250211943253` * ^ 6 +
6.788506993106979` * ^ 6 I,
856556.7904071911` -
1.3962653953136306` * ^ 7 I, -2.166354302594853` * ^ 7 +
2.055533699488225` * ^ - 8 I,
0, -1.2114926606946392` * ^ 9 -
2.438231863800305` * ^ 9 I}, {-1.345546743295793` * ^ 6 -
1.0652730659247246` * ^ 6 I,
627231.012590726` +
1.6298266019401834` * ^ 6 I, -3.6319250211943253` * ^ 6 -
6.788506993106979` * ^ 6 I, -7.371596562146611` * ^ 6 -
7.741782016730661` * ^ 6 I, -2.166354302594853` * ^ 7 -
2.055533699488225` * ^ - 8 I,
856556.7904071911` +
1.3962653953136306` * ^ 7 I, -1.2114926606946392` * ^ 9 +
2.438231863800305` * ^ 9 I,
0}, {4.922421633176979` * ^ 9 +
3.181192263430178` * ^ 7 I, -1.9935907340969403` * ^ 9 +
2.9316089355759106` * ^ 9 I,
2.7177039977181365` * ^ 15 - 5.306585167886134` * ^ 15 I,
5.796117521256721` * ^ 15 + 8.563755277564592` * ^ 14 I,
0, -1.2114926606946335` * ^ 9 +
2.4382318638001614` * ^ 9 I, -1.8307386534369913` * ^ 19 +
1.2184777898030103` * ^ 19 I, -3.4056663972456452` * ^ 19 -
537661.8990265632` I}, {-1.9935907340969403` * ^ 9 -
2.9316089355759106` * ^ 9 I,
4.922421633176979` * ^ 9 - 3.181192263430178` * ^ 7 I,
5.796117521256721` * ^ 15 - 8.563755277564592` * ^ 14 I,
2.7177039977181365` * ^ 15 +
5.306585167886134` * ^ 15 I, -1.2114926606946335` * ^ 9 -
2.4382318638001614` * ^ 9 I,
0, -3.4056663972456452` * ^ 19 +
537661.8990265632` I, -1.8307386534369913` * ^ 19 -
1.2184777898030103` * ^ 19 I}}
``````