Why using mldivide to solve high dimension linear equations would cause computational error
Mostra commenti meno recenti
I tried to use A\b to solve the linear equation Ax=b, where A is a n*n matrix shown as followed:

when n is relatively small (like 10 or 20), it provided a good solution. But when n is greater than approximately 60, the solution provided is drifted from the real answer. The error between the provided solution and the actual solution becomes greater and greater when n increase.
I was wondering why this happened. A hint is said that the gaussian elimination for the matrix A is unstable, and coincidentally, the mldivide operation \ is using gaussian elimination. However, I still cannot find a obvious relation between the hint and the phenomenon.
Risposta accettata
Più risposte (2)
To the OP:
Try taking different values of the RHS b. I'm pretty sure that for some particular vectors b, even the solution with perturbed A will not be accurate. There is no other explanation, since the condition numbers of A and A+perturbation are equally large.
2 Commenti
Jiasen
il 24 Ott 2014
Thanks for taking the trouble to reply.
Yes, I think you are indeed right. In fact a condition number of 40 or 50 is actually quite small and should not lead to such large errors particularly when we are doing things upto 15 digits of precision. As further evidence that it is indeed instability in Gaussian elimination, take the following matrix:
B = A(end:-1:1, end:-1:1)
From the point of view of system of equations, this is exactly equivalent to the system obtained from A. Moreover condition number of A is the same as condition number of B. However taking b = rand(n,1) and solving:
y = B\b
the answer for y is very accurate, which shows that it has nothing to do with condition number and everything to do with the algorithm used for solution.
It would be good if you could post an answer and mark it answered yourself so that others could see the real reason and not be misled.
Regards.
[added later: Oh, I see that there is already an accepted answer so perhaps you could just add another answer]
Categorie
Scopri di più su Linear Algebra in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!