Problem 3-37 (b) reads:
Let $A_{n}=[1-1/2^{n},1-1/2^{n+1}]$. Suppose that $f:(0,1)\rightarrow \mathbb{R}$ satisfies $\int_{A_{n}}f=(-1)^{n}/n$ and $f(x)=0$ for any $x\notin$ any $A_{n}$. Show that $\int_{(0,1)}f$ does not exist, but ${\displaystyle\lim_{\varepsilon\to 0}}\int_{(\varepsilon,1-\varepsilon)}f=\log\,2$.
Note: First that $n\ge 1$ and second that Spivak probably forgot a minus sign, i.e. he intended us to show that ${\displaystyle\lim_{\varepsilon\to 0}}\int_{(\varepsilon,1-\varepsilon)}f=-\log\,2$.
Note: The integrals are to be understood as extended integrals (see p.65 of the book or the image below). Theorem 3-12 (3) links this notion of integral with the old one.
That $\int_{(0,1)}f$ does not exist is not hard to show.
However, it seems to me that ${\displaystyle\lim_{\varepsilon\to 0}}\int_{(\varepsilon,1-\varepsilon)}f=\log\,2$ is not necessarily true. We don´t know how $f$ behaves outside the sets $A_{n}$ and so it may very well be that $\int_{(\varepsilon,1-\varepsilon)}f$ does not exist.
Am I correct in guessing that we need additional hypotheses?
If we assume additional properties of $f$, e.g. that $f$ does not change sign within each set $A_{n}$ and is bounded on each set $A$ then Theorem 3-12 applies and the result is true.
Related issues with other problems and statements about integration in Spivak´s book can be found here and here.
.
I want to note that integral means extended integral as it is defined on p.65 of the book.
Part a) (I am not completely sure this will work, criticism welcomed!)
For $k\ge 1$ we let $$U_{k}=\left(1-\frac{1}{2^{n}-1}, 1-\frac{1}{2^{n+1}+1}\right).$$ Consider a partition of unity $\Phi$ subordinate to the cover $\{U_{k}\}_{k\ge 1}$. By adding the $\varphi\in\Phi$ with the same $U$ in condition $(4)$ of Theorem 3-11 we may assume that there is only one function $\varphi_{k}$ for each $U_{k}$. Then when considering the convergence of $$\sum_{k=1}^{\infty}\int_{(0,1)}\varphi_{k}|f|$$ we have that $\sum_{k=1}^{n-1}\int_{A_{k}}|f|\leq\sum_{k=1}^{n}\int_{(0,1)}\varphi_{k}|f|$. But $\int_{A_{k}}|f|\ge 1/n$. Therefore, the series above diverges and so $\int_{(0,1)}f$ does not exist.
Part b)
If we assume that the sign of $f$ does not change within each $A_{n}$ and that $f$ is bounded on each $A_{n}$ then Theorem 3-12 (3) applies and $\int_{(\varepsilon,1-\varepsilon)}f$ is just the old Riemann integral $\int_{\varepsilon}^{1-\varepsilon}f(x)dx$ and so the result is clear, for we will have that $$\lim_{\varepsilon\to 0}\int_{\varepsilon}^{1-\varepsilon}f(x)dx=\sum_{n=1}^{\infty}\int_{A_{n}}f(x)dx=\sum_{n=1}^{\infty}\frac{(-1)^{n}}{n}=-\log\, 2.$$