I've found what appears to be a bug in MMA related to taking successive series expansions. I'm providing this minimal example and post as other posts didn't appear to address the issue I found.
In particular, MMA seems to get confused in keeping track of orders of parameters when future expansion parameters are in the powers of earlier expansion parameters, which seems to be due to a limitation of the SeriesData
object that Series
produces.
While it appears known that MMA may include extra powers, e.g. Multivariable Taylor expansion does not work as expected, in my example MMA misses some critical terms. For example
Series[x^z y^z (1 + x + y)/z, {x, 0, 0}, {y, 0, 0}, {z, 0, 1}] // Normal
yields the incorrect expression
$$ \frac{1}{z}+\log (x)+\log (y) + z \log (x) \log (y) $$
whereas
Series[Series[Series[x^z y^z (1 + x + y)/z, {x, 0, 0}] //
Normal, {y, 0, 0}] //Normal, {z, 0, 1}] // Normal
captures all the correct terms,
$$ \frac{1}{z}+\log (x)+\log (y) + \frac{1}{2} z \big( \log ^2(x)+2 \log (x) \log (y)+\log ^2(y) \big). $$
It seems that the critical point is to ensure that one finds the correct answer, each Series[]
result needs to be hit with a Normal[]
first, before performing the next Series[]
.
Interestingly, the first method does not miss any terms when I remove the $1/z$ from the expression to be expanded and ask for a series expansion up to $O(z^2)$, although the first method does then give some extra terms $O(z^3)$ and $O(z^4)$, too.
Possibly the bug (?) described above is related to Peculiarities with Series and fractional exponents or bug?.
Series[x^z y^z (1 + x + y)/z, {z, 0, 1}] // FullForm
vs.Series[x^z y^z (1 + x + y)/z, {y, 0, 0}, {x, 0, 0}] // FullForm
. $\endgroup$