Is WolframAlpha wrong on piecewise differentiation at $x=0$?

115 Views Asked by At

I'm differentiating the function:

$${ f\left(x\right) = \begin{cases}{x \sin ( \frac{1}{x}) } && {x\>\ne\>0} \\ {0} && {x\>=\>0}\end{cases} }$$ In my understanding it is not differentiable at $x= 0$, as it is not a constant function so we must use the definition of a limit to differentiate at $x=0$.

Wolfram says its derivative is $0$ at $x=0$.

Where am I wrong?

2

There are 2 best solutions below

0
On BEST ANSWER

This is a known bug. You can get WolframAlpha to return the correct result if you replace D[Piecewise[{{xsin(1/x), x != 0}, {0, x = 0}}], x] with D[Piecewise[{{xsin(1/x), x < 0 || x > 0 }, {0, x = 0}}], x]. Using the input x < 0 || x > 0 signals to WolframAlpha that $x$ is real, and so the algorithm it uses to differentiate is more robust. See here for the correct result in WolframAlpha.

0
On

Wolfram is wrong as it is often in similar questions.

$f$ is not differentiable at $0$ as $$\lim\limits_{x \to 0} \frac{f(x)-f(0)}{x}$$ doesn’t exist.