Re: [Numpy-discussion] Polyfit

2006-10-13 Thread Greg Willden
On 10/13/06, A. M. Archibald <[EMAIL PROTECTED]> wrote: In any case, all this is outside the purview of numpy (as is polyfit, frankly).Great.  Thanks for the ideas of other algorithms/functions to look at. Greg-- Linux.  Because rebooting is for adding hardware.

Re: [Numpy-discussion] Polyfit

2006-10-13 Thread A. M. Archibald
On 13/10/06, Greg Willden <[EMAIL PROTECTED]> wrote: > What about including multiple algorithms each returning a figure of fit? > Then I could try two or three different algorithms and then use the one that > works best for my data. The basic problem is that X^n is rarely a good basis for the fun

Re: [Numpy-discussion] Polyfit

2006-10-13 Thread Tim Hochberg
Greg Willden wrote: > On 10/13/06, *A. M. Archibald* <[EMAIL PROTECTED] > > wrote: > > At this point you might as well use a polynomial class that can > accomodate a variety of bases for the space of polynomials - X^n, > (X-a)^n, orthogonal polynomials (transl

Re: [Numpy-discussion] Polyfit

2006-10-13 Thread Greg Willden
On 10/13/06, A. M. Archibald <[EMAIL PROTECTED]> wrote: At this point you might as well use a polynomial class that canaccomodate a variety of bases for the space of polynomials - X^n,(X-a)^n, orthogonal polynomials (translated and scaled as needed),what have you. I think I vote for polyfit that is

Re: [Numpy-discussion] Polyfit

2006-10-13 Thread A. M. Archibald
On 13/10/06, Charles R Harris <[EMAIL PROTECTED]> wrote: > You can also get *much* better results if you scale the x interval to [0,1] > as the problem will be better posed. For instance, with your data and a > degree 10 fit I get a condition number of about 2e7 when x is scaled to > [0,1], as op

Re: [Numpy-discussion] Polyfit

2006-10-13 Thread Charles R Harris
On 10/12/06, Greg Willden <[EMAIL PROTECTED]> wrote: On 10/12/06, Charles R Harris <[EMAIL PROTECTED] > wrote: And here is the location of the problem in numpy/linalg/linalg.py :def lstsq(a, b, rcond=1.e-10): The 1e-10 is a bit conservative. On the other hand, I will note that the condition number

Re: [Numpy-discussion] Polyfit

2006-10-12 Thread Greg Willden
On 10/12/06, Charles R Harris <[EMAIL PROTECTED]> wrote: And here is the location of the problem in numpy/linalg/linalg.py :def lstsq(a, b, rcond=1.e-10): The 1e-10 is a bit conservative. On the other hand, I will note that the condition number of the dot(V^T ,V) matrix is somewhere around 1e22, wh

Re: [Numpy-discussion] Polyfit

2006-10-12 Thread Charles R Harris
On 10/12/06, Charles R Harris <[EMAIL PROTECTED]> wrote: On 10/12/06, Charles R Harris < [EMAIL PROTECTED]> wrote: On 10/12/06, Greg Willden < [EMAIL PROTECTED]> wrote: On 10/12/06, Charles R Harris <[EMAIL PROTECTED] > wrote: I'm guessing that the rcond number in the lstsq version (default 1e-10)

Re: [Numpy-discussion] Polyfit

2006-10-12 Thread Charles R Harris
On 10/12/06, Charles R Harris <[EMAIL PROTECTED]> wrote: On 10/12/06, Greg Willden < [EMAIL PROTECTED]> wrote: On 10/12/06, Charles R Harris <[EMAIL PROTECTED] > wrote: I'm guessing that the rcond number in the lstsq version (default 1e-10) is the difference. Generally the lstsq version should wor

Re: [Numpy-discussion] Polyfit

2006-10-12 Thread Charles R Harris
On 10/12/06, Greg Willden <[EMAIL PROTECTED]> wrote: On 10/12/06, Charles R Harris <[EMAIL PROTECTED] > wrote: I'm guessing that the rcond number in the lstsq version (default 1e-10) is the difference. Generally the lstsq version should work better than the MPL version because at*a is not as well c

Re: [Numpy-discussion] Polyfit

2006-10-12 Thread Greg Willden
On 10/12/06, Charles R Harris <[EMAIL PROTECTED]> wrote: I'm guessing that the rcond number in the lstsq version (default 1e-10) is the difference. Generally the lstsq version should work better than the MPL version because at*a is not as well conditioned and vandermonde matrices are notoriously il

Re: [Numpy-discussion] Polyfit

2006-10-12 Thread Charles R Harris
On 10/12/06, Greg Willden <[EMAIL PROTECTED]> wrote: Hi All,I'm using numpy.polyfit and it is giving me some really strange results when evaluated near 0.  So I compared it with polyfit in matplotlib and the code and docstrings are nearly identical.  However the slight differences in the code make