# Defining a derivative as a function [duplicate]

I'm trying to define the following function

Df[k_, t_, x_, M_] = 1/Factorial[k] D[Exp[-(4 M x t)/(1 - t)], {t, k}]


I want to differentiate that exponential with respect to t k times but I also want to attribute a value to t after the derivation. But when I call this function with the arguments

Df[1,0,1,1]


for example I get a message saying that zero is not a valid variable. I think it is making t=0 before the derivation. Is there anyway around this?

Thank you very much.

• Define it like this: Df[k_, t_, x_, M_] := 1/Factorial[k] D[Exp[-(4 M x t0)/(1 - t0)], {t0, k}] /. t0 -> t. (This is a dupe, but I have not time to search.) – march Oct 12 '16 at 15:41
• Try SeriesCoefficient[Exp[-(4 M x \[FormalT])/(1 - \[FormalT])], {\[FormalT], t, k}]. – J. M.'s ennui Oct 12 '16 at 15:45

## 1 Answer

Perhaps this is what you're after:

Df[k_, t_, x_,  M_] := (1/Factorial[k] D[Exp[-(4 M x tt)/(1 - tt)], {tt, k}]) /.  tt -> t


Test it:

In=  Df[1, 0, 1, 1]
Out= (* -4 *)

• Like a charm. Thank you very much. – Gabu Oct 12 '16 at 15:48
• @Gabu If it suits you, please accept by clicking the "tick" below the vote count. You can also add an upvote if you think it deserves it. – anderstood Oct 16 '16 at 1:47