\documentclass[12pt, letterpaper]{article}

\usepackage{graphicx}
\usepackage{epsfig}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{geometry}
\usepackage{setspace}

\title{Homework 7}
\author{Menyoung Lee}
\geometry{margin=1in}
%\doublespacing

\newcommand{\<}[0]{\Leftarrow}

\begin{document}
\maketitle

\subsection*{3.2 P1}
\paragraph*{a}
\[P_2(x) = 0 + (x-0)(0.0.63662+(x-1.5708)(-0.40528)).\]
\paragraph*{b}
\[P_2(\frac\pi4) = \frac 3 4.\]
\paragraph*{c}
\[f(x) - P_2(x) = \frac{(x-0)(x-\frac\pi2)(x-\pi)}{3!}f'''(c).\]
where $0 \leq c \leq \pi$.
$|f'''(c)| \leq 1$ because $f(x) = \sin{x}$, and therefore
\[|f(\frac\pi4) - P_2(\frac\pi4)| \leq \frac{(\frac\pi4-0)(\frac\pi4-\frac\pi2)(\frac\pi4-\pi)}6 = 0.24224.\]
\paragraph*{d}
\[\sin \frac\pi4 - P_2(\frac\pi4) = -0.042893,\]
which is much smaller compared to the theorem's guarantee.

\subsection*{3.3 CP3}
So the Theorem for Chebyshev says \[|\prod_{i=1}^n (x-x_i)| \leq \frac{(\frac{b-a}{2})^n}{2^{n-1}}.\]
The error theorem says \[f(x) - T_n(x) = \frac{\prod_{i=1}^n (x-x_i)}{n!} f^{(n)}(c).\]
Because \[\frac{d^n}{dx^n} \log x = \frac{(-1)^{n-1}(n-1)!}{x^n},\]
\[|\log(x)-T_n(x)| = \frac1{nx^n}|\prod_{i=1}^n(x-x_i)| \leq \frac{(\frac{b-a}{2})^n}{2^{n-1}nx^n} \leq \frac{(\frac{b-a}{2})^n}{2^{n-1}n} = \frac2n(\frac{e-1}4)^n.\]
Therefore, \[|\log(x)-T_n(x)| \leq 0.5\times10^{10} \< \frac2n(\frac{e-1}4)^n \leq 0.5\times10^{10} \< n \geq 25.\]
\begin{verbatim}
>> norm(logchev(25,exp(-4:0.05:4))-log(exp(-4:0.05:4)), inf)

ans =

   8.8818e-16
\end{verbatim}
My program does better than the theorem's guarantee.

\end{document}

