Polynomial approximation: Chebyshev and Legendre

ch3cooh

Chebyshev polynomials and Legendre polynomials are both orthogonal polynomials for determining the least square approximation of a function. Aren't they supposed to give the same result for a given function?
I tried mathematica but the I didn't get the same answer :( Is this precision problem or something else?
Code:
In:= Collect[
Sum[Integrate[LegendreP[i, x]*Sin[2 x], {x, -1, 1}]/
Integrate[LegendreP[i, x]^2, {x, -1, 1}]*LegendreP[i, x], {i, 0,
3}], x] // N

Out= 1.94378 x - 1.06264 x^3

In:= Collect[
Sum[Integrate[
1/Sqrt[1 - x^2] ChebyshevT[i, x]*Sin[2 x], {x, -1, 1}]/
Integrate[1/Sqrt[1 - x^2] ChebyshevT[i, x]^2, {x, -1, 1}]*
ChebyshevT[i, x], {i, 0, 3}], x] // N

Out= 1.92711 x - 1.03155 x^3

Stephen Tashi

Aren't they supposed to give the same result for a given function?
You'll probably get more help if you explain what result you are talking about in standard mathematical notation.

LCKurtz

Homework Helper
Gold Member
Chebyshev polynomials and Legendre polynomials are both orthogonal polynomials for determining the least square approximation of a function. Aren't they supposed to give the same result for a given function?

I haven't looked at that stuff in years, but I think the answer is "no". They have different weight functions which give different inner products and consequently different norms in which to measure the least squares fit.

Stephen Tashi

I think "least squares fit" makes it clear what norm is used to measure the fit. For a "nice" function (one that can be expressed as an infinite power series) , if you express it as an infinite series of Chebyshev polynomials you get an exact fit. You also get an exact fit if you express it as an infinite series of some other family of othrogonal polynomials. So perhaps the question has to do with approximating the function as a finite series.

I find the Mathematica code in the original post puzzling. It looks like its computing a ratio between a function and the approximating function.

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving