2
$\begingroup$

Version 12.1 on a Mac

The question about the derivative of Abs' has been asked several times, but all previous posts dealt with Abs'[x] and my question is about Abs'[1].

It seems to me that there are no complex-numbers issues with Abs'[1], yet

 Abs'[1]//N

does not simplify to 1.0. Is there a way to overcome this?

Edit:

For me, Abs appeared as a result of calling Norm on a real vector. How do I make it use RealAbs?

$\endgroup$
1
  • 2
    $\begingroup$ 1 is a complex number, too. The problem is that Abs[z] is a complex function, not whether z is in the subset of real numbers. In terms of complex function theory, Abs'[z] is undefined. You can deal with it as it is dealt with elsewhere, such as ComplexExpand[Abs'[1]]. $\endgroup$
    – Michael E2
    Apr 6, 2020 at 18:56

1 Answer 1

10
$\begingroup$

One must somehow assert the domain $\mathbb{R}$ because the default domain is $\mathbb{C}$.

The symbol RealAbs is one such way:

RealAbs'[1]
1

Also note that just because there are no explicit complex numbers doesn't mean the derivative exists over $\mathbb{C}$. Here's the derivative at z == 1 over both domains:

dq = DifferenceQuotient[Abs[z], {z, h}] /. z -> 1;

Limit[dq, h -> 0, Direction -> Complexes]
Indeterminate
Limit[dq, h -> 0, Direction -> Reals]
1
$\endgroup$
3
  • $\begingroup$ Thanks, this clarifies the behavior. But how does one make the following work: NIntegrate[D[Norm[{Sin[t], Cos[t]}], t], {t, 0, 2 [Pi]}] $\endgroup$
    – Wynne
    Apr 6, 2020 at 20:48
  • $\begingroup$ You could define RealNorm[args__] := Norm[args] /. Abs -> RealAbs. $\endgroup$
    – Greg Hurst
    Apr 6, 2020 at 21:17
  • $\begingroup$ You could even remove some instance of Abs with RealNorm[args__] := Norm[args] /. {Abs[f_]^n_Integer?EvenQ :> f^n, Abs[f_] :> RealAbs[f]} $\endgroup$
    – Greg Hurst
    Apr 6, 2020 at 23:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.