# Mathematica tries to differentiate Abs[x] and this causes a problem? [duplicate]

I am trying to run the following code:

f[t_] := {Cos[t], Sin[t], Cos[t]}
s = 0.1;
s1 = 2;

t[u_] := Normalize[f'[u]]
n[u_] := Normalize[t'[u]]
b[u_] := t[u]\[Cross]n[u]

Graphics3D[
{
BSplineCurve[Table[f[u], {u, 0, 2 Pi, s}]],
Arrow[Table[{f[u], t[u]}, {u, 0, 2 Pi, s1}]],
Arrow[Table[{f[u], n[u]}, {u, 0, 2 Pi, s1}]]
}
]


It works fine until I ask it to compute Arrow[Table[{f[u], t[u]}, {u, 0, 2 Pi, s1}]]. Trying to understand what the error was, I tried to compute n[1]//N and I noticed I obtain this:

Ie: It seems Mathematica differentiates Abs[x] but doesn't know what to so with it later. I tried to compute Abs'[1] and it didn't work. Is there something I can do for this to work? Perhaps some assumption I could use where it replaces Abs'[x] for something Mathematica knows how to handle?

• Try:t[u_] := Simplify[Normalize[f'[u]], Assumptions -> u \[Element] Reals]. Apr 17, 2022 at 11:25
• Apr 17, 2022 at 13:22
• The trouble is that Abs is not complex differentiable, so you must insist to Mathematica that your domain is the reals. Apr 17, 2022 at 13:27

Since Derivative[1][RealAbs][x] work, so we can use /. Abs -> RealAbs
Graphics3D[{BSplineCurve[Table[f[u], {u, 0, 2 Pi, s}]],

• +1 RealAbs was introduced in v11.1; for earlier versions for real x, use Abs[x] :> Sqrt[x^2] Apr 17, 2022 at 13:30