TITLE: How pathological can a convex function be?
QUESTION [35 upvotes]: Let $f : \mathbb R \to \mathbb R$ be convex. How weird can $f$ be? I know $f$ can easily be non-differentiable at finitely many points, for example $f(x) = \sum_{i=1}^n | x - c_i|$. Can it be non-differentiable at infinitely many points? Or on a set of positive measure?
My motivation for this is that when I picture an arbitrary convex function I tend to think of very regular ones like $f(x) = x^2$ but I want to make sure that I'm not building my intuition on examples that aren't rich enough.

REPLY [2 votes]: You can get another one with discontinuities at a dense set of points by integrating the inverse of Cantor's function. (Yes, it's not injective so it doesn't really have an inverse, but there are only countably many points in the Cantor function's range where the inverse isn't defined, so you can define the value of the inverse as whatever there.)