I have the following problem:
Let $g$ be a trigonometric polynomial of degree n (there are complex coefficients $c_k$ with $k = -n, ..., n$ such that $g(t) =\sum\limits_{k = -n}^n c_{k}\exp(ikt). $ where i is the imaginary unit).
I have managed to show that the computation of the integral: $\frac{1}{2\pi}\int_0^{2\pi} g(t)dt$ using the composite trapezoid rule with equidistant intervals of length $h=\frac{2\pi}{n+1}$ is exact. Next I have also proved that if we have a function $f$ on [$0,2\pi$] such that there is $\epsilon > 0$ with $|f(t)-g(t)| \leq \epsilon$ for every $t\in [0,2\pi]$ Then the error when we approximate $\frac{1}{2\pi}\int_0^{2\pi}f$ via composite trapezoid rule is at most $2\epsilon$ .
Finally comes my issue:
I have now $f(t)= exp(cos(t))$) and I want to use the above result for the integral (which gives a Bessel function) to prove that using $h = \frac{2\pi}{8}$ for composite trapezoid rule will give me an error smaller than $5*10^{-7}$. I can do this using Mathematica software but I do not see how to do this just from the previous part (and perhaps some Fourier analysis I think).
Any help would be appreciated. Thank you
Use the power-law expansion of $\exp(x)$ to write
$f(t) = \sum_{k=0}^\infty \frac{\cos^k(t)}{k!} = g_n(t) + h_n(t)$
where
$g_n(t) = \sum_{k=0}^n\frac{\cos^k(t)}{k!}$ and $h_n(t) = \sum_{k=n+1}^\infty \frac{\cos^k(t)}{k!}$.
Now $g_n(t)$ is a trigonometric polynomial of degree $n$ and $h_n(t)$ is bounded by
$|\sum_{k=n+1}^\infty \frac{\cos^k(t)}{k!}| < \sum_{k=n+1}^\infty \frac{1}{k!} < \frac{1}{(n+1)!}(1+1/(n+2)+1/(n+2)^2 +...) = \frac{(n+2)}{(n+1)!(n+1)}$.
Thus $|g_n(t) - f(t)| < \frac{(n+2)}{(n+1)!(n+1)} \equiv \epsilon$
From your previous result we know that the composite trapezoidal rule approximate
$\frac{1}{2\pi}\int f(t) dt$
to accuracy better than $2\epsilon = \frac{2(n+2)}{(n+1)!(n+1)}$. Finally take $n=7$ (to get $h = \frac{2\pi}{8}$) and we have that the error is less than $\frac{18}{8\cdot 8!} \approx 5.4\cdot 10^{-5}$.
This is not quite the error that you are after. To get a better error you need to compute the Fourier series of $f(t)$. As $f$ is even we have
$f(t) = \sum_{k=0}^\infty a_k \cos(kt)$
Let the first $n$ terms define $g_n(t)$. We then have
$|g_n(t) - f(t)| \leq \sum_{n+1}^\infty |a_k|$
where
$a_k = \frac{1}{\pi}\int_0^{2\pi} e^{\cos(t)}\cos(kt) dt$
Evaluating the integral gives
$a_k = 2I_k(1)$
where $I_k$ is the modified Bessel function of the first kind.
Further we have (http://mathworld.wolfram.com/ModifiedBesselFunctionoftheFirstKind.html)
$I_n(1) = \frac{1}{2^n}\sum_{k=0}^\infty \frac{1}{4^k k! (n+k)!}$
which implies
$a_k = \frac{2}{2^n}\left(\frac{1}{n!} + \frac{1}{4(n+1)!} + ...\right) < \frac{2}{2^n n!}(1 +\frac{1}{4n} + \frac{1}{(4n)^2} +...) = \frac{8n}{4n-1}\frac{1}{n!2^n}$
For $k=8$ we get $a_k < 2\cdot 10^{-7}$. Summing up we find the error is bounded by
$\sum_{k=8}^\infty a_k < a_8(1+1/2+1/4+...) < 4\cdot 10^{-7}$
and we are done!