Polyfit

A. M. Archibald peridot.faceted at gmail.com
Fri Oct 13 16:03:47 CDT 2006


On 13/10/06, Greg Willden <gregwillden at gmail.com> 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 functions
on [a,b]. So if you want it to return the coefficients of a
polynomial, you're basically stuck. If you *don't* want that, there's
a whole bestiary of other options.

If you're just looking to put a smooth curve through a bunch of data
points (perhaps with known uncertainties), scipy.interpolate includes
some nice spline fitting functions.

If you're looking for polynomials, orthogonal polynomials may serve as
a better basis for your interval; you can look in scipy.special for
them (and leastsq will fit them to your points). Extracting their
coefficients is possible but will bring you back to numerical
instabilities.

In any case, all this is outside the purview of numpy (as is polyfit, frankly).

A. M. Archibald

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642




More information about the Numpy-discussion mailing list