How to calculate the degree of Lagrange polynomial to satisfy a given error?

340 Views Asked by At

I need help. I have $f(x)=sin(x)$. If I want to use Lagrange polynomial to make an approximation of $f(x)$, what should be the degree of that polynomial if I work in the interval $[0,\pi]$, and the error, $|sin(x)-L_n(x)|$ must be lesser or equal than 0.001 ?

In other words:$$|sin(x)-L_n(x)|={sin^{(n+1)}(c)\over(n+1)!}(x-x_o)...(x-x_n)\le0.001\ with \ 0\le c \le \pi $$

How to calculate $n$.

3

There are 3 best solutions below

0
On BEST ANSWER

Computation of the mininum $n$ seems difficult, especially because you give no information about the $x_i.$ If they are pair-wise different, you are on the safe side if you assume $$\left| \sin(x)-L_n(x)\right| \le\left| \frac{\sin^{(n+1)}(c)}{(n+1)!}(x-x_o)...(x-x_n)\right| \le \frac{\pi^{n+1}}{(n+1)!} =: E_n$$ and then compute the $E_n, n=1,2,\dots$ until $E_n< 0.01\;$ (or is it $0.001?$)

In any case $n=12\;$ should work, because $E_{10}\approx 0.00737,\;$ $E_{11}\approx 0.00192957,\;$ and $E_{12}\approx 0.0004663.$

0
On

Based on your question providing no points then gammatesters answer seems like the answer you want but assuming we picked some equidistant points and intervals of 1 / 2 such as

$$x_i = 0, \frac{1}{2},1,\frac{3}{2},2...3 $$

we could fit the polynomial

$f(x)=$

$a+(x-3)(b+(c+(d+(e+(f-g(x - h))(x-j))(x - .5))(x-k))x)$

with

$ a=.141120008$

$ b=.047040002$

$ c=-.411971103$

$d=-.0472466735$

$e=.037260033506$

$f=.00119275707$

$g=.001301301$

$h=1$

$j=2.5$

$k=1.5$

The residuals are much less than .001 as the graph of them shows$sin(x)-x_i$.

1
On

Ok, I've thinking in the question and I've conclude that:

$$\left|{sin^{(n+1)}(c)\over(n+1)!}\right| \le 0.001 = {\left|sin^{(n+1)}(c)\right|\over(n+1)!}\le 0.001$$

Given that the range of $f(x), f'(x),f''(x),...,f^{(n+1)}(x)$ is $-1 \le y \le 1$ and the working interval is $[0,\pi]$, thus $\left|sin^{(n+1)}(c)\right| \le 1 $. Then ${1\over{(n+1)!}}\le0.001 $.

Solving this inequation we can conclude that $(n+1)! \ge 1000$, therefore, $n=6$

I think I'm right but I'm not 100% sure.