# How to perform this nth derivative operation in MMA?

I have to solve this following equation where I need to differentiate a function $n$ times.

$$A=\sum_{n=0}^{m-1}\frac{s^n}{n!}(-1)^n\frac{d^nf(s)}{ds^n}$$

How to express the above equation in Mathematica?

• nth derivative is not natively supported. – vapor Apr 28 '16 at 6:48
• Derivative[n][f][s]. But it's not clear at all to me what you are trying to do. – Szabolcs Apr 28 '16 at 6:52
• www.wolframalfa.com is natively supported for nth derivative.wolframalpha.com/input/?i=D%28sin%28x%29,{x,n}%29 – Mariusz Iwaniuk May 11 '16 at 11:50

## 1 Answer

happy fish ,he said "nth derivative is not natively supported" Yes it's true,but from here.

Method1: For simple functions you can use InverseFourierTransform.

f[s_] := Sin[s];
nthDeriv1[f_, s_, n_] := FullSimplify[InverseFourierTransform[(-I k)^n FourierTransform[f, s, k], k, s], {n \[Element] Integers, n > 0}]
nthDeriv1[f[s], s, n]


$$\sin \left(\frac{\pi n}{2}+s\right)$$

A = Sum[s^n/n!*(-1)^n*nthDeriv1[f[s], s, n], {n, 0, m - 1}]


$$-\frac{i (\Gamma (m,-i s)-\Gamma (m,i s))}{2 \Gamma (m)}$$

Method2: For analytic functions you can use SeriesCoefficient.

f[s_] := Sin[s];
nthDeriv2[f_, s_, n_] := Simplify[n!*SeriesCoefficient[f, {s, s, n}], {n \[Element] Integers, n > 0}]
nthDeriv2[f[s], s, n]


$$\sin \left(\frac{\pi n}{2}+s\right)$$

A = Sum[s^n/n!*(-1)^n*nthDeriv2[f[s], s, n], {n, 0, m - 1}]


$$-\frac{i (\Gamma (m,-i s)-\Gamma (m,i s))}{2 \Gamma (m)}$$

For very difficult function both methods may not work!

You can use a MAPLE nth derivative is natively supported.