# Getting strange result with derivative of Abs of a complex number

So I am getting some results after a computation like:

(-0.741446 - 5.47358 I) Abs'[-0.702207 + 0.0951203 I]


The problem is the derivative in Abs. Could someone explain why I am getting this and how I can get rid of it? Why doesn't mathematica give me a number back instead and it gives derivative of Absolute value?

• The complex absolute value is not differentiable. I don't know how to get rid of it in this case. It's not clear what value it should be. This works when you want the real absolute value: Abs'[2] /. Abs -> RealAbs. But that is not the case here. Dec 7, 2021 at 16:08
• Related: (3810), (8188), (59503) Dec 7, 2021 at 16:13
• Suppose the result came from D[Abs[Sin[t + I t]], t] /. t -> RandomReal[]. Then the fix is D[ComplexExpand@Abs[Sin[t + I t]], t] /. t -> RandomReal[]. In other words, the solution to your problem cannot be inferred just from the result. You have to fix how the result was generated. Dec 7, 2021 at 16:17
• @MichaelE2 I think this actually helps! Thanks! How can I mark your reply as the answer? Dec 7, 2021 at 16:40
• You can't accept comments. I put them in an answer below, but the site's community would probably appreciate a more complete question. (You could just use the example from my comment, if it's reasonably representative of the problem.) Dec 7, 2021 at 16:48

Apparently, my comments provided a solution. It might be better to have a more complete question, but here are my comments, slightly alter to show reproducible output:

The complex absolute value is not differentiable. I don't know how to get rid of it in this case. It's not clear what value it should be. This works when you want the real absolute value: Abs'[2] /. Abs -> RealAbs. But that is not the case here. – Michael E2 33 mins ago

Suppose the result came from

D[Abs[Sin[t + I t]], t] /. t -> 1/3.
(*  (1.10904 + 0.886847 I) [Abs'[0.345541 + 0.320851 I]  *)


Then the fix is

D[ComplexExpand@Abs[Sin[t + I t]], t] /. t -> RandomReal[]
(8  1.41615  *)


In other words, the solution to your problem cannot be inferred just from the result. You have to fix how the result was generated. – Michael E2 24 mins ago