What kind of function are cubic splines not good at approximating? When we are given a dataset of a function sampled in many points, and we want to find approximation of the unknown function in-between these points, one of the go-to methods for practitioners is fitting a Cubic Spline.
I am using such a method to approximate derivatives at intermediate points. 
My QUESTION is, for what kind of functions a cubic splines may not a be a good choice for approximating?
 A: Since a cubic spline can contain multiple cubic segments, it is capable of approximating almost any function as close as possible (if the number of cubic segments in the spline is not limited). If your approximation method is to sample points along the function and create a cubic spline interpolating these sampled points, then the approximation accuracy is highly related to the number of sampled points and how the points are distributed. 
Cubic splines might not be as appropriate for approximating functions with $C^1$ discontinuities (such as a step function) as they will almost always produce bad approximation around where the $C^1$ discontinuity occurs.
A: A cubic would be a bad approximation if the function is too bumpy.  Suppose we try to approximate $f(x) = \sin 10x$ by a cubic $g(x) = a + bx + cx^2 + dx^3$ on the interval $x \in [0, 2\pi]$.  Then we have a calculus problem:
$$ \min_{a,b,c,d \in \mathbb{R}}\max_{x \in [0,2\pi]} \left|\, \sin 10x - \big(a + bx + cx^2 + dx^3\big)\,\right|  $$
I'm pretty sure the best cubic you could find would be pretty lousy (I'm looking for a bound).  Instead we could take a smaller interval:
$$ \min_{a,b,c,d \in \mathbb{R}}\max_{x \in [0,2\pi]} \left|\, \sin x - \big(a + bx + cx^2 + dx^3\big)\,\right|  $$
The first step would be to take the derivative and set it to zero (to find the extrema):
$$ \cos x = b + 2cx + 3dx^2  $$
Or even a guess-and-check method might work... how about $g(x) = x(x-\pi)(x-2\pi)$ ?  Can you find a better choice of $(a,b,c,d)$ ?

I found these numbers with a computer:


*

*$f(x) = \sin 2\pi x$

*$g(x) = 20\,x\,(x - \frac{1}{2})\,(x - 1)$


Which is which?

