MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Abs function

  • To: mathgroup at
  • Subject: [mg47282] Re: Abs function
  • From: "David W. Cantrell" <DWCantrell at>
  • Date: Fri, 2 Apr 2004 03:30:30 -0500 (EST)
  • References: <c4gf1i$276$>
  • Sender: owner-wri-mathgroup at

nikmatz <nikmatz at> wrote:
> i try to find the derivative of Abs[x]
> and i have this
> In: D[Abs[x],x]
> Out: Abs`[x]
> i don't know the mean of `
> please help

The meaning of ` is, in this case, simply "derivative". But I'm sure that
still leaves you unsatisfied.

I'm glad you asked your question. It has now prompted me to write something
which I had been intending to write for some time anyway:

In this newsgroup we often get questions concerning differentiation or
integration of user-defined piecewise-defined functions. The standard
response seems to be to rewrite the function in terms of UnitStep.

I was surprised and disappointed recently when I attempted to differentiate
or integrate certain built-in functions, such as Abs and Sign. For example,
I did not like

In[1]:= Assuming[Element[x, Reals], D[Abs[x], x]]

Out[1]= Derivative[1][Abs][x]

since such an output is not helpful. One solution to this problem is the
same as the solution when a piecewise-function is user-defined, namely,
rewrite it in terms of UnitStep:

In[2]:= RealAbs[x_]:= x*(2*UnitStep[x] - 1)

In[2]:= Simplify[D[RealAbs[x],x]]

Out[2]= -1 + 2*UnitStep[x]

In[3]:= Simplify[Integrate[RealAbs[x],x]]

Out[3]= (1/2)*x^2*(-1 + 2*UnitStep[x])

Of course, something similar can be done for other built-in functions
such as Sign.

Hope this helps,
David Cantrell

  • Prev by Date: Re: Is there any productive way to use Mathematica + pdfLaTeX?
  • Next by Date: NDSolve for Newtonian Orbits Question
  • Previous by thread: Re: Abs function
  • Next by thread: Re: Abs function