Interval of $x$ for a $7^{\text{th}}$ degree polynomial

94 Views Asked by At

I want to use a $7^{\text{th}}$ degree polynomial centered at $a = 0$ to approximate the function $f(x)=\cos x$ with an error bound less than $0.1$. How could I find the largest interval for $x$?

1

There are 1 best solutions below

2
On BEST ANSWER

Consider Taylor's Theorem, that is for $c\in (a,x)$:

$$f(x)=\sum_{k=0}^{n-1}\frac {(x-a)^k}{k!}f^{(k)}(a)+\frac {(x-a)^n}{n!}f^{(n)}(c)$$

Note we call:

$$R_n=\frac {(b-a)^n}{n!}f^{(n)}(c)$$

The Lagrange remainder.

So consider the Taylor expansion of $f(x)=cos(x)$ at $x$ about $a=0$

$$cos(x)=\sum_{k=0}^{n-1}\frac {(x)^k}{k!}cos^{(k)}(0)+\frac {(x)^n}{n!}cos^{(n)}(c)$$

Which is equivalent to (for $n=7$):

$$cos(x)=cos(0)-sin(0)\frac {x^1}{1!} -cos(0)\frac {x^2}{2!} + sin(0)\frac {x^3}{3!} + cos(0)\frac {x^4}{4!} -sin(0)\frac {x^5}{5!}-cos(0)\frac {x^6}{6!}+R_7$$

Which thus simplifies to:

$$cos(x)=1-\frac {x^2}{2!}+\frac {x^4}{4!} - \frac {x^6}{6!}+R_7$$

Where $R_7=\frac {x^7}{7!}sin(c)$ for $c\in(0,x)$

Since $|sin(c)|<1$, we see for some $x$:

$$|R_7|<\frac {1}{7!}=\frac {1}{5040}<0.0002$$

For example, pick $x=1$, such that,

$$cos(1)\approx1-\frac 12+\frac {1}{24}-\frac {1}{720}=0.5402\bar7$$

So we note,

$$cos(1)\approx0.5402\bar7\pm0.0002$$

$\textbf{EDIT:}$

Usually as x increases, the error rapidly increases as well, for $f(x)=cos(x)$

Consider Lagrange's Error Bound formula for a polynomial of degree $n$ ($p_n(x)$):

$$|R_n|\leq\frac {B}{(n+1)!}|x-a|^{n+1}$$

Such that $R_n$ is the given error of a Taylor polynomial of $n$ terms in regards to its function $f(x)$, and $B$ is a value, such that $B\geq |f^{(n+1)}|$.

So, consider a Taylor polynomial, such that $n=7$ and $f(x)=cos(x)$, centered about $a=0$.

Then its error, as given by the above error bound formula is:

$$|R_7|\leq \frac {cos^{(7)}(x)}{7!}x^7\leq\frac {x^7}{7!}$$

Noting $B$ bounds $cos^{(7)}(x)$.

So, one can analogously apply the same formula, but for $x=5$. (It will take a lot more terms however, for an optimal error).