# Direct and easy calculation of the N-th derivative of a function at 0?

Does Mathematica have an easy way to calculate the n-th derivative of a function at zero?

I was looking for something along the way D[e^x,{x,n,0}].

How do I do that?

Mathematica doesn't know that it needs to remove the singularity.

Here's the code (notice the pole is removed with the multiplication):

f[x_] := 2 Pi x Csc[2 Pi x];
Derivative[3][f][0]
D[2 Pi x Csc[2 Pi x], {x, 1}] /. x -> 0

• @Brad Thanks, I will use coefficient then.
– user62892
Commented Mar 17, 2019 at 22:31
• Ok, I'm really frustrated that Mathematica has these glitches
– user62892
Commented Mar 17, 2019 at 22:53
• You haven't specified how f[0] is to be defined -- well, the expression you gave is undefined. How is Mathematica to know whether you want the hole in the domain to be removed or not and how you want the function to extended? Even in mathematical papers, authors will indicate what's intended. That said, there are known problems with differentiation of piecewise function: (100852), (111698) Commented Mar 17, 2019 at 23:21
• @MichaelE2 If one uses the coefficient formula, SeriesCoefficient[Exp[x], {x, 0, n}], it gives the correct answer. I disagree with your argument, the coefficients of the power expansion of 2 Pi x Csc[2 Pi x] about 0 all exist, therefore the n-th derivatives at 0 should be those coefficients.
– user62892
Commented Mar 17, 2019 at 23:32
• Why do you need the nth derivative? Wouldn't getting the series be more useful? Commented Mar 18, 2019 at 2:36

You can use:

D[Exp[x], {x, n}] /. x->0


1

Also possible is:

n! SeriesCoefficient[Exp[x], {x, 0, n}, Assumptions->n>0]


1

UPDATE

If you want to define the function at zero, to be its limit there ...

g[x_,0]  := 1/Sinc[2 \[Pi] x];
g[x_,k_] := D[g[x,k-1],x] // FullSimplify;
f[x_,k_] := If[x == 0, Limit[g[a,k], a -> 0], g[x,k]];


The first few derivatives of $$f(x)$$ at $$x=0$$ are tabulated:

Table[f[0,k],{k,6}]


and are:

$$\{0, \frac{4 \pi^2}{3}, 0, \frac{112 \pi^4}{15}, 0, \frac{1984 \pi^6}{21}\}.$$

• Comments are not for extended discussion; this conversation has been moved to chat.
– Kuba
Commented Mar 18, 2019 at 11:10