I have a series $$\Phi_2=\sum_{0\leq n\leq N}a_nq^n+O(q)^{N+1}$$ whose coefficients $a_n$ are Laurent polynomials in the variables $X_1,X_2$.
I want to find $\Phi^3$. This is should be pretty simple as it is just adding some of the $a_n$ polynomials. However Mathematica is returning a series whose coefficients are rational functions. Upon using Simplify
it returns the good result with polynomials as coefficient.
This is quite puzzling to me and as this is in the middle of a big calculation using Simplify
in every step takes a very long time. I'd like to know why are these rational function appearing to use Simplify
only when strictly necessary.
Here is the actual function. Sorry for the huge expression but I couldn't find a smaller example for which I get the same mistake
In[140]:= Φ2
Out[140]= SeriesData[q, 0, {
Complex[0, -6] Pi + Complex[0, 1] Pi/X[
1] + Complex[0, 1] Pi X[1] + Complex[0, 1] Pi/X[
2] + Complex[0, 1] Pi X[1]/X[
2] + Complex[0, 1] Pi X[2] + Complex[0, 1] Pi X[1]^(-1) X[2], 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Complex[0, -54] Pi + Complex[0, 1] Pi X[1]^(-2) + Complex[0, 14]
Pi/X[1] + Complex[0, 14] Pi X[1] + Complex[0, 1]
Pi X[1]^2 + Complex[0, 1] Pi X[2]^(-2) + Complex[0, -6] Pi X[1]
X[2]^(-2) + Complex[0, 1] Pi X[1]^2 X[2]^(-2) + Complex[0, 14]
Pi/X[2] + Complex[0, -6] Pi X[1]^(-1)/X[
2] + Complex[0, 14] Pi X[1]/X[2] + Complex[0, -6] Pi X[1]^2/X[
2] + Complex[0, 14] Pi X[2] + Complex[0, -6] Pi X[1]^(-2) X[
2] + Complex[0, 14] Pi X[1]^(-1) X[2] + Complex[0, -6] Pi X[1] X[
2] + Complex[0, 1] Pi X[2]^2 + Complex[0, 1]
Pi X[1]^(-2) X[2]^2 + Complex[0, -6] Pi X[1]^(-1) X[2]^2, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Complex[0, -324] Pi + Complex[0, 14] Pi X[1]^(-2) + Complex[0, 92]
Pi/X[1] + Complex[0, 92] Pi X[1] + Complex[0, 14]
Pi X[1]^2 + Complex[0, 1] Pi X[1] X[2]^(-3) + Complex[0, 1]
Pi X[1]^2 X[2]^(-3) + Complex[0, 14] Pi X[2]^(-2) + Complex[0, 1]
Pi X[1]^(-1) X[2]^(-2) + Complex[0, -54] Pi X[1]
X[2]^(-2) + Complex[0, 14] Pi X[1]^2 X[2]^(-2) + Complex[0, 1]
Pi X[1]^3 X[2]^(-2) + Complex[0, 92] Pi/X[
2] + Complex[0, 1] Pi X[1]^(-2)/X[
2] + Complex[0, -54] Pi X[1]^(-1)/X[2] + Complex[0, 92] Pi X[1]/X[
2] + Complex[0, -54] Pi X[1]^2/X[2] + Complex[0, 1] Pi X[1]^3/X[
2] + Complex[0, 92] Pi X[2] + Complex[0, 1] Pi X[1]^(-3) X[
2] + Complex[0, -54] Pi X[1]^(-2) X[2] + Complex[0, 92]
Pi X[1]^(-1) X[2] + Complex[0, -54] Pi X[1] X[2] + Complex[0, 1]
Pi X[1]^2 X[2] + Complex[0, 14] Pi X[2]^2 + Complex[0, 1]
Pi X[1]^(-3) X[2]^2 + Complex[0, 14]
Pi X[1]^(-2) X[2]^2 + Complex[0, -54]
Pi X[1]^(-1) X[2]^2 + Complex[0, 1] Pi X[1] X[2]^2 + Complex[
0, 1] Pi X[1]^(-2) X[2]^3 + Complex[0, 1]
Pi X[1]^(-1) X[2]^3}, 0, 72, 24]
In[141]:= Φ2^3
Out[141]= SeriesData[q, 0, {(
Complex[0, -6] Pi + Complex[0, 1] Pi/X[
1] + Complex[0, 1] Pi X[1] + Complex[0, 1] Pi/X[
2] + Complex[0, 1] Pi X[1]/X[
2] + Complex[0, 1] Pi X[2] + Complex[0, 1] Pi X[1]^(-1) X[2])^3,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3 (Complex[0, -6] Pi + Complex[0, 1] Pi/X[
1] + Complex[0, 1] Pi X[1] + Complex[0, 1] Pi/X[
2] + Complex[0, 1] Pi X[1]/X[
2] + Complex[0, 1] Pi X[2] + Complex[0, 1] Pi X[1]^(-1) X[2])^2 (
Complex[0, -54] Pi + Complex[0, 1] Pi X[1]^(-2) + Complex[0, 14]
Pi/X[1] + Complex[0, 14] Pi X[1] + Complex[0, 1]
Pi X[1]^2 + Complex[0, 1] Pi X[2]^(-2) + Complex[0, -6] Pi X[1]
X[2]^(-2) + Complex[0, 1] Pi X[1]^2 X[2]^(-2) + Complex[0, 14]
Pi/X[2] + Complex[0, -6] Pi X[1]^(-1)/X[
2] + Complex[0, 14] Pi X[1]/X[2] + Complex[0, -6] Pi X[1]^2/X[
2] + Complex[0, 14] Pi X[2] + Complex[0, -6] Pi X[1]^(-2) X[
2] + Complex[0, 14] Pi X[1]^(-1) X[2] + Complex[0, -6] Pi X[1] X[
2] + Complex[0, 1] Pi X[2]^2 + Complex[0, 1]
Pi X[1]^(-2) X[2]^2 + Complex[0, -6] Pi X[1]^(-1) X[2]^2), 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, (Complex[0, -6] Pi + Complex[0, 1] Pi/X[
1] + Complex[0, 1] Pi X[1] + Complex[0, 1] Pi/X[
2] + Complex[0, 1] Pi X[1]/X[
2] + Complex[0, 1] Pi X[2] + Complex[0, 1] Pi X[1]^(-1) X[2])^3 (
3 (Complex[0, -6] Pi + Complex[0, 1] Pi/X[
1] + Complex[0, 1] Pi X[1] + Complex[0, 1] Pi/X[
2] + Complex[0, 1] Pi X[1]/X[
2] + Complex[0, 1] Pi X[2] + Complex[0, 1] Pi X[1]^(-1) X[
2])^(-2) (
Complex[0, -54] Pi + Complex[0, 1] Pi X[1]^(-2) + Complex[0, 14]
Pi/X[1] + Complex[0, 14] Pi X[1] + Complex[0, 1]
Pi X[1]^2 + Complex[0, 1] Pi X[2]^(-2) + Complex[0, -6] Pi X[
1] X[2]^(-2) + Complex[0, 1] Pi X[1]^2 X[2]^(-2) + Complex[
0, 14] Pi/X[2] + Complex[0, -6] Pi X[1]^(-1)/X[
2] + Complex[0, 14] Pi X[1]/X[2] + Complex[0, -6] Pi X[1]^2/X[
2] + Complex[0, 14] Pi X[2] + Complex[0, -6] Pi X[1]^(-2) X[
2] + Complex[0, 14] Pi X[1]^(-1) X[2] + Complex[0, -6] Pi X[1]
X[2] + Complex[0, 1] Pi X[2]^2 + Complex[0, 1]
Pi X[1]^(-2) X[2]^2 + Complex[0, -6]
Pi X[1]^(-1) X[2]^2)^2 + 3 (
Complex[0, -6] Pi + Complex[0, 1] Pi/X[
1] + Complex[0, 1] Pi X[1] + Complex[0, 1] Pi/X[
2] + Complex[0, 1] Pi X[1]/X[
2] + Complex[0, 1] Pi X[2] + Complex[0, 1] Pi X[1]^(-1) X[
2])^(-1) (
Complex[0, -324] Pi + Complex[0, 14] Pi X[1]^(-2) + Complex[
0, 92] Pi/X[
1] + Complex[0, 92] Pi X[1] + Complex[0, 14]
Pi X[1]^2 + Complex[0, 1] Pi X[1] X[2]^(-3) + Complex[0, 1]
Pi X[1]^2 X[2]^(-3) + Complex[0, 14] Pi X[2]^(-2) + Complex[
0, 1] Pi X[1]^(-1) X[2]^(-2) + Complex[0, -54] Pi X[1]
X[2]^(-2) + Complex[0, 14] Pi X[1]^2 X[2]^(-2) + Complex[0, 1]
Pi X[1]^3 X[2]^(-2) + Complex[0, 92] Pi/X[
2] + Complex[0, 1] Pi X[1]^(-2)/X[
2] + Complex[0, -54] Pi X[1]^(-1)/X[
2] + Complex[0, 92] Pi X[1]/X[2] + Complex[0, -54] Pi X[1]^2/X[
2] + Complex[0, 1] Pi X[1]^3/X[
2] + Complex[0, 92] Pi X[2] + Complex[0, 1] Pi X[1]^(-3) X[
2] + Complex[0, -54] Pi X[1]^(-2) X[2] + Complex[0, 92]
Pi X[1]^(-1) X[2] + Complex[0, -54] Pi X[1] X[2] + Complex[
0, 1] Pi X[1]^2 X[2] + Complex[0, 14] Pi X[2]^2 + Complex[0, 1]
Pi X[1]^(-3) X[2]^2 + Complex[0, 14]
Pi X[1]^(-2) X[2]^2 + Complex[0, -54]
Pi X[1]^(-1) X[2]^2 + Complex[0, 1] Pi X[1] X[2]^2 + Complex[
0, 1] Pi X[1]^(-2) X[2]^3 + Complex[0, 1]
Pi X[1]^(-1) X[2]^3))}, 0, 72, 24]
I tried with Mathematica 11.2 and 12 and I get the same mistake.
Expand
(for example) gives the same result asSimplify
, but much faster. $\endgroup$Map[Factor, Φ2^3]
shows there are denominators anyway (monomialsX[1]^k X[2]^k
, as in the answer below) $\endgroup$