0

I solved a linear equation system with np.linalg.lstsq() but I could not define a boolean which returns TRUE if the solution of the system is unique. Thank you in advance!

1 Answers1

0

Looking at https://numpy.org/doc/stable/reference/generated/numpy.linalg.lstsq.html my reading is that the solution is always unique, because they are using the SVD, and if the matrix A is rank deficient, it returns the minimiser x that is itself of minimal norm, and this vector is unique.

However the routine also returns the rank of the matrix A, and iff this is less than the number of columns of A there will be many x's that minimise |A*x-b|, so in this sense the solution is not unique iff the returned rank is less than the number of columns.

dmuir
  • 4,211
  • 2
  • 14
  • 12