# [Numpy-discussion] linear algebra help

josef.pktd@gmai... josef.pktd@gmai...
Sat May 16 08:34:15 CDT 2009

```On Sat, May 16, 2009 at 9:01 AM, Quilby <quilby@gmail.com> wrote:
> Hi-
> This is what I need to do-
>
> I have this equation-
>
> Ax = y
>
> Where A is a rational m*n matrix (m<=n), and x and y are vectors of
> the right size. I know A and y, I don't know what x is equal to. I
> also know that there is no x where Ax equals exactly y. I want to find
> the vector x' such that Ax' is as close as possible to y. Meaning that
> (Ax' - y) is as close as possible to (0,0,0,...0).
>
> I know that I need to use either the lstsq function:
> http://www.scipy.org/doc/numpy_api_docs/numpy.linalg.linalg.html#lstsq
>
> or the svd function:
> http://www.scipy.org/doc/numpy_api_docs/numpy.linalg.linalg.html#svd
>
> I don't understand the documentation at all. Can someone please show
> me how to use these functions to solve my problem.
>

Hi,

The new docs are more informative and are being improved in the online editor

see
http://docs.scipy.org/doc/
and
http://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.lstsq.html#numpy.linalg.lstsq

any comments and improvement to the docs are very welcome.

Josef
```