5

Does anyone know why I can't seem to get a second derivative of this interpolating function f? In this example, h[x] is zero for all x.

data = Join[RandomVariate[NormalDistribution[-3, 1], 100], RandomVariate[NormalDistribution[3, 1], 100]];
f = PDF[SmoothKernelDistribution[data]];
g = f';
h = g';
Plot[{f[x], g[x], h[x]}, {x, -10, 10}, PlotRange -> All]

enter image description here

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
rhennigan
  • 1,783
  • 10
  • 19

1 Answers1

4

If you plot f, f', and f'' over a much smaller range, the answer will be obvious: the interpolation function f is piecewise linear, f' is piecewise constant (i.e., a step function), and f'' is identically zero within each interval.

user15994
  • 509
  • 4
  • 7