From: jpc@a.cs.okstate.edu (John Chandler) Newsgroups: sci.math.num-analysis Subject: Re: C Code for high order polynomial curve fitting? Date: 4 Nov 1996 17:06:46 GMT In article <55kgba$uac@rs18.hrz.th-darmstadt.de>, Peter Spellucci wrote: >In article <01bbc80b$f4ad1580$b15392cf@michael-clark>, >"Michael Clark" writes: >|> Does anyone have/know of/ can explain a alogarithum to curve fit x data >|> points with a y orderd polynominal >|> >|> Thanks >|> Mike Clark >|> clarkmj@worldnet.att.net >|> >|> PS fortran is ok >you may use dgless in clapack the c_translated version of lapack Is dgless a routine specifically designed for least squares fitting of polynomials to data? If so, fine, but one should almost never use any general linear least squares software to fit a polynomial to data using a monomial basis. Specifically, never fit a polynomial of any considerable degree using a sum of monomials form: pn(x) = a0 + a1*x + a2*x^2 + a3*x^3 + ... + an*x^n The monomials form a nonorthogonal basis that leads to highly and unnecessarily ill-conditioned linear least squares problems. The best basis for least squares fitting of polynomials to discrete data is the set of polynomials that are orthogonal with respect to (weighted) summation over the data abscissae. Routines for fitting these polynomials can be found in Conte and deBoor, "Elementary Numerical Analysis", McGraw-Hill, 1980 Shampine and Allen, "Numerical Computing: An Introduction", W. B. Saunders Company, 1973 (new edition to appear imminently) If a basis is preferred that does not change when a datum point is added, the best choice is usually Legendre polynomials, with the data abscissae transformed linearly to [-1,1]. -- John Chandler jpc@a.cs.okstate.edu