Average of function defined on cantor set Suppose we have $P: A\cap[0,1]\to\mathbb{R}$, where $A$ is the Cantor set. I want to define and find the average of $P$ to give a result between the infimum and supremum of $P$'s range.
Obviously we cannot use the Lebesgue measure, as the average would be zero. Instead, we need a new definition.
My intuition is, as the iterations increase the length of remaining intervals approach zero. This means the intervals approach singularities or points. 
To find the average we need the beginning and end-points of defined intervals in current iterations which the defined intervals will approach in the next iterations. 
First Iteration:
${0,1/3,2/3,1}$
Second Iteration:
$0,1/9,2/9,3/9,6/9,7/9,8/9,9/9$
Third Iteration:
$0/27,1/27,2/27,3/27,6/27,7/27,8/27,9/27,18/27,19/27,20/27,21/27,24/27,25/27,26/27,27/27$
The numerators for each iteration go in a pattern which I call Cantor's Integers
$0,1,2,3,6,7,8,9,18,19,20,21,24,25,26,27,54,55,56,57,60,61,62,63,...$
We will define them as ${C}_n$. For every iteration $k$, the definition of average for $P$ should be
$$\lim_{k\to\infty}\frac{\sum\limits_{n=1}^{2^{k+1}} P\left({C_n}/{3^k}\right)}{2^{k+1}}$$
How do we find the exact value of this sum? How do we apply my definition of average to other uncountable sets with measure zero?
I want to find some P which is nontrivial, intuitive for certain 'simple' sets, and which produces interesting results (which can be retrospectively reconciled with intuition) for more complicated sets such as the Cantor (set but possibly others) such that it in some way gives a sense of an average.
 A: Let $I_0=[0,1]$ and define $I_{n+1}=\frac{1}{3}I_n\cup (\frac{2}{3}+\frac{1}{3}I_n)$. Then $A=\cap_{n=1}^{\infty} I_n$. Thus, we get the self-similarity $A=\frac{1}{3}A\cup (\frac{2}{3}+\frac{1}{3}A)$. Let $\lambda$ be the Lesbegue measure and define $\mu_n(B)=\left(\frac{3}{2}\right)^n \lambda(B\cap I_n)$ to be the uniform measure on $I_n$. Then, there exists a measure $\mu$ called the Cantor distribution such that $\mu([a,b])=\lim_{n\to \infty} \mu_n([a,b])$ for all $a,b$. The usual arguments for its existence are either showing that the distribution functions $F_n$ of $\mu_n$ converge uniformly to the distribution function of some probability measure or appealing to Alaoglu's theorem to get a subsequential weak limit, which must necessarily be unique by the uniqueness theorem for finite measures. Note that it's clear from self-similarity that
$$
\int_{\frac{1}{3}A} f(x)\textrm{d}\mu=\mu\left(\frac{1}{3}A\right)\int_A f(x/3)\textrm{d}\mu=\frac{1}{2}\int_A f(x/3)\textrm{d}\mu
$$
and that the measure restricted to $[0,1]$ is invariant under translation by $\frac{1}{3}$ mod $\mathbb{Z}$.
Thus, applying the self-similarity of $A$ again, we see that
\begin{align}
\int_A x^2\textrm{d}\mu &=\int_{\frac{1}{3}A} x^2\textrm{d}\mu+\int_{\frac{2}{3}+\frac{1}{3}A} \left(x-\frac{2}{3}+\frac{2}{3}\right)^2\textrm{d}\mu \\
&=2\int_{\frac{1}{3}A} x^2\textrm{d}\mu+\int_{\frac{2}{3}+\frac{1}{3}A}\frac{4}{9}+\frac{4}{3}\left(x-\frac{2}{3}\right)\textrm{d}\mu \\
&=\int_A \left(\frac{x}{3}\right)^2\textrm{d}\mu+ \frac{4}{3}\int_{\frac{2}{3}+\frac{1}{3}A}\left(x-\frac{2}{3}\right)+\frac{2}{3}-\frac{1}{3}\textrm{d}\mu\\
&=\frac{1}{9} \int_A x^2\textrm{d}\mu+\frac{2}{9}\int_A x\textrm{d}\mu+\frac{2}{9}
\end{align}
Now, since the measure $\mu(B+\frac{1}{2})=\mu(-B+\frac{1}{2})$ and $\mu$ is a probability measure, we get that $\int_A x\textrm{d}\mu=\frac{1}{2}$ and thus, we see that
$$
\frac{8}{9}\int_A x^2\textrm{d}\mu=\frac{3}{9},
$$
implying, indeed, that $\int_A x^2\textrm{d}\mu=\frac{3}{8}$. Similarly, you will be able to integrate any polynomial recursively.
