A has 100 rows and 12 columns. Why is solve(A,b) not the ordinary least-squares operation?
MathematicsLevel: FoundationStable linear systems
A has 100 rows and 12 columns. Why is solve(A,b) not the ordinary least-squares operation?
Hints
- Check A's shape.
- Exact solution and best approximation differ.
Answer
solve expects a square full-rank system. Use a least-squares solver to minimize residual norm for the rectangular design.
Source and licence: NumPy — numerical linear algebra · BSD-3-Clause · answer: Quantoros editorial