Solving Linear Equations with Poorly Conditioned Matrices

In summary, the conversation discusses the use of MATLAB to solve a system of linear equations. The equation can be expressed as XA=Y and the vector Y and matrix A are given. The conversation explores different methods to solve for X, including rephrasing the equation as AtXt=Yt and using the commands X=Y/A or X=Y*inv(A). However, due to the matrix A's poor condition, the results may be inaccurate. The conversation also mentions the use of the rcond function in MATLAB to check the condition of A and suggests using a nonlinear solver, such as fsolve, to find a more reliable solution. The conversation ends with a question about which forum to post questions on numerical methods.
  • #1
matematikawan
338
0
I have a system of linear equations which can be expressed as XA=Y where X and Y are row vectors. The vector Y and the matrix A are given. I need to solve for X.
I can rephrase the same equation as AtXt=Yt but the answer will still be the same.

I try using MATLAB to solve for X using the commands X=Y/A or X=Y*inv(A). Matlab do give an answer but it comes with the message

"Warning: Matrix is close to singular or badly scaled.
Results may be inaccurate. RCOND = 2.336280e-028. "

I have check that the determinant of A is not zero although it is near zero. Hence A is not singular. The problem may be due to condition number of the matrix A, I think. What does the RCOND in the message meant?

If I still want to solve the equation although the matrix is badly condition, what a better method should I use?
 
Physics news on Phys.org
  • #2
Here's a link to a page for matlab's rcond function: http://www.nacs.uci.edu/dcslib/matlab/matlab-v53/help/techdoc/ref/rcond.html
 
Last edited by a moderator:
  • #3
rcond is the reciprocal of the condition of A. Thanks Mark. So my matrix A is badly condition. The answer obtained is not reliable. However not much I can do about it because the matrix A is a given matrix with entry number in the range [0,1]. In my work (i discretize pde) I only change Y.

Is there any hope for me, say using other method, to solve the equation with reliable answer?

I see there is also a thread on Condition number.
https://www.physicsforums.com/showthread.php?t=350038

I will be following that also, in case there are helpful response.
 
  • #4
I'm from that thread you linked. My method of solving a poorly conditioned system is to use a nonlinear solver.

If you have a system Ax = b then you can program a function in MATLAB to take an input of x and the output would be Ax - b.

I.E. F(x) = Ax - b (which ideally equals 0 for the desired value of x).

In this case, you'd want to find the zeros of F to find the solution to x. Matlab's built in fsolve function works well here. Be warned though, as was the case in my problem, since the matrix A is poorly conditioned, yes it will give you a solution but it may not be a good solution.
 
  • #5
I hope you don't mind that I put the link to your thread here. Now I can understand better what you had written in your previous post (the one at your started thread).

The only nonlinear numerical method that I know is the Newton-Raphson method (NR). I do not know what algorithm is behind the MATLAB nonlinear solver fsolve().

The NR that I know required an initial estimation for the zero because nonlinear equation in general can have more than one root. This is an extra information that we have to supply which we shouldn't be doing because our equations have only one zero.

Also the algorithm behind the NR still required it to solve system of linear equations. So it back to square one, the problem with the condition number.




ps. Actually to which forum should I post questions on numerical method?
 
  • #6

1. What is a poorly conditioned matrix?

A poorly conditioned matrix is a matrix in which small changes in the input data can cause large changes in the output results. This can make solving linear equations using the matrix very difficult and can result in inaccurate solutions.

2. How do you know if a matrix is poorly conditioned?

A matrix is considered poorly conditioned if its condition number is large. The condition number is a measure of how sensitive the solution is to changes in the input data. If the condition number is close to 1, the matrix is well conditioned, but if it is significantly larger than 1, the matrix is poorly conditioned.

3. What causes a matrix to be poorly conditioned?

A matrix can become poorly conditioned due to various reasons, such as having very small or very large elements, having a high degree of symmetry, or having nearly dependent rows or columns. These factors can make the matrix sensitive to small changes and lead to inaccurate solutions.

4. How does a poorly conditioned matrix affect the solution of a linear equation?

A poorly conditioned matrix can lead to inaccurate solutions for a linear equation. Even a small error in the input data can result in a significant error in the output solution. This can make it challenging to solve linear equations using a poorly conditioned matrix and can require specialized techniques to improve the accuracy of the solution.

5. Can a poorly conditioned matrix be fixed?

In some cases, it is possible to improve the conditioning of a matrix by using techniques such as scaling or reordering the rows and columns. However, in some cases, the matrix may be inherently poorly conditioned and cannot be improved. In these cases, it is important to use caution when solving linear equations using the matrix and to check the accuracy of the solution.

Similar threads

  • Linear and Abstract Algebra
Replies
4
Views
852
  • Linear and Abstract Algebra
Replies
6
Views
490
  • Linear and Abstract Algebra
Replies
4
Views
2K
  • Linear and Abstract Algebra
Replies
5
Views
1K
  • Linear and Abstract Algebra
Replies
14
Views
2K
  • Linear and Abstract Algebra
Replies
6
Views
1K
Replies
2
Views
1K
  • Linear and Abstract Algebra
Replies
2
Views
1K
  • Linear and Abstract Algebra
Replies
2
Views
967
  • Linear and Abstract Algebra
Replies
12
Views
2K
Back
Top