# Approximation using Legendre polynomials

my aim is to fit data points by the use of Legendre Polynomials. Has anybody experience with this task? My final aim is to do this automatically with mathematica.

Thanks, rainer

-
"My final aim is to do this automatically with mathematica" - Look up Fit[] –  Guess who it is. Aug 20 '12 at 8:00

## 1 Answer

Is it enough to use to Legendre Polynomials as basis within the Fit[] Function. Fit[data,{LegendreP[1,x],LegendreP[2,x],LegendreP[3,x]},x] I would be glad about an explanation how it actually works. Thx rainer

-
You've forgotten the constant term: Fit[data, {1, LegendreP[1, x], LegendreP[2, x], LegendreP[3, x]}, x] –  Guess who it is. Aug 21 '12 at 0:51
The problem is for an arbitrary set of data points this produces exactely the same solution as: Fit[data, {1,x,x^2,x^3}, x]. So I do not understand what the special thing about Legendre Approximation is. –  rainer Aug 21 '12 at 5:51