This is not an answer, but something too long to put into comments that I thought could be useful to others with more knowledge in similar subjects. I used the Wikipedia definition of the Cantor staircase to create my own version of the function where we see explicitly what is happening:
cantorFun[x0_] := Module[{x = x0},
inBase3 =
RealDigits[x, 3,
100];(*you have to hope the first 1 shows up in the first 100 \
digits*)
base3Digs = inBase3[[1]];
first1 = First@FirstPosition[base3Digs, 1];
If[IntegerQ@first1,
base3Digs[[first1 + 1 ;; All]] = 0;
];
base3Digs = base3Digs /. (2 -> 1);
inBase3[[1]] = base3Digs;
FromDigits[inBase3, 2]
]
(Tiny note: there is probably a way to optimize this to only take the base-3 expansion until there is a 1 instead of taking the first 100 digits for every $x$, but I don't know how to tell RealDigits
to do that)
What we could do from here to get the derivative is find the locations where the function changes, and put (scaled) Dirac delta functions at those jumps. I am not sure how exactly to determine where those jumps occur, but my guess is it has to do with the base-3 expansion of the number.
Add-on after reading bill s's comment on the answer above, I believe looking for the "jump" locations may be infeasible, as the function is sort of fractal in the sense that the closer you zoom in, the more jumps you see and there are probably infinite jump locations from 0 to 1.
N[CantorStaircase'[1/2]]
returns-0.119127
when it should return something close to zero, so I suspect this is a bug of some sort. $\endgroup$N[CantorStaircase'[1/6]] = -0.837313
, apparently. Not all rational values return a numerical answer, though;N[CantorStaircase'[1/4]]
doesn't give any output in a reasonable time on my computer. $\endgroup$N[CantorStaircase'[1/6], n]
for various values ofn
gives wildly fluctuating values asn
increases — but only the first time you run the command in a fresh kernel. So runningN[CantorStaircase'[1/6], 5]
gives you one number,N[CantorStaircase'[1/6], 10]
gives you a second, different number, andN[CantorStaircase'[1/6], 5]
gives you the second result rounded off to five significant digits. $\endgroup$dLim[x_] = Limit[(CantorStaircase[x + dx] - CantorStaircase[x])/dx, dx -> 0, Assumptions -> x \[Element] Reals]; Plot[dLim[x], {x, 0, 1}]
I don't understand why the derivative is negative around 1/2 if the function appears to be monotonically increasing $\endgroup$