I have this code:
genus[Q_, n_Integer] := Module[{z, x}, SymmetricReduction[ SeriesCoefficient[ Product[ComposeSeries[Series[Q[z], {z, 0, n}], Series[x[i] z, {z, 0, n}]], {i, 1, n}], n], Table[x[i], {i, 1, n}], Table[Subscript[c, i], {i, 1, n}]][[ 1]] // FactorTerms]; AgenusTotal[n_Integer] := Total[Table[ genus[(Sqrt[#]/2)/Sinh[Sqrt[#]/2] &, i] /. c -> p, {i, 0, n}]]; Which generates certain polynomials. For example, for n=3 I get:
$-\frac{p_1}{24}+\frac{7 p_1^2-4 p_2}{5760}+\frac{-31 p_1^3+44 p_2 p_1-16 p_3}{967680}+1$
I need to take the square root of this expression (as a Taylor expansion) and group together terms of similar order (here by order I mean $p_1^3$, $p_1p_2$ and $p_3$ are, for example, of order 3 (each $p_i$ is a polynomial of degree i of another variable), the same way they are grouped in the expression itself. I have this code now:
Series[Series[ Series[Sqrt[AgenusTotal[3]], {Subscript[p, 1], 0, 5}], {Subscript[p, 2], 0, 5}], {Subscript[p, 3], 0, 5}] SeriesCoefficient[ SeriesCoefficient[ SeriesCoefficient[ Series[Series[ Series[Sqrt[AgenusTotal[3]], {Subscript[p, 1], 0, 5}], {Subscript[p, 2], 0, 5}], {Subscript[p, 3], 0, 5}], 2], 2], 1]; It works for individual examples, but I would like something more independent and ideally without putting a lot of Series[Series[ Series[ terms or SeriesCoefficient[ SeriesCoefficient[ SeriesCoefficient[ terms by hand (which would be tedious for n large). Also I would like to pick the right terms automatically, without specifying the SeriesCoefficient by hand (as in this way I might miss certain terms). Can someone help me? Thank you!
![[![enter image description here][1]][1]...](https://i.sstatic.net/sciVx.png)