[Numpy-discussion] linear algebra help
Sun May 17 12:21:16 CDT 2009
On Sun, May 17, 2009 at 12:14 PM, Quilby <firstname.lastname@example.org> wrote:
> Right the dimensions I gave were wrong.
> What do I need to do for m>=n (more rows than columns)? Can I use the
> same function?
> When I run the script written by Nils (thanks!) I get:
> from numpy.random import rand, seed
> ImportError: No module named random
> But importing numpy works ok. What do I need to install?
This should be working without extra install. You could run the test
suite, numpy.test(), to see whether your install is ok.
Otherwise, you would need to provide more information, numpy version, ....
np.lstsq works for m>n, m<n and m=n, however the meaning of the
solution is different in the 3 cases.
m>n (more observations than parameters) is the standard least squares
> Thanks again!
> On Sun, May 17, 2009 at 1:51 AM, Alan G Isaac <email@example.com> wrote:
>> On 5/16/2009 9:01 AM Quilby apparently wrote:
>>> 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.
>> If m<=n, that can only be true if there are not
>> m linearly independent columns of A. Are you
>> sure you have the dimensions right?
>> Alan Isaac
More information about the Numpy-discussion