A Continuous Nowhere-Differentiable Function

Solution 1:

The plot looks like this. It's hard to tell by a casual look that this is nowhere differentiable.

enter image description here

For a better view of what's going on, here's an animation that zooms into the graph. You can see that the picture looks similar at different length scales. A differentiable curve, on the other hand, would look more and more like a straight line as you zoomed in. enter image description here

EDIT: I plotted this in Maple. I don't have the code any more, but it might have been something like this.

h:= x -> abs(x - 2*round(x/2)):
g:= unapply(add(1/2^n*h(2^n*x), n=0..1000),x):
x0:= 0.23456: y0:= evalf(g(x0)): r:= 1.13:
for i from 0 to 99 do
  frame[i]:= plot(r^i*(g(x/r^i + x0) - y0), x=-1..1, axes=none, 
      title = sprintf("Zoom factor %7.1f",r^i))
od:
plots[display]([seq(frame[i],i=0..99)],insequence=true);

Solution 2:

No, the $2^n$s cannot be cancelled out, as William Macrae and sos440 have pointed out.

$h$ is a zig zag function. $h(2^nx)$ is like $h$ but with the zig zags squished in toward the $y$-axis, making it go up and down more rapidly, but at the same height. Then $\dfrac1{2^n} h(2^nx)$ is like $h(2^nx)$ but with the zig zags squished down toward the $x$-axis, making them a lot shorter.

The $1/2^n$ out front ensures that the series converges uniformly (and hence that the resulting function is continuous), because $h$ is bounded. The combination of $2^n$s ensures that each term has zig zags of slope $\pm1$, while the number of zig zags per unit interval doubles from one term to the next.

Solution 3:

The $2^n$s cannot be cancelled because one is inside of the function $h$ (which is not affine). This is the same reason that $2 \sin(\frac12 x) \neq \sin(x)$ (for arbitrary $x$). The function that is being described is qualitatively the sum of more-and-more fine-grained 'zig-zag' functions; it's likely you are not plotting it quite right, so try plotting just one term first.