I have a function f(t)=2/(2-t)
. It is not so hard to get the rth derivative at t=0 (i.e. 2^(-r)*r!
) without using Mathematica. In the case of Mathematica calculation, I can get the r-th derivative when r=4 like this: D[2/(2-t), {t, 4}]
. But how can I get the rth derivative at t=0 in Mathematica when r is ANY integer? I tried to use this expression, but it didn't work as expected:
Simplify[D[2/(2 - t), {t, r}], Assumptions -> Element[r, Integers]] /. {t->0}
Is it possible to do the above math symbolically in Mathematica just as we humans do?
derivative, in mathematics, the rate of change of a function with respect to a variable. Derivatives are fundamental to the solution of problems in calculus and differential equations.
For analytic functions you can use SeriesCoefficient.
nthDeriv[f_, x_, n_] := n!*SeriesCoefficient[f[x], {x, x, n}]
Your example:
f[t_] := 2/(t - 2)
nthDeriv[f, t, n]
(*
-> Out[39]= n!*Piecewise[{{-2*(2 - t)^(-1 - n), n >= 0}}, 0]
*)
f = FindSequenceFunction[Table[D[2/(2 - t), {t, n}], {n, 1, 5}], r]
(*
-> -((2 (2 - t)^-r Pochhammer[1, r])/(-2 + t))
*)
g[r_, t_] := f
FullSimplify@FindSequenceFunction[Table[g[r, t], {r, 1, 5}] /. t -> 0]
(*
-> 2^-#1 Pochhammer[1, #1] &
*)
Edit
Or just
FindSequenceFunction[Table[D[2/(2 - t), {t, n}], {n, 1, 5}], r] /. t -> 0
(*
-> 2^-r Pochhammer[1, r]
*)
*Edit *
Note: While FindSequenceFunction[]
works in this simple situation, don't bet on it in more general cases.
Edit
To get the result expressed in terms of the factorial function, just do:
FunctionExpand@FindSequenceFunction[Table[D[2/(2-t),{t, n}],{n,1,5}], r] /.t->0
(*
-> 2^-r Gamma[1 + r]
*)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With