# Why do I get empty graph when adding 'Abs' function?

Can someone be so nice to provide some help for this particular situation? I try to plot a graph of a derivative which contains modulus. Without it the graph is drawn correctly:

But when I wrap the expression in the Abs Mathematica outputs an empty graph:

I looked for several answers related to empty graphs, but nothing seems to fit to my case. Thanks in advance.

-
Workaround: With[{a = Piecewise[{{#, # >= 0}, {-#, # < 0}}, 0] &}, Plot[Evaluate[D[a[5 - 2 x], x]], {x, -1*^3, 1*^3}, Axes -> None, PlotRange -> {-1*^3, 1*^3}]] – J. M. May 8 '13 at 15:25
@J. M, thank you, it works – user907860 May 8 '13 at 15:27

Might it be the way Mathematica deals with the derivative of Abs[]? For example,

D[Abs[5 - 2 x], x]


returns

-2*Derivative[1][Abs][5 - 2*x]


Try

Plot[Evaluate[D[Sqrt[(5 - 2 x)^2], x]], {x, -10, 10}]

-
I was about to say that, so I added the relevant example to your answer. +1 – rcollyer May 8 '13 at 15:36

I'm also wondering why Mathematica doesn't treat the derivative of Abs as normal way. But here is a solution.

Plot[Evaluate@ComplexExpand[D[Abs[5 - 2 x], x]], {x, -10, 10}]

-
"I'm also wondering..." - that Mathematica considers variables to take complex values by default is a hint... – J. M. May 9 '13 at 3:44
Perhaps not everyone knows that as a function of a complex variable, Abs[z] is not differentiable at any z. – Michael E2 May 9 '13 at 3:49
@J.M. Yes. Sometimes if plotting a complex function carelessly , Mathematica will return a empty graphic. I think in this occasion, it will be helpful if Mathematica give some warnings. – luyuwuli May 9 '13 at 4:11
@MichaelE2 Mathematica often tells me to rethink about the complex variables:) – luyuwuli May 9 '13 at 4:14