Calculating a Lebesgue integral involving the Cantor Function I came across the following challenging problem that concerns evaluating a Lebesgue integral rather than being asked to prove something about it:
Let $\varphi: [0,1] \rightarrow [0,1]$ be the Cantor (ternary) function, and let $m_\varphi$ be the Lebesgue-Stieltjess measure associated to it. Let $f(x) = x$. Evaluate $$\int_{[0,1]} f \; dm_\varphi.$$
A friend of mine suggested that if you study this integral in Mathematica, its value is fairly large, but I am having trouble thinking of how to proceed in computing the value without a computer algebra package. I post this question in hopes that anyone visiting will find the problem curious too, and to see if anyone visiting had some suggestions on how to proceed in computation.
 A: Here's a geometric way of understanding the solution. Since Lebesgue integration begins by building up a function out of simple functions, construct a sequence of simple functions that approaches the Cantor function from below. This wouldn't be very hard to do, although the notation is a little cumbersome. Here is the basic idea:
$\varphi_1(x) = \frac121_{[1/3,2/3]}(x)$
$\varphi_2(x) = \varphi_1(x) + \frac141_{[1/9,2/9]}(x) + \frac341_{[7/9,8/9]}(x)$
$\varphi_3(x) = \varphi_2(x) + \frac181_{[1/27,2/27]}(x) + \frac381_{[7/27,8/27]}(x)+\frac581_{[19/27,20/27]}(x) + \frac781_{[25/27,26/27]}(x)$
The first $\varphi_1$ is simply the very middle portion of the function, and then each subsequent $\varphi_n$ adds in the parts directly between $\varphi_{n-1}$. Notice that each of the functions is sort of averaging to $\frac12$. Their integrals are
$\int \varphi_1 \ dm = \frac12\cdot\frac13$
$\int \varphi_2 \ dm = \frac12\cdot\frac13 + \frac19(\frac14+\frac34) = \frac12\cdot\frac13+\frac19$
$\int \varphi_3 \ dm = \frac12\cdot\frac13+\frac19 + \frac1{27}(\frac18+\frac38+\frac58+\frac78) = \frac12\cdot\frac13+\frac19+2\cdot\frac1{27}$
Then it follows that $\int\varphi_n\ dm = \frac16\sum_{j=1}^n \left(\frac23\right)^j \to \frac16\cdot\frac{1}{1-\frac23}=\frac12$
A: The value of the integral is $\frac{1}{2}$, by symmetry.
Notice that $\varphi(1-x) = 1 - \varphi(x)$.  From this, it is easy to show that the Cantor measure $m_\varphi$ is invariant under the transformation $x \mapsto 1-x$.  Thus $$\int x\, m_\varphi(dx) = \int (1-x)\, m_\varphi(dx) = 1 - \int x\,m_\varphi(dx).$$
