# Thread: Find a polynomial approaching |x| with error 0.1

1. ## Find a polynomial approaching |x| with error 0.1

How can I find a polynomial approaching |x| such that the maximum error is 0.1?

2. I'm pretty sure that the answer will depend on what interval you are considering. I say this because most of the approximation theorems I am aware of (that would be useful in this case) rely on you working on some closed interval $\displaystyle [a,b]$.

3. yes. From [-1,1]

4. Well the Stone-Weirestrass theorem states that this is possible. However, in most proofs I have seen you never actually see how to construct such polynomials.

Though not all hope is lost. Look at Bernstein Polynomials. Here is a link to the Wikipedia page on them. Also a while back I wrote a blog entry on just this topic, here is a link to the post. I don't think that I mentioned this in the post say using the method described in the post you end up with a polynomial of degree $\displaystyle n$, there might be other polynomials of lower degree that also give you the desired error. This is because of some very conservative estimations that are made.

5. Well. I try to use the Therem, but no metter what degree I put, the expansion will just cancell evey term excerpt for |x|, this is not the one that I can find

6. Obviously, you only need even powers. If you tried, say $\displaystyle ax^4+ bx^2$, then the error, for given x is $\displaystyle |ax^4+ bx^2- |x||$. Because of symmetry, it is sufficient to look at x> 0 so that is $\displaystyle |ax^4+ bx^2- x|$. Is it possible to choose a and b so that is never larger than .1 for all x between -1 and 1?

7. Originally Posted by happybear
Well. I try to use the Therem, but no metter what degree I put, the expansion will just cancell evey term excerpt for |x|, this is not the one that I can find
The theorems regarding approximation with polynomials often assume the domain of the function is [0,1]. If you want an approximation on [-1,1] you will need to make an adjustment.

8. The function to be round up in the interval $\displaystyle [-1,1]$ is $\displaystyle y(x) = |x|$ and it is an even function, so that we search an even polinomial of degree $\displaystyle 2n$ written as $\displaystyle p(x)= \sum_{k=0}^{n} p_{k}\cdot x^{2k}$ that approximates $\displaystyle y(x)$ in 'min-max' sense. If we indicate the 'error function' with $\displaystyle e(x)= y(x)-p(x)$, the 'min-max condition' force that to be...

$\displaystyle e(\frac{k}{n+1}) = (-1)^{k}\cdot e$ , $\displaystyle k=0,1,...,n+1$ (1)

The (1) is a system of linear equations in the unknown variables $\displaystyle p_{0},p_{1}, ... , p_{n}, e$ that can be solved in standard way. In the case $\displaystyle n=1$ it becomes...

$\displaystyle p_{0} + e = 0$

$\displaystyle p_{0} + \frac{p_{1}}{4} - e = \frac{1}{2}$

$\displaystyle p_{0} + p_{1} + e = 1$ (2)

... the solution of which is $\displaystyle p_{0}= \frac{1}{8}, p_{1}= 1, e=-\frac{1}{8}$ , so that the 'min-max' polynomial is $\displaystyle p(x)= \frac{1}{8} + x^{2}$ and the error is alternatively $\displaystyle +.125$ and $\displaystyle -.125$. You require an error not grater than $\displaystyle .1$, so that the min-max polynomial is of order $\displaystyle 4$ , i.e. $\displaystyle n=2$ and (1) becomes...

$\displaystyle p_{0} + e =0$

$\displaystyle p_{0} + \frac{p_{1}}{9} + \frac {p_{2}}{81} - e = \frac{1}{3}$

$\displaystyle p_{0} + \frac{4}{9}\cdot p_{1} + \frac{16}{81}\cdot p_{2} + e = \frac{2}{3}$

$\displaystyle p_{0} + p_{1} + p_{2} - e = 1$ (3)

... the solution of which is left as exercise ...

Kind regards

$\displaystyle \chi$ $\displaystyle \sigma$

9. The 'solution' of the 'exercise' I have proposed in the last post is $\displaystyle p_{0}=\frac{1}{16}, p_{1}= 2, p_{2}= -\frac{9}{8}, e= -\frac{1}{16}$ , so that the min-max polynomial of degree 4 gives an approximation with maximum error $\displaystyle e= .0625$...

If greater precision is required it is necessary to increase $\displaystyle n$ and the maximum error I suppose is $\displaystyle e= \frac{1}{2^{n+2}}$...

Kind regards

$\displaystyle \chi$ $\displaystyle \sigma$