# Make Sinc'[0] return 0 instead of Indeterminate

I want Sinc'[0] to return 0, but instead it returns Indeterminate.

I've tried

Unprotect[Sinc]
Unprotect[Derivative]
Derivative[1][Sinc][0] ^= 0


But it doesn't work.

Maybe this needs to be similar to this (from the help files for Derivative)

f'[x_] := If[PossibleZeroQ[x], N[0, Precision[x]], (x Cos[x] - Sin[x])/x^2];

-
Why not define your own function? –  VF1 Feb 11 at 23:13
I'd be interested in knowing if the community considers this a bug –  Rojo Feb 11 at 23:48
@Rojo Techinically it's true that the derivative should be Piecewise[{{..., x!=0}, {0, x==0}] but since it's a single point only it's not exactly a unique situation in Mma ... –  Szabolcs Feb 12 at 1:03
@Szabolcs yes. However, that single point is the whole point of having a Sinc function in the first place so this itches me a little –  Rojo Feb 12 at 1:18
@Rojo I played a bit with piecewise functions and I think I know why this is not feasible: suppose the derivative were returned as a piecewise. Actually we might as well start from sinc[x_] := Piecewise[{{Sin[x]/x, x != 0}}, 1]. The mathematically proper derivative of Sinc should be what sinc'[x] returns. But now let's take the derivative of this once more: D[sinc'[x],x]. This will be a piecewise that's still 0 in the point $x=0$. However the actual second derivative sinc''(0) should be -1/3. This illustrates how Piecewise itself is unable to handle derivatives ... –  Szabolcs Feb 12 at 1:27

One solution is making your own function:

MySinc[x_] := Sinc[x]
Derivative[1][MySinc] ^=
If[# == 0, 0, Derivative[1][Sinc] // Evaluate] &;
MySinc[0]
(* 1 *)
MySinc'[0]
(* 0 *)


And then in expressions which use Sinc use expr/.Sinc->MySinc. To me this seems like the cleanest solution. However, this can be done with Sinc, too. But it is difficult to undo!

Unprotect[Sinc];
tmp = Derivative[1][Sinc] // Evaluate;
Derivative[1][Sinc] ^= If[# == 0, 0, tmp] &;
Protect[Sinc];
Sinc[0]
(* 1 *)
Sinc'[0]
(* 0 *)

-
I supose i should accept this. It offers 2 good suggestions –  pdmclean Feb 14 at 21:38
@pdmclean does the latter part not directly answer your question? –  VF1 Feb 15 at 1:13

The function is:

f[x_] = D[Sinc[x], x];
f[x]
Cos[x]/x - Sin[x]/x^2


In its current form, the value at x=0 is indeterminate. It is only when taking the limit as x->0 that a value emerges. Hence:

Limit[D[Sinc[x], x], x -> 0]
0


Or, more succinctly:

Limit[f[x], x -> 0]
0

-
I of course agree that you need to take the limit but the same reasoning could be applied to Sinc alone. So I agree with @Rojo above that the reason to have a Sinc function should be that you don't have to evaluate Limit[Sin[x]/x,x->0] every time. It would be nice if the same was true for Sinc'. –  sebhofer Feb 12 at 16:51