Evaluate $\log(7)+\cos(1)$ with an error of less than $10^{-4}$
Obviously the aim is to use Taylor's expansion with Lagrange's remainder, but where to center it? I was thinking in $e^2$, which seems to me a bit too large.
Evaluate $\log(7)+\cos(1)$ with an error of less than $10^{-4}$
Obviously the aim is to use Taylor's expansion with Lagrange's remainder, but where to center it? I was thinking in $e^2$, which seems to me a bit too large.
On
Consider $$ \log(1+x)=x-\frac{x^2}{2}+\frac{x^3}{3}-\dotsb=\sum_{n\ge1}(-1)^{n-1}\frac{x^n}{n} $$ and $$ \log(1-x)=-x-\frac{x^2}{2}-\frac{x^3}{3}-\dotsb=-\sum_{n\ge1}\frac{x^n}{n} $$ which holds for $-1<x<1$. Subtracting the second from the first yields $$ \log\frac{1+x}{1-x}=2\sum_{n\ge0}\frac{x^{2n+1}}{2n+1} $$ The equation $$ \frac{1+x}{1-x}=7 $$ yields $x=3/4$.
Now use the Lagrange remainder formula to ensure that the errors in the Taylor polynomial for $\log\frac{1+x}{1-x}$ for $x=3/4$ is less than $10^{-4}/2$ and the in the Taylor polynomial for $\cos x$ for $x=1$ is again less than $10^{-4}/2$.
By writing
$$ \log(7)+\cos(1) = -\log\left(1+\tfrac{1}{7}\right)-3\log\left(1-\tfrac{1}{2}\right)+\cos(1) $$ we may easily use few terms of the Maclaurin series of $\log(1\pm x)$ and $\cos x$. We have
$$ \cos(1)=\sum_{n=0}^{8}\frac{(-1)^n}{(2n)!}+E_1 = \frac{11304631621681}{20922789888000}+E_1 $$ with $|E_1|\leq \frac{1}{10!}$. Similarly $$ \log\left(1+\frac{1}{7}\right) = \sum_{n=1}^{6}\frac{(-1)^{n+1}}{n 7^n}+E_2 = \frac{942589}{7058940}+E_2 $$ with $|E_2|\leq \frac{1}{8\cdot 10^5}$ and $$ \log(2) = \sum_{n=1}^{15}\frac{1}{n 2^n}+E_3 = \frac{31972079}{46126080}+E_3 $$ with $|E_3|\leq \frac{2}{10^5}$. In particular
$$\frac{11304631621681}{20922789888000}-\frac{942589}{7058940}+3\cdot \frac{31972079}{46126080}=\color{green}{2.4862}071\ldots $$ is an approximation (a lower bound) of $\log(7)+\cos(1)$ within the required accuracy.
An improved approach is to write $$ \log(7)+\cos(1) = 3\log(2)+\log\left(1-\frac{1}{8}\right)+\cos(1), $$ approximate $\cos(1)$ and $\log\left(1-\frac{1}{8}\right)$ via Maclaurin series and approximate $\log(2)$ via $0\leq \int_{0}^{1}\frac{x^n(1-x)^n}{1+x}\,dx\leq\frac{1}{4^n}$. With $n=5$ we already get $\log(2)\approx \frac{2329}{3360}$ with an error $\leq 8\cdot 10^{-6}$.