I have a function $\phi(t)$ and I want to define a function $\phi D(t,r):=\phi^{(r)}(t)$, in other words evaluate the $r$'th derivative of $\phi$ at $t$. The naive code that I have is:
phiD[t_, r_] = D[phi[t], {t, r}]
which doesn't work, because Mathematica doesn't know to evaluate the $r$ part first and then the $t$ part. What's the easiest way to implement this?
phi[t_] := Sin[t]^5 Cos[t]^3
, thenphiD[t_, r_] = D[phi[t], {t, r}]
returns essentiallyD[Cos[t]^3*Sin[t]^5, {t, r}]
. And thenphiD[t, 6]
will give the correct 6th derivative as a function oft
; you may then replacet
with any particular numeric value. $\endgroup$t
inphiD[t_, r_] = D[phi[t], {t, r}]
, you're asking to take thet
th derivative of a constant rather than of a function depending on a variable. And you're solution provided as an Answer certainly avoids that. I just wasn't clear what the original problem was. $\endgroup$