Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Abs function

20 views
Skip to first unread message

nikmatz

unread,
Apr 1, 2004, 1:51:05 AM4/1/04
to
Hi,

i try to find the derivative of abs function

D[Abs[x],x]

and Mathematica answer
Abs`[x]

what mean that

Thanks

nikmatz

unread,
Apr 1, 2004, 2:06:26 AM4/1/04
to
Hi,

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

Thanks

Jens-Peer Kuska

unread,
Apr 2, 2004, 3:40:13 AM4/2/04
to
Hi,

tha mean that the derivative of Abs[] can be different for
real and complex arguments. For real arguments you have

D[Abs[x], x] // FullSimplify[#, Element[x, Reals]] &

Sign[x]

Regards
Jens

Peter Pein

unread,
Apr 2, 2004, 3:48:54 AM4/2/04
to
"nikmatz" <nik...@math.ntua.gr> schrieb im Newsbeitrag
news:c4gf1i$276$1...@smc.vnet.net...

f'[x] is an abbreviation of Derivative[f][1][x]

b.t.w.: what happened to Mathematica's creativity regarding

In[1]:= $Version
FullSimplify[Abs'[x], x \[Element] Reals]
Out[1]= "4.0 for Microsoft Windows (July 16, 1999)"
Out[2]= Sign[x]

in version 5?


--
Peter Pein, Berlin
StringReplace["pet...@arcand.de",
Rule@@(ToLowerCase@ToString@Head@#&)/@{William&&S,2b||!2b}]


Bob Hanlon

unread,
Apr 2, 2004, 3:55:57 AM4/2/04
to
It means that it does not know the derivative of Abs. You need to express Abs
in terms of a function for which it knows the derivative.

D[x(2UnitStep[x]-1), x]

2*x*DiracDelta[x] + 2*UnitStep[x] - 1

Simplify[%, #]& /@ {x<0, x>=0}

{-1, 1}

D[If[x<0, -x, x], x]

If[x < 0, -1, 1]


Bob Hanlon

David W. Cantrell

unread,
Apr 2, 2004, 3:56:58 AM4/2/04
to

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

David W. Cantrell

unread,
Apr 5, 2004, 6:45:50 AM4/5/04
to
Jens-Peer Kuska <ku...@informatik.uni-leipzig.de> wrote:
> tha mean that the derivative of Abs[] can be different for
> real and complex arguments. For real arguments you have
>
> D[Abs[x], x] // FullSimplify[#, Element[x, Reals]] &
>
> Sign[x]

It's interesting that that works as desired, considering that

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

Out[1]= Abs'[x]

doesn't work as desired. Anyway, perhaps my prior suggestion of rewriting
in terms of UnitStep is still of some use since

In[2]:= Integrate[Abs[x], x] // FullSimplify[#, Element[x, Reals]] &

Out[2]= Integrate[Abs[x], x]

doesn't work as desired.

BTW, I didn't mention it in my prior post, but perhaps the nicest form
for that real antiderivative is just 1/2*x*Abs[x]. Could anyone manage
(without going to lots of trouble) to get Mathematica to give that form?

Regards,
David Cantrell

Andrzej Kozlowski

unread,
Apr 6, 2004, 7:09:37 AM4/6/04
to

On 5 Apr 2004, at 18:22, David W. Cantrell wrote:

> Jens-Peer Kuska <ku...@informatik.uni-leipzig.de> wrote:
>> tha mean that the derivative of Abs[] can be different for
>> real and complex arguments. For real arguments you have
>>
>> D[Abs[x], x] // FullSimplify[#, Element[x, Reals]] &
>>
>> Sign[x]
>

> It's interesting that that works as desired, considering that
>
> In[1]:= Assuming[Element[x, Reals], Simplify[D[Abs[x], x] ]]
>
> Out[1]= Abs'[x]
>
> doesn't work as desired.


It's just the difference between Simplify and FullSImplify:


Assuming[Element[x, Reals], FullSimplify[D[Abs[x], x]]]


Sign[x]

Observe also that:

ComplexExpand[D[Abs[x], x]]

Sqrt[x^2]/x

> Anyway, perhaps my prior suggestion of rewriting
> in terms of UnitStep is still of some use since
>
> In[2]:= Integrate[Abs[x], x] // FullSimplify[#, Element[x, Reals]] &
>
> Out[2]= Integrate[Abs[x], x]
>
> doesn't work as desired.
>
> BTW, I didn't mention it in my prior post, but perhaps the nicest form
> for that real antiderivative is just 1/2*x*Abs[x]. Could anyone manage
> (without going to lots of trouble) to get Mathematica to give that
> form?

Well, almost:

Integrate[Abs[t], {t, 0, x},
GenerateConditions -> False]

(x*Sqrt[x^2])/2

>
> Regards,
> David Cantrell
>
>
>> nikmatz wrote:

>>> i try to find the derivative of abs function
>>>
>>> D[Abs[x],x]
>>>
>>> and Mathematica answer
>>> Abs`[x]
>>>
>>> what mean that
>
>
>

Andrzej Kozlowski
Chiba, Japan
http://www.mimuw.edu.pl/~akoz/

0 new messages