1

The function Floor[x] is piecewise constant, hence its derivatives should be piecewise zero.

This is far from true in Mathematica

In[497]:= $Version

Out[497]= "10.1.0 for Microsoft Windows (64-bit) (March 24, 2015)"

The first and second derivatives in the interval $\frac{1}{2}\lt x \lt \frac{3}{2}$ are shown in these graphs

Plot[D[Floor[x], {x, 1}] /. x -> xx, {xx, 1/2, 3/2}, PlotRange -> All, 
 PlotLabel -> "y=Floor'[x]", AxesLabel -> {"x", "y"}]

enter image description here

Plot[D[Floor[x], {x, 2}] /. x -> xx, {xx, 1/2, 3/2}, PlotRange -> All,
  PlotLabel -> "y=Floor''[x]", AxesLabel -> {"x", "y"}]

enter image description here

We notice that the drivatives are far from zero even over a broad range of $x$.

In the standard documentation I have found no hint of this problem.

My question: is this a bug?

Dr. Wolfgang Hintze
  • 13,039
  • 17
  • 47

1 Answers1

3

Starting in version M11, Floor'[x] evaluates:

Floor'[x] //TeXForm

$\begin{cases} 0 & x>\lfloor x\rfloor \\ \operatorname{Indeterminate} & \operatorname{True} \end{cases}$

Of course, this obscures the discontinuity at integer x. If you want to produce a derivative that can be integrated back to the original result, you can try using an equivalent HeavisideTheta representation:

{Plot[Floor[x], {x, 1/2, 3/2}], Plot[HeavisideTheta[x-1], {x, 1/2, 3/2}]}

enter image description here

Then:

D[HeavisideTheta[x-1], x]

DiracDelta[-1 + x]

Integrate[DiracDelta[-1+x],x]

HeavisideTheta[-1 + x]

Carl Woll
  • 130,679
  • 6
  • 243
  • 355