# Difference between revisions of "Discontinuous derivative"

Consider the function (blue curve)

$f: \mathbb{R} \to \mathbb{R}, x \mapsto \begin{cases} x^2\sin(1/x),& x\neq 0\\ 0,& x=0 \end{cases}\,.$

$f$ is a continous and differentiable. The derivative of $f$ is the function (red curve)

$f': \mathbb{R} \to \mathbb{R}, x \mapsto \begin{cases} 2\sin(1/x) - \cos(1/x), &x \neq 0\\ 0,& x=0 \end{cases}\,.$

We observe that $f'(0) = 0$, but $\lim_{x\to0}f'(x)$ does not exist.

Therefore, $f'$ is an example of a derivative which is not continuous.

Here is another example:

$g: \mathbb{R} \to \mathbb{R}, x \mapsto \begin{cases} x^2(1-x)^2\sin(1/(\pi x(1-x)),& 0\ltx\lt 1\\ 0,& \mbox{otherwise} \end{cases}\,.$

### The underlying JavaScript code

First example:

var board = JXG.JSXGraph.initBoard('jxgbox', {axis:true, boundingbox:[-1/2,1/2,1/2,-1/2]});

var g = board.create('functiongraph', ["2*sin(1/x) - cos(1/x)"], {strokeColor: 'red'});
var f = board.create('functiongraph', ["x^2*sin(1/x)"], {strokeWidth:2});