Suppose I have a function $f(s,t) = [(1-t^2)(1-s^2t^2)]^{-1/2}$.
Is there a way to get the general coefficient in this power series of the form $s^{2k} t^{2n}$?
As Artes shows, Series
can produce selected coefficients. We can go further: FindSequenceFunction
finds closed forms for lists. We have to commit some small sins:
[[;; ;;2]]
s, not too badSo we try
FindSequenceFunction@#[[;; ;;2]]&/@CoefficientList[Series[
1/Sqrt[(1-t^2)(1-s^2t^2)],{s,0,20},{t,0,20}
],{s,t}][[;; ;;2]]
which yields
{Pochhammer[1/2,#1-1]/Pochhammer[1,#1-1]&,
Pochhammer[1/2,#1-2]/(2Pochhammer[1,#1-2])&,
3Pochhammer[1/2,#1-3]/(8Pochhammer[1,#1-3])&,...}
where there are a few garbage elements towards the end of the list. This is promising. Type
FindSequenceFunction[{1,1/2,3/8,5/16,35/128,63/256}]
to obtain Pochhammer[1/2,#1-1]/Pochhammer[1,#1-1]&
. It would seem
Sum[Pochhammer[1/2,i-n]/Pochhammer[1,i-n]Pochhammer[1/2,n-1]/Pochhammer[1,n-1]
s^(2(n-1))t^(2(i-1)),{n,1,\[Infinity]},{i,1,\[Infinity]}]
is the series expansion we are looking for. Obviously this method is highly manual. Still, Mathematica was of assistance.
Expanding some definitions and applying some identities, we obtain $$f(s,t)=\sum_{n=0}^\infty\sum_{i=0}^\infty\frac{(-1)^n\prod_{j=1}^i\left(j-n-\frac12\right)}{\Gamma(n+1)\Gamma(1+i-n)}s^{2n}t^{2i}.$$ I think those two $\Gamma$'s can be eliminated, but I'm not very good at complex analysis. I don't know where this is convergent.
Here's a coinciding plot of the two functions
g[s_,t_]=Sum[
((-1)^n Product[j-n-1/2,{j,i}])/(Gamma[n+1]Gamma[1+i-n])s^(2n)t^(2i),{n,0,10},{i,0,10}];
Plot3D[{g[s,t],1/Sqrt[(1-t^2)(1-s^2t^2)]},{s,-1,1},{t,-1,1}]
Assuming that one deals with series expansion around $(s,t)=(0,0)$ we can define
cf[k_, n_] :=
Series[1/Sqrt[(1 - t^2) (1 - s^2 t^2)], {s, 0, 2 k}, {t, 0, 2 n}] //
Normal // Coefficient[#, s^(2 k) t^(2 n)] &
We have defined cf
to get only even coefficients (2k,2n)
, since the others do vanish.
Table[cf[k, n], {k, 6}, {n, 6}] // MatrixForm
One can get the same with Array as well
Array[ cf, {6, 6}] == Table[ cf[k, n], {k, 6}, {n, 6}]
True
This appraoch would be satisfactory for small {n, k}
. For bigger ones there is SeriesCoefficient
(as another answer recalled).
sf[k_, n_]:= SeriesCoefficient[ 1/Sqrt[(1 - t^2) (1 - s^2 t^2)], {s, 0, 2k}, {t, 0, 2n}]
Array[ cf, {6, 6}] == Array[ sf, {6, 6}]
True
And sf
is much better than cf
:
AbsoluteTiming[sf[350, 400];]
{0.0015182, Null}
AbsoluteTiming[cf[350, 400];]
{10.2873, Null}
The standard way to do this would be to simply use SeriesCoefficient
, e.g.
SeriesCoefficient[1/Sqrt[1 + t^2], {t, 0, n}]
produces the general form
(I^n (1/2 (-1 + n))!)/(Sqrt[\[Pi]] (n/2)!)
for Mod[n, 2] == 0 && n >= 0
. However, it seems to have trouble with your particular function, so you may need to resort to guessing as @Adam has shown...