So we know that $$f(x) = \sum_{k = 0}^n \frac{f^{(k)}(c)}{k!}(x - c)^k + \frac{f^{(n+1)}(\xi)}{(n+1)!}(x-c)^{n+1}.$$ In the case of the expansion $\sin(1)$ centered around $0$ our remainder will be $$ \frac{\sin^{(n+1)}(\xi)}{(n + 1)!}(1)^{n + 1} = \frac{\sin^{(n+1)}(\xi)}{(n + 1)!}.$$ Note that $\sin^{(n + 1)}(\xi) \leq 1$. Hence in order to find the correct $n$ to stay below our error bound we solve the inequality $$\left|\frac{\sin^{(n+1)}(\xi)}{(n + 1)!}\right| \leq \left|\frac{1}{(n + 1)!}\right| \leq 10^{-8}$$

```
y = 1
n = 0
while abs(y) > 1e-8:
y = 1/math.factorial(n + 1)
n = n + 1
n
#out: 12
```

In this case $n = 12$. So to approximate $\sin(1)$ we have

```
while n <= 12:
y = y + diff(sin, 0, n)/math.factorial(n)
n = n + 1
y
#out: mpf('0.84147098464806802')
```

Similarly, in the case of the expansion $\sin(1)$ centered around $\frac{\pi}{3}$ our inequality will be $$\left|\frac{\sin^{(n+1)}(\xi)}{n + 1}(1-\frac{\pi}{3})^{n + 1}\right| \leq \left|\frac{(1-\frac{\pi}{3})^{n+1}}{(n + 1)!}\right| \leq 10^{-8}$$

```
y = 1
n = 0
while abs(y) > 1e-8:
y = ((1-(pi/3))**(n + 1))/math.factorial(n + 1)
n = n + 1
n
#out: 5
```

In this case $n = 5$ so we have

```
y = 0
n = 0
while n <= 5:
y = y + diff(sin, pi/3, n)/math.factorial(n)*(1-(pi/3))**n
n = n + 1
y
#out: mpf('0.84147098482114002')
```