Message Boards Message Boards

0
|
5531 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Plotting function involving derivative of Abs(x)

Posted 11 years ago
Hello everybody,

I was experimenting with some functions useful in physics and learning to plot some. At one point, I decided to toy with f[x_]=Abs. Plotting gave the expected. I took the derivative of this function and then tried to plot it. No luck there... There is only the coordinate system while I had expected to see the usual "step" function. For negative numbers for x, the derivative should be -1 always, and plus one for positive x. Plot[Evaluate[D[f[x_], x_]], {x, -2, 2}] does not work. The command Plot[Evaluate[x/Abs], {x, -2, 2}] does give the expected plot.

I may be doing something very silly but or I came immediately across something pretty damn strange.

Thanks,

Patrick
POSTED BY: Patrick Bultinck
3 Replies
Thank you. I wrongly assumed that telling x to be between -2 and 2 would make it realize it is real (admittedly, I also did not think of what happens in the complex plane). I had some practice already and being a chemist, I use a lot of maths but Mathematica makes you quite aware of the 'fine print' of our methods!
Thanks,
Patrick
POSTED BY: Patrick Bultinck
Yes, that's correct. 
Mathematica is aware of what happens when you only consider real values, so if you do have equations with this, you can still work with them using FullSimplify pretty easily:
FullSimplify[Abs'[x], Assumptions -> {Element[x, Reals]}]

And if you want to, it's possible to add these definitions to Mathematica.
POSTED BY: Sean Clarke
I once asked Technical Support why Abs' is not defined.  They told me that Abs doesn't satisfy the Cauchy-Riemann equations so the derivative can't be defined in the complex plane.
POSTED BY: Frank Kampas
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract