# Derivative for arbitrary number of times

I want to take the derivative of a function with respect to $$t$$ for an arbitrary $$k$$ number of times at the point $$t = 0$$ using Mathematica.

The function is

$$f(t) = \frac{\mathrm e^{kt}\sinh(t/n)}{\cosh(t/n) - a},$$

where $$a$$ and $$n$$ are some constants.

• In recent versions of Mathematica, D can take arbitrary $n$ times derivative, where $n$ need not be a specific number, but sometimes the result is not very much useful. Aug 6, 2019 at 6:44

Try

 f[t_] := Exp[k t] Sinh[t/n]/(Cosh[t/n] - a)


and for example the third derivative f''' evaluates like this

Derivative[f]
(*-(3/((1 - a)^2 n^3)) + 1/((1 - a) n^3) + (3 k^2)/((1 - a) n)*)

• df0[k_Integer?NonNegative] := df0[k] = Derivative[k][f] // FullSimplify Aug 4, 2019 at 17:00

You can proceed to some extent, although not fully, by using the Leibniz formula $$(f g)^{(n)}|_{t=0}=\sum_{p=0}^{n}\left(\begin{array}{l}{n} \\ {p}\end{array}\right) f^{(n-p)}|_{t=0} ~g^{(p)}|_{t=0}$$ Your $$f(t)=e^{kt}$$ and therefore $$f^{(n-p)}|_{t=0}=k^{n-p}$$. I couldn't find a simple form for the $$p$$th derivative of your $$g(t)= \left(\frac{\sinh (t / n)}{\cosh (t / n)-a }\right)$$, other than the fact that an even number of derivatives vanish at $$t=0$$. Therefore,

$$\frac{d^n}{dt^n} \left(e^{k t} \times\frac{\sinh (t / n)}{\cosh (t / n)-a )}\right)\bigg|_{t=0}=\sum_{p=1~, ~p\in 2\mathbb{Z}^++1}^n \binom{n}{p}k^{n-p} \frac{d^p}{dt^p} \left(\frac{\sinh (t / n)}{\cosh (t / n)-a }\right)\bigg|_{t=0}~.$$ [Not sure whether this is a question for Mathematica though. At times you can get lucky – given a sequence of functions as a list, you can get the $$n$$th one in the sequence using FindSequenceFunction but this specific case is too complicated.]

Edit

We can go a step further with Leibniz rule : $$\frac{d^p}{dt^p} \left(\frac{\sinh (t / n)}{\cosh (t / n)-a }\right)\bigg|_{t=0}=\sum_{q=0~, ~q\in 2\mathbb{Z}^++1}^{q=p}\binom{p}{q} n^{q-p} \frac{d^q}{dt^q} \left(\frac{1}{\cosh (t / n)-a }\right)\bigg|_{t=0}$$

Therefore, $$\frac{d^n}{dt^n} \left(e^{k t} \times\frac{\sinh (t / n)}{\cosh (t / n)-a )}\right)\bigg|_{t=0}=\sum_{p=1~, ~p\in 2\mathbb{Z}^++1}^n \binom{n}{p}k^{n-p} \sum_{q=0~, ~q\in 2\mathbb{Z}^++1}^{q=p}\binom{p}{q} n^{q-p} \frac{d^q}{dt^q} \left(\frac{1}{\cosh (t / n)-a }\right)\bigg|_{t=0}.$$ This is probably as general as it gets for arbitrary $$n$$.

• @Jyotirmoy Mukherjee, I have added some more stuff in my edits. Aug 5, 2019 at 16:45