polyfit implementation

Hello Andrea,

andrea_gavana@...517... a �crit :

That does not depend on Numeric, numarray or Matlab. Is your data. If you
try, in Matlab, to see how polyfit works (type polyfit), you will see with
a simple trial that your data are bad conditioned. As an example, if x,
y are the 2 rows of your data:

In fact, try to take a look at the condition number of your matrix R:

condest(R)

ans =

     3.89823249817041e+025

That's too high. Neither Matlab, Python or whatever software will give you
a result on which you can rely. Maybe at a first glance Matlab seems to
be more powerful (and, in general, this is the case), but be aware that
you should not trust on results that are affected by so bad conditioning
number/numerical errors.
Try to reduce the number of points (some of them are too close), or try
a non-linear regression (as lsqnonlin), even if you should not need such
a tool in order to do the job.

I totally agree to the fact that my problem is highly badly conditioned. But as this may not always be the case, I would have preferred polyfit to give reliable results without having to track the condition number. Do you know how to get it from within Python?

Indeed I do not use the fitted polynomials directly but their
derivatives. Doing so, fitting errors are increased and I noticed that
Matlab keeps providing reliable results for the few input data I tested.
This is not the case with Numeric or numarray.

JM.