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


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.

  • $\begingroup$ 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.) $\endgroup$ – march Oct 12 '16 at 15:41
  • $\begingroup$ Try SeriesCoefficient[Exp[-(4 M x \[FormalT])/(1 - \[FormalT])], {\[FormalT], t, k}]. $\endgroup$ – J. M.'s ennui Oct 12 '16 at 15:45

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 *)
  • $\begingroup$ Like a charm. Thank you very much. $\endgroup$ – Gabu Oct 12 '16 at 15:48
  • $\begingroup$ @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. $\endgroup$ – anderstood Oct 16 '16 at 1:47

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