In our tour of the zoo of functions we’ve been spending time in the snake pit. These are the pathological functions of pure math, and are generally but not always useless in physics and pretty much everything else. But they’re very cool to look at! We’ll eventually get back to the useful domesticated farm animals of the functions but we’re in no hurry. Here’s the next snake and its picture:

It looks like a double-valued function, a straight line under a parabola. but it’s not. If x is rational, f(x) is just the square of x. Otherwise, it’s 0. So f(π) = 0, but f(3) = 9.
It’s loosely of the same species as the Dirichlet function. It’s chopped up in an infinite number of places, and it’s discontinuous everywhere.
Almost everywhere. In fact, this function is continuous at exactly one point – the origin. Here’s why: a function is continuous at x = C if for any tiny positive number ε, there is a positive number δ such that every x within δ of C, |f(C) – f(x)| < ε. This function fits that definition. But only at that one point x = 0. Everywhere else, the fact that the function is infinitely chopped up prevents a the definition of continuity from being satisfied.
Continuous at exactly one point. Exceptionally weird.
There are weirder. If this function is a snake, Thomae’s function is a basilisk. That one’s a much more difficult story for another day.
[Bonus exercise for the mathematically fluent: is f differentiable at the origin? If we replaced x2 with x in the definition of the function, what would its status be with regard to continuity and differentiability at the origin?]