# Is there a way to select the highest exponent of a polynomial expression?

I have a problem to program a particular kind of expression:

Sum[1/(k n) (HS[t^k,x^k])^n,{n,1,Infinity},{k,1,Infinity}]


where HS[t_,x_] is a polynomial function in $t$ and $x$ such as for example $1+ t^2 -x^3 t^4$, it does not matter in this context. What I'd like to find is a way to truncate the expression to a particular power of t. If for instance I would like to know all the constribution of the series that are at most to the third order in t, is there a way such that I can make Mathematica to do all the computation but to keep as output just the order I am interested in (but all of them). I tried adding the following boolean expression:

Boole[Exponent[HS[t^k,x^k])^n,t]<= Max]]


where Max is the highest power I want in $t$, but Mathematica still give to me the output of the symbolic series without do any computation. Is there a good way to program it? Any other function?

• Do you require something like Select[poly, MemberQ[#, x^2 | x^3] &] and Select[poly, FreeQ[#, x^3] &], where (after this answer by Stich below), poly = (1 + x - 2 x^2 - 2 x^3 + x^4 + x^5 - 2 y - 4 x y + 4 x^3 y + 2 x^4 y + y^2 + 3 x y^2 + 3 x^2 y^2 + x^3 y^2) – user1066 May 9 '17 at 19:12
• In the case you give, the sum diverges for x=t=0. This may or may not matter to you, but I thought it might be a useful to know... – mikado May 9 '17 at 20:00
• max = 3; Normal@Series[1 + t^2 - x^3 t^4, {t, 0, max}] but it does not work when an exponent contains a variable (e.g. t^k). – Michael E2 May 23 '17 at 12:00

Let's define a function:

truncate[polynomial_, variable_, maxPower_] := Module[{rules},
rules = CoefficientRules[polynomial, {variable}];
Plus @@ (Times[Power[variable, #[[1, 1]]], #[]] & /@
Select[rules, (#[[1, 1]] <= maxPower) &])
]


Then we can use it like this:

truncate[1 + x - 2 x^2 - 2 x^3 + x^4 + x^5 - 2 y - 4 x y + 4 x^3 y +
2 x^4 y + y^2 + 3 x y^2 + 3 x^2 y^2 + x^3 y^2, x, 2]


1 - 2 y + y^2 + x^2 (-2 + 3 y^2) + x (1 - 4 y + 3 y^2)

truncate[1 + x - 2 x^2 - 2 x^3 + x^4 + x^5 - 2 y - 4 x y + 4 x^3 y +
2 x^4 y + y^2 + 3 x y^2 + 3 x^2 y^2 + x^3 y^2, y, 2]


1 + x - 2 x^2 - 2 x^3 + x^4 + x^5 + (-2 - 4 x + 4 x^3 + 2 x^4) y + (1 + 3 x + 3 x^2 + x^3) y^2

• Is there a way to use the algorithm you wrote in the case in which the power of the polynomial is generic? If I have, for instance, y^(b+2) x^2 + y^(3/2 b + 1) x + ..., and I assume (by the function assuming) that b is positive and smaller than 1, is there a way to truncate the polynomial in the same way of this algorithm to a given generic power which will be smaller than a maxpower I chose? How should I have to change the module such that it works? Because for now, it seems to fail in this context. Thanks you in advance. – Alessandro Mininno Jun 21 '17 at 8:33

Thank for your help but this is how I managed to solve my problem. I have decided to answer my own question because my method works but maybe it is not efficient for an expert eye.

My original question was posted on Mathematics since here I couldn't for reasons I do not know:

https://math.stackexchange.com/questions/2251181/implement-plethystic-logarithm-on-mathematica

Anyhow, I decided to expand the Logarithm and get the expression on this question

Sum[1/(k n)(-1)^(n-1) (1-HS[t^k,x^k])^n,{n,1,Infinity},{k,1,Infinity}]


However I know from the theory that HS[t^k,x^k] is a fraction as \frac{P(t,x)}{Q(t,x)}, where P and Q are polynomials in t and x. Then before the expansion of the Logarithm I use its property to divide the numerator and the denominator. Then I calculate the plethystic logarithm twice: once for the numerator and once for the denominator.

Since P and Q are polynomials, I can expand them and get something like:

P(t^k,x^k)=\sum_{i=0}^m x^(k n) t^(k n)


Let us suppose then that the first power non-zero (since the zero power cancels in the expansion) is t^{(\tilde{m}(k))}, where I'm supposing that the power of t depend on the index k. Then I can collect the power:

1-P(t^k,x^k)=\tilde{P}(t^k,x^k)=t^{(\tilde{m}(k))}\tilde{\tilde{P}}(t^k,x^k)


Now the expression of the summation is

Sum[1/(k n)(-1)^(n-1) t^(\tilde{m}(k) n)(P2(t^k,x^k))^n,{n,1,Infinity},{k,1,Infinity}]


If I want to know the expression until a given power, it is sufficient then to keep the exponent of the collected $t$ under the given power. So my final expression is

Series[If[\tilde{m}(k) n <= power+1,Sum[1/(k n)(-1)^(n-1) t^(\tilde{m}(k) n)(P2(t^k,x^k))^n,0],{n,1,Infinity},{k,1,Infinity}],{t,0,power]


I have then the right expression of the plethystic logarithm to the power I desire. Is it clear my thinking?

Thank you all for the help you gave to me, and I think I really arrived to this solution only for your helping.