If I enter x/x, I get 1. Such behavior leads to this:
Simplify[D[Sqrt[x^2], x, x]]
0
The same would be even if I use Together instead of Simplify.
One could then think that $\sqrt{x^2}$ is doubly differentiable at least $\forall x\in\mathbb R$, but if we remove Simplify call, we would reveal that it's not:
D[Sqrt[x^2], x, x]
-(x^2/(x^2)^(3/2)) + 1/Sqrt[x^2]
Even more ridiculous is this (which I guess is because x/x is simplified before feeding to Assuming):
Assuming[x == 0, x/x]
1
Why does Mathematica assume $x\ne0$? Is there a way to make it not cancel out such terms?




-(x^2/(x^2)^(3/2)) + 1/Sqrt[x^2]is exactly zero, except atx=0. But From a mathematical standpoint the problem is more like why does mathematicas differential operatorDnot excludex=0in this case. – Wizard Aug 16 '14 at 16:58Dgives an expression, which is undefined for $x=0$. It's quite a correct result for function, which isn't differentiable at $x=0$. But then simplifying it to $0$ makes it defined at $x=0$ too, which is incorrect. – Ruslan Aug 16 '14 at 17:31Simplifyto be a generic complex number. By generic, I mean not having any isolated special value, such as0. You have to useAssumptionsto change this default. – Jens Aug 16 '14 at 17:35Assumptionsfor this? See update of the question. – Ruslan Aug 16 '14 at 17:36Assumingin your last example is simply that$Assumptionsare ignored by the expressionx/x(specificallyPower); onlySimplifyother functions that understand the optionAssumptionscan be affected byAssuming. This is also why the assumption of real variables in a second derivative has to be applied once in each differentiation step, which required me to split the second derivative in my answer into two first derivatives wrapped inFullSimplify. – Jens Aug 16 '14 at 21:26