Linear least squares, condition number

Click For Summary
SUMMARY

The discussion centers on the Linear Least Squares problem, specifically the solution obtained through QR factorization using Givens rotations. The matrix A has a high condition number of approximately 42,429, yet both Octave and MATLAB yield the exact solution (1,1) with six-digit accuracy. The participants clarify that while a high condition number indicates potential numerical instability, it does not guarantee inaccuracy, as precision in input data and algorithmic consistency can lead to accurate results despite high condition numbers.

PREREQUISITES
  • Understanding of Linear Least Squares problems
  • Familiarity with QR factorization techniques
  • Knowledge of condition numbers in numerical linear algebra
  • Experience with Octave or MATLAB for numerical computations
NEXT STEPS
  • Study the implementation of Givens rotations in QR factorization
  • Explore the implications of condition numbers on numerical stability
  • Learn about the differences in numerical precision between Octave and MATLAB
  • Investigate the effects of input data precision on the accuracy of least squares solutions
USEFUL FOR

Students and professionals in numerical algebra, data scientists, and engineers working with linear regression models and numerical computations will benefit from this discussion.

azay
Messages
18
Reaction score
0
Hi,

I am trying to learn some numerical algebra. Now I don't understand the following.

I'm finding the solution to the Linear Least Squares problem min||A\lambda-y||_{2}, which turns out to be (1,1). I did this by doing a QR factorization using Givens rotations.

with:

<br /> A=<br /> \[ \left( \begin{array}{ccc}<br /> 1 &amp; 1\\<br /> 1 &amp; 1.0001\\<br /> 1 &amp; 1.0001\end{array} \right)\]
and
<br /> y=<br /> \[ \left( \begin{array}{ccc}<br /> 2\\<br /> 0.0001\\<br /> 4.0001\end{array} \right)\]<br />

Now, I have a Octave (matlab clone) program that does the same calculation. As the condition number of the matrix A is very large (4.2429e+004) (found by applying Octave's cond() function on A), I expect the solution to be at least not exact. Yet the Octave program gives the exact solution (1,1), at least, as far as I can see (6 digit accuracy I think), that is. Can someone explain this?

Also, should one consider the condition number of the matrix A when considering the condition of the Linear Least Squares problem, or the condition number of the Matrix A|y?
(The condition number of the latter is even bigger so my first question holds in any case).

Thank you :)
 
Physics news on Phys.org
The condition numbers don't tell you that something is definitely not accurate. They tell you what at least can be expected. There are a couple of possible reasons: the input is sufficiently precise for the data memory and algorithmic steps used, the algorithms are identical, or just by chance.
 
Matlab computes with internal numerical precision of approximately 1 part in 10^15 or 10^16, I forget which (unless you set it for greater precision). It therefore easily inverts a matrix of condition number 10^4. (In fact, it should work with condition numbers nearing 10^15.) Presumably Octave is similar.
 
  • Like
Likes   Reactions: FactChecker

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
Replies
2
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 14 ·
Replies
14
Views
2K