-2
$\begingroup$

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
$\endgroup$
9
  • $\begingroup$ @Brad Thanks, I will use coefficient then. $\endgroup$
    – user62892
    Commented Mar 17, 2019 at 22:31
  • $\begingroup$ Ok, I'm really frustrated that Mathematica has these glitches $\endgroup$
    – user62892
    Commented Mar 17, 2019 at 22:53
  • $\begingroup$ 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) $\endgroup$
    – Michael E2
    Commented Mar 17, 2019 at 23:21
  • $\begingroup$ @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. $\endgroup$
    – user62892
    Commented Mar 17, 2019 at 23:32
  • 1
    $\begingroup$ Why do you need the nth derivative? Wouldn't getting the series be more useful? $\endgroup$
    – Carl Woll
    Commented Mar 18, 2019 at 2:36

2 Answers 2

5
$\begingroup$

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

$\endgroup$
0
1
$\begingroup$

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}\}.$

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.