There are some peculiar things to be discovered in derivatives of some standard functions in MMA:
Strange behaviour
Example 1: Abs
We have
Abs[0.1]
(* Out[72]= 0.1 *)
But
Abs'[0.1]
(* Out[73]= Derivative[1][Abs][0.1] *)
Same thing if we avoid writing the prime:
D[Abs[x], x] /. x -> 0.1
(* Out[110]= Derivative[1][Abs][0.1] *)
That is, the derivative of Abs[]
has no numerical value.
When plotted, there's nothing to be seen.
The derivative should of course be, or at least behave like, Sign[x]
.
Example 2: Sign
Sign[0.1]
(* Out[78]= 1 *)
Sign'[0.1]
(* Out[79]= Derivative[1][Sign][0.1] *)
That is, the derivative of Sign[]
has no numerical value.
When plotted, there's nothing to be seen.
Example 3: Floor
Floor[0.1]
(* Out[80]= 0 *)
But which value has the derivative at 0 ?
First possibility:
Floor'[0]
(* Out[89]= Derivative[1][Floor][0] *)
No value.
Second possibility:
Floor[0.]
(* Out[90]= 0 *)
Hence the numerical value seems to be 0.
No, bad luck, wrong guess! Look at that
Third possibility:
N[Floor'[0]]
(* Out[93]= 36.2120995105236639865598801739718338716778459859 *)
Furthermore:
Table[{x, N[Floor'[x], 5]}, {x, 0, 1/2, 0.05}]
(* Out[96]= {{0., 36.212}, {0.05, 12.5946}, {0.1, -4.29432}, {0.15,
1.61679}, {0.2, -0.532708}, {0.25, 0.13901}, {0.3, -0.0263362}, {0.35,
0.00318987}, {0.4, -0.000184538}, {0.45, 0.}, {0.5, 0.}} *)
Strange ocillatory behaviour for a quantity which should be = 0 throughout.
It seems to be defined via a Fourier series.
Remedy ?: do it yourself !
Finally, let's create the derivative by ourselves as it is originally defined:
floorPrime[x_] := Limit[(1/h) (Floor[x + h] - Floor [x]), h -> 0]
Plot[0.1 + floorPrime[x], {x, -1, 1}, PlotRange -> {0, 0.2}]
(* Picture snipped *)
absPrime[x_] := Limit[(1/h) (Abs[x + h] - Abs[x]), h -> 0]
Plot[absPrime[x], {x, -1, 1}, PlotRange -> {-2, 2}]
(* Picture snipped *)
Ok, everything fine.
But why has MMA such problems with its own standard operation ' (or D[]) in this class of functions? Please explain.
Regards,
Wolfgang