On 13/10/06, Charles R Harris <[EMAIL PROTECTED]> wrote: > > > > On 10/13/06, A. M. Archibald <[EMAIL PROTECTED]> wrote: > > On 12/10/06, Charles R Harris <[EMAIL PROTECTED]> wrote: > > > Hi all, > > > > > > I note that polyfit looks like it should work for single and double, > real > > > and complex, polynomials. On the otherhand, the default rcond needs to > > > depend on the underlying precision. On the other, other hand, all the > svd > > > computations are done with dgelsd or zgelsd, i.e., double precision. > Even so > > > problems can arise from inherent errors of the input data if it is > single > > > precision to start with. I also think the final degree of the fit should > be > > > available somewhere if wanted, as it is an indication of what is going > on. > > > Sooo, any suggestions as to what to do? My initial impulse would be to > set > > > rcond=1e-6 for single, 1e-14 for double, make rcond a keyword, and kick > the > > > can down the road on returning the actual degree of the fit. > > > > I'd also be inclined to output a warning (which the user can ignore, > > read or trap as necessary) if the condition number is too bad or they > > supplied an rcond that is too small for the precision of their data. > > That sounds good, but how to do it? Should I raise an exception? I would > also have to modify lstsq so it returns the degree of the fit which would > mess up the current interface.
Python's warnings module is a decent solution for providing this information. Goodness-of-fit worries me less than ill-conditioning - users are going to expect the curve to deviate from their function (and an easy reliable way to get goodness of fit is sqrt(sum(abs(f(xs)-polynomial(xs))**2)); this is certain to take into account any roundoff errors introduced anywhere). But they may well have no idea they should be worried about the condition number of some matrix they've never heard of. 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 _______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion