0
$\begingroup$

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?

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

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.