Why do I get empty graph when adding 'Abs' function?
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'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}]
As of V11.1, another available approach is to use RealAbs
instead of Abs
:
Plot[Evaluate[D[RealAbs[5 - 2 x], x]], {x, -10, 10}]
Note that Abs
, as a function of a complex variable, is not differentiable, which I mentioned in a comment earlier.