# Revision history [back]

If I am understanding your question correctly - if you put the additional constraint of getting $x$ with the minimum norm, then you are asking for the Moore-Penrose pseudoinverse. In Sage you can explicitly call the pseudoinverse function of numpy

sage: MN = M.numpy()
sage: import numpy
sage: x = matrix(numpy.linalg.pinv(MN))*v


If I am understanding your question correctly - if you put the additional constraint of getting $x$ with the minimum norm, then you are asking for the Moore-Penrose pseudoinverse. In Sage you can explicitly call the pseudoinverse function of numpy

sage: MN = M.numpy()
sage: import numpy
sage: x = matrix(numpy.linalg.pinv(MN))*v


Edit: Even the command

sage: x = M \ v


works for a nonsquare matrix M. But I am not sure what this is actually doing for a nonsquare matrix. The documentation does not seem to explain.

If I am understanding your question correctly - if you put the additional constraint of getting $x$ with the minimum norm, then you are asking for the Moore-Penrose pseudoinverse. In Sage you can explicitly call the pseudoinverse function of numpy

sage: MN = M.numpy()
sage: import numpy
sage: x = matrix(numpy.linalg.pinv(MN))*v


Edit: Even the command

sage: x = M \ v


works for a nonsquare matrix M. But I am not sure what this is actually doing for a nonsquare matrix. The documentation does not seem to explain.explain. The solution obtained is not the same as obtained from the pseudoinverse.