2

I have an underdetermined equation set (m equations of n variables, m smaller than n). As such, if it is solvable then the set of solutions are a linear space (if it is a homogenic set) or affine space (non-homogenic).

Is there an easy way in Python (possibly with other libraries) to obtain this space - for example, a basis of which?

Thanks.

R S
  • 11,359
  • 10
  • 43
  • 50

2 Answers2

2

Use linalg package from SciPy

vartec
  • 131,205
  • 36
  • 218
  • 244
1

Like the previous poster said, you'll want linalg from SciPy, but focus on the Singular Value Decomposition solution. The matrix U is the basis for the output vectors.

duffymo
  • 305,152
  • 44
  • 369
  • 561
  • 1
    I'm not sure I understand what you're suggesting. Trying `scipy.linalg.svd` for a few simple underdetermined inputs, the U matrix doesn't look anything like a basis for the solution set. Also, I don't see what you'd do for an inhomogeneous system. – user2357112 Oct 28 '16 at 00:17
  • It's actually the QR decomposition that's relevant here, not SVD. – KishKash Oct 02 '22 at 12:44