Taking derivative of general order

How can I directly evaluate the following derivative? $$\frac{\partial ^n}{\partial x^n}\bigg[\sum_{k=1}^{m} (m-k)! (ax+b)^k\bigg] = \sum_{k=1}^{m} (m-k)! \bigg[\frac{k!}{(k-n)!}a^n (ax+b)^{k-n}\bigg]$$

Mathematica code is

D[Sum[(m - k)! (ax + b)^k, {k, 1, m}], {x, n}] // FullSimplify


or even this will do:

D[(ax + b)^k, {x, n}] // FullSimplify


EDIT 1:

nthDeriv[f_,x_,n_]:=n!*SeriesCoefficient[f[x],{x,x,n}]
f2[x_] := (a + b x )^k
nthDeriv[f2, x, m]


I obtain a weird output, however, for

f1[x_] := (1 +  x )^n


the above method works fine.

• Have a look at SeriesCoefficient. Commented Jan 20, 2019 at 9:00
• @b.gatessucks SeriesCoefficient seems to be yielding weird output. Commented Jan 20, 2019 at 9:44

1 Answer

D[(a x + b)^k, {x, n}]


is straightforward:

$$a^n k^{(n)} (a x+b)^{k-n}$$

Note: don't use ax when you should use a x.

• Thanks for pointing out. But mathematica 10.04 does not yield the desired output. Which version are you using? Commented Jan 21, 2019 at 5:03
• I'm using 11.3.0.0 on a Mac. Commented Jan 21, 2019 at 5:11