10

Context

In[855]:= D[Abs[x], x] /. x -> 1

Out[855]= Derivative[1][Abs][1]

In[856]:= D[x, x] /. x -> 1

Out[856]= 1

Question

Why is Derivative[1][Abs][x] not simplifed to 1 when x -> 1?

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574

2 Answers2

20

$\mathrm{abs}(z)$ defined on the set of complex numbers $\mathbb{C}$ is not a holomorphic function because it violates the Cauchy-Riemann conditions, and the derivative is not well defined. $\mathrm{abs}(x)$ defined on the set of real numbers $\mathbb{R}$ is differentiable everywhere except at $x=0$.

Mathematica treats Abs[x] as a function defined on complex numbers and so will not simplify Abs'[x] when it occurs in expressions. However, you can force it to simplify by explicitly stating that the argument is real as follows:

FullSimplify[Abs'[x], x ∈ Reals]
(* Sign[x] *)

Also see this question for a very closely related problem.

rm -rf
  • 88,781
  • 21
  • 293
  • 472
  • This should be corrected "...hence is differentiable nowhere." because it may be misleading. Obvoiusly it is directionally differentiable, but not holomorphic. Besides that it would deserve the enlightened tag. – Artes Jul 12 '12 at 12:02
  • Alternatively, you could phrase this as "the derivative depends on the direction the limit is taken from". So, if you take the derivative along a direction $\theta$, you get $\left(\partial_z|z|\right)_{\theta}=|z|^{-1}\left(\Re(z)\cos(\theta)+\Im(z)\sin(\theta)\right)$(or something like that) – acl Jul 12 '12 at 12:03
  • @Artes acl: Thanks, I've edited it :) – rm -rf Jul 12 '12 at 13:43
  • It is correct to say that abs, as a complex function, is differentiable nowhere -- meaning that at each complex number it fails to have a derivative. (And then, a fortiori, of course it is nowhere holomorhpic.) The language "the derivative depends on the direction the limit is taken from" is misleading; there is nothing about "direction" involved in what "differentiable" means. – murray Jul 12 '12 at 15:10
  • Thanks, I've removed that sentence. I think I'll stop with the mathematical language edits, because this could go on, but I'm not a mathematician and the basic idea and the solution is there. – rm -rf Jul 12 '12 at 15:31
  • @murray I thought one could obtain the CR conditions by forcing $\lim_{\epsilon\rightarrow 0} (f(z+\epsilon)-f(z))/\epsilon$ with complex $\epsilon$ to not depend on the argument of $\epsilon$ (well, actually one can obtain them this way). But no doubt I am missing something. – acl Jul 12 '12 at 15:40
  • @murray There is a directional derivative beside the point. abs(x + I y) has partial derivatives. If someone says a function f is differentiable nowhere it would mean as well f has no partial derivatives. But saying f doesn't satisfy C-R conditions, we think of partial derivatives, so there is a natural objection of using the concept of nowhere differentiability if one doesn't emphasize the complex differentiability. – Artes Jul 12 '12 at 18:57
  • @Arles: Having 1st-order partial derivatives with respect to both real and imaginary parts does not suffice to ensure differentiability! Differentiability of $f$ at $z$ requires that $\lim_{w\to0} (f(z+w) - f(z))/w$ exist.

    On the other hand, if both 1st-order partial exist and are continuous and satisfy the Cauchy-Riemann equations, then indeed the function is differentiable.

    – murray Jul 12 '12 at 19:11
  • @murray I don't want to be rude, but it makes sense to read and understand the comments you're replying to before typing. 1) nobody claimed that the mere existence of 1st order partial derivatives implies differentiability; 2) the argument you gave with the limit existing is what the "direction" thing above meant. Somehow, though, I think this is pointless. – acl Jul 12 '12 at 20:14
  • @murray I know, I don't try to overpower definitions. My remarks were only to clarify that aspect which might lead (those who ask for simplifying derivatives of a function) to confusion. – Artes Jul 12 '12 at 21:22
5

FunctionExpand will resolve this (I think FullSimplify also calls FunctionExpand in the background):

FunctionExpand[Abs'[x], x \[Element] Reals]

(* ==> Sign[x] *)

Abs'[1] // FunctionExpand

(* ==> 1 *)
Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263