       Re: Abs[x] function

• To: mathgroup at smc.vnet.net
• Subject: [mg87846] Re: [mg87816] Abs[x] function
• From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
• Date: Fri, 18 Apr 2008 07:10:38 -0400 (EDT)
• References: <200804180637.CAA12423@smc.vnet.net>

```On 18 Apr 2008, at 15:37, Vladislav wrote:
> Who can explain the behavior. THe derivative Abs[x] at x=.5 is well
> defined and is equal to 1.
>
> In:= D[Abs[x], x]
>
> Out=
> \!\(\*SuperscriptBox["Abs", "\[Prime]",
> MultilineFunction->None]\)[x]
>
> In:= % /. x -> .5
>
> Out=
> \!\(\*SuperscriptBox["Abs", "\[Prime]",
> MultilineFunction->None]\)[0.5]
>

First of all your statement is simply not true. Mathematica's symbolic
D works in the complex plane and in the complex plane the derivative
of Abs at 1 is not defined:

Limit[(Abs[1 + t*I] - Abs)/t, t -> 0]
0

while

I Limit[(Abs[1 + t ] - Abs)/t, t -> 0]
1

The symbolic derivative D automatically applies the chain rule, which
explains why it gives you the answer you got (it returns Abs'
because it does not know what it should be). If you want to
differentiate in the real sense, a non-analytic function at a point
where it has a derivative you have several choices. One is to use
numerical differentiation:

f[x_?NumericQ] := Abs[x]
f'[0.5]
1.

Another is to use Refine before you differentiate:

D[Refine[Abs[x], x > 0], x] /. x -> 0.5
1

another way is the above approach using limits. There are still other
ways but this should be enough.

Andrzej Kozlowski

```

• Prev by Date: Re: heat equation through different media/problem with constant flux
• Next by Date: Re: Re: A Problem with Simplify
• Previous by thread: Abs[x] function
• Next by thread: Re: Abs[x] function