Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Derivative of the Abs Function in Mathematica looks very different than the actual answer. Why? How to correct this?

For example I entered D[Abs[x - 1], x] and got the output Abs'[-1 + x]. Is there a syntax error in my input?

share|improve this question
    
FullSimplify[D[Abs[x - 1], x], x \[Element] Reals && x != 0] Resolve[ForAll[x, x \[Element] Reals && x != 0, Sign[-1 + x] == Piecewise[{{1, x - 1 > 0}, {-1, x - 1 < 0}}]], Reals] – ciao May 1 '14 at 7:29
1  
How do I get the output in this form: (x−1)/|x−1| ? – user14056 May 1 '14 at 7:34
1  
Throw a rule and traditionalform onto end of simplify, /. Sign[z_ - 1] :> (z - 1)/Abs[z - 1] // TraditionalForm or investigate ComplexityFunction and TransformationFunctions for simplify. Bottom line, the form presented is what Mathematica deems the "simplest". If you need/want to transform it, you need to tell it so. – ciao May 1 '14 at 7:41
    
Thanks! ComplexExpand followed by Simplify helped. – user14056 May 1 '14 at 15:11
2  
You need ComplexExpand probably because you can't take the derivative of Abs in the complexes – Rojo May 1 '14 at 15:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.