- #1
happybear
- 19
- 0
Homework Statement
According to Stone Weierstrass Theorem, there exists a polynomial such that lim P = |x|.
Can anyone give me an example of P? Maybe within the range of 0.01?
ie. |f-P|< 0.01
In the interest of making correct statements, what you mean is that there is a sequence of polynomials {Pn} such that limn -> inf Pn(x) = |x| uniformly in x. (Or... maybe you just mean that it converges at each value of x)happybear said:According to Stone Weierstrass Theorem, there exists a polynomial such that lim P = |x|.
Can anyone give me an example of P? Maybe within the range of 0.01?
ie. |f-P|< 0.01
dx said:The important facts are that the Legendre polynomials are both orthogonal and complete. This means that the mean square of the difference between f and the first n terms in the series goes to zero as n → ∞, i.e. the series converges uniformly to f.
dx said:The functions in your example are not orthogonal. I could be wrong, but I remember reading somewhere that orthogonality and completeness imply uniform convergence.
squidsoft said:I think it converges in the mean. Since the Legendre polynomials are orthogonal, then we can write:
[tex]f(x)=a_0 P_0(x)+a_1 P_1(x)+a_2 P_2(x)+\cdots[/tex]
with:
[tex]a_k=\frac{2k+1}{2}\int_{-1}^{1} f(x)P_k(x)dx[/tex]
I'd try say 25 of them programatically (in Mathematica) then compare it to [tex]f(x)=|x|[/tex] happybear.
f[x_] := Abs[x];
clist = Table[((2*n + 1)/2)*
Integrate[f[x]*LegendreP[n, x],
{x, -1, 1}], {n, 0, 25}];
g[x_] := Sum[clist[[n]]*LegendreP[n - 1,
x], {n, 1, 26}];
Plot[{f[x], g[x]}, {x, -1, 1}]
Yes, you can use any degree polynomial to approximate |x|, but the higher the degree, the closer the approximation will be to the actual function.
The coefficients of the polynomial can be determined by using the method of least squares. This involves minimizing the sum of the squared differences between the polynomial and the actual function at various points.
The best way to choose the points is to evenly distribute them over the range of x values, with a higher concentration of points near the origin. This will ensure a more accurate approximation.
Yes, there are other methods such as using the Taylor series expansion or using numerical integration techniques, but the method of least squares is the most commonly used and reliable method for finding the coefficients.
You can determine the accuracy of your polynomial by comparing it to the actual function at various points. The smaller the difference between the polynomial and the function, the better the approximation. Additionally, you can also calculate the root mean square error (RMSE) to measure the overall accuracy of the approximation.