From: A. M. A. <per...@gm...> - 2006-10-13 21:03:49
|
On 13/10/06, Greg Willden <gre...@gm...> 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 |