Let's say we have a function of two variables $f(x,y)$ and we work out its Taylor expansion up to some power. I would like to use Mathematica to construct a list of all exponents that appear in the series. For example, if the series expansion yields something like
$$f(x,y) = xy^2+x^3y^5+xy^4+x^6y^4+O(x^7,y^6)$$
I would like to obtain the list {{1,2}, {3,5}, {1,4}, {6,4}}
. Now, in this thread there is an explanation for polynomials. If p
is such a polynomial,
Map[Exponent[#, {x,y}] &, List @@ p]
does the job. But for series it seems it's not working very well. For example, I considered the example
ser = Series[Hypergeometric2F1[a, a, b, x]*Hypergeometric2F1[c, c, d, y], {x, 0, 2}, {y, 0, 2}]
Then Map[Exponent[#, {x, y}] &, List @@ ser]
gives an error ("Objects of unequal length in Exponent[...]
cannot be combined"). I then tried Map[Exponent[#, {x, y}] &, List @@ ser[[3]]]
but then it simply gives a wrong result {{0,2},{0,2},{0,2}}
, while the correct result would be {{0,0}, {0,1}, {0,2}, {1,0}, {1,1}, {1,2}, {2,0}, {2,1}, {2,2}}
.
So it seems the method for polynomials in that thread to not work well for series.
In that case, given a series expansion in two variables in Mathematica, how can I construct a list of all pairs of exponents that appear in that expansion?
DeleteDuplicates@Map[Exponent[#, {x, y}] &, List @@ (ser // Normal // Expand)]
$\endgroup$Map[Exponent[#, {x, y}] &, Sort@MonomialList[Normal@ser, {x, y}]]
$\endgroup$