<?xml version="1.0" encoding="UTF-8"?>

<record version="4" id="6782">
 <title>example of Taylor polynomials for $\sin x$</title>
 <name>ExampleOfTaylorPolynomialsForSinX</name>
 <created>2005-02-18 15:39:02</created>
 <modified>2005-03-23 08:40:43</modified>
 <type>Example</type>
<parent id="709">Taylor series</parent>
 <creator id="2414" name="alozano"/>
 <author id="2414" name="alozano"/>
 <classification>
	<category scheme="msc" code="41A58"/>
 </classification>
 <related>
	<object name="ComplexSineAndCosine"/>
	<object name="HigherOrderDerivativesOfSineAndCosine"/>
 </related>
 <keywords>
	<term>Taylor polynomial</term>
	<term>pretty graphs</term>
	<term>sine function</term>
 </keywords>
 <preamble>% this is the default PlanetMath preamble.  as your knowledge
% of TeX increases, you will probably want to edit this, but
% it should be fine as is for beginners.

% almost certainly you want these
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}

% used for TeXing text within eps files
%\usepackage{psfrag}
% need this for including graphics (\includegraphics)
\usepackage{graphicx}
% for neatly defining theorems and propositions
%\usepackage{amsthm}
% making logically defined graphics
%\usepackage{xypic}

% there are many more packages, add them here as you need them

% define commands here

\newtheorem{thm}{Theorem}
\newtheorem{defn}{Definition}
\newtheorem{prop}{Proposition}
\newtheorem{lemma}{Lemma}
\newtheorem{cor}{Corollary}

% Some sets
\newcommand{\Nats}{\mathbb{N}}
\newcommand{\Ints}{\mathbb{Z}}
\newcommand{\Reals}{\mathbb{R}}
\newcommand{\Complex}{\mathbb{C}}
\newcommand{\Rats}{\mathbb{Q}}</preamble>
 <content>In this entry we compute several Taylor polynomials for the function $\sin x$ around $x=0$ and we produce graphs to compare the function with the corresponding Taylor polynomial. Recall that for a given function $y=f(x)$ (here we suppose $f$ is infinitely differentiable) and a point $x=a$, the Taylor polynomial of degree $n$ ($n\geq 0$) is given by:

$$T_n(x)=f(a)+f'(a)(x-a)+\frac{f''(a)}{2!}(x-a)^2+\ldots+\frac{f^{(n)}(a)}{n!}(x-a)^n$$
where $f^{(n)}$ denotes the $n$th derivative of $f(x)$. \\

From now on we assume $f(x)=\sin x$ and $a=0$. Notice that the derivatives of $\sin x$ are cyclic:

$$f'(x)=\cos x,\quad f''(x)=-\sin x, \quad f'''(x)=-\cos x, \quad f^{(4)}(x)=\sin x = f(x).$$

Therefore, the Taylor polynomials are easy to compute. In fact:
$$f^{(2n)}(0)=0, \quad f^{(2n+1)}(0)=(-1)^n$$

Thus, the first Taylor polynomial is given by:

$$T_1(x)= 0 + 1\cdot x = x$$
In the following graph one can compare the function $T_1(x)=x$ and $\sin x$.
\begin{center}
\includegraphics[scale=0.7]{taylor1}

The function $y=\sin x$ and the first Taylor polynomial.
\end{center}

Notice that $T_2(x)=T_1(x)$. More generally, $T_{2n}(x)=T_{2n-1}(x)$ so we will not compute any other even order Taylor polynomials. However, the third degree Taylor polynomial is given by the formula:

$$T_3(x)=x-\frac{x^3}{3!}=x - \frac{x^3}{6}$$

\begin{center}
\includegraphics[scale=0.7]{taylor3}

The function $y=\sin x$ and the third Taylor polynomial.
\end{center}

The Taylor polynomial of degree $5$ is given by:

$$T_5(x)=x-\frac{x^3}{3!}+\frac{x^5}{5!}$$

\begin{center}
\includegraphics[scale=0.7]{taylor5}

The function $y=\sin x$ and the fifth Taylor polynomial.
\end{center}

Next, we compute some Taylor polynomials of higher degree. In particular, the Taylor polynomial of degree $15$ has the form:

$$T_{15}(x)=x-\frac{x^3}{6} + \frac{x^5}{120} - \frac{x^7}{5040} + \frac{x^9}{362880} - \frac{x^{11}}{39916800} + \frac{x^{13}}{6227020800} - \frac{x^{15}}{1307674368000}$$

\begin{center}
\includegraphics[scale=0.7]{taylor15}

The function $y=\sin x$ and the Taylor polynomial of degree $15$.
\end{center}

Finally, we produce a detailed view of the Taylor polynomial of degree $99$. In particular, notice that the graphs are very close until $x=34$ or so, but after that $T_{99}(x)$ behaves rather jittery and wildly.

\begin{center}
\includegraphics[scale=0.7]{detailtaylor100}

A detail of the Taylor polynomial of degree $99$ (the interval $(34,39)$).
\end{center}</content>
</record>
