[SciPy-user] Python - Matlab least squares difference

A. Rachel Grinberg agree74 at hotmail.com
Fri Jun 2 15:48:43 CDT 2006


Hi,

I noticed a difference between the linear least square solutions in Python 
and Matlab. I understand that if the system is underdetermined the solution 
is not going to be unique, nevertheless I would like figure out the 
algorithm Matlab is using, since it seems "better" to me. For example, let's 
say I have a Matrix
      2 1 0
A = 1 1 1 and b = (0,1)'

While Matlab yields (0,0,1)' as the solution to A\b, scipy's result for 
linalg.linear_least_squares(A,b) is

array([[-0.16666667],
       [ 0.33333333],
       [ 0.83333333]])

Any ideas, how Matlab's A\b is implemented?

Thank you,
Rachel

_________________________________________________________________
On the road to retirement? Check out MSN Life Events for advice on how to 
get there! http://lifeevents.msn.com/category.aspx?cid=Retirement



More information about the SciPy-user mailing list