# Series keeps unwanted terms

This expression doesn't simplify properly. I have this series.

In[33]:= temp2[[8]]

Out[33]= SeriesData[s, 0, {
t[2] t[4], 0, Rational[3, 2] x[1] x[4]}, 0, 3, 1]


And I have this expresion of x in terms of u

In[38]:= replacement

Out[38]= {x[1] -> u[1] - 2 s u[1] u[2] - 2 s u[1] u[4],   x[2] -> u[2]
+ s u[2]^2, x[3] -> u[3] - 2 s u[3]^2 - 2 s u[3] u[4],   x[4] -> u[4] + s u[3] u[4] + 6 s u[4]^2,   x[5] -> u[5] + 5 s u[3] u[5]}


But when I use temp[[8]]/.replacement the series doesn't get truncated.

In[39]:= temp2[[8]] /. replacement

Out[39]= SeriesData[s, 0, {
t[2] t[4], 0,
Rational[3, 2] (u[1] - 2 s u[1] u[2] - 2 s u[1] u[4]) (
u[4] + s u[3] u[4] + 6 s u[4]^2)}, 0, 3, 1]


I don't know why the s inside the replacement is treated differently. temp2 is actually a vector and all other entries are reduced appropiately. I don't what's happen for this entry in particular.

Here an example that works as I want

In[40] temp2[[7]]

Out[40]= SeriesData[s, 0, {
t[2] t[5], (-3) x[2] + Rational[-1, 10] x[5],
Rational[9, 4] x[2]^2 + x[3] x[5] + Rational[-1, 168]
x[5]^2}, 0, 3, 1]

In[41]:= temp2[[7]] /. replacement

Out[41]= SeriesData[s, 0, {
t[2] t[5], (-3) u[2] + Rational[-1, 10] u[5],
Rational[1, 168] ((-126) u[2]^2 + 84 u[3] u[5] - u[5]^2)}, 0, 3, 1]


I have looked for a while and couldn't find the reason why this doesn't simplify properly.... I guess its something simple but I am a little puzzled. It's in the middle of a long calculation so, although I could erase the troubling terms by hand, I need to understand what's going to properly correct the whole calculation and ensure I don't get more similar errors

Thanks :)

• Looks like a bug to me, I'd report it to WR. – Roman May 27 '19 at 19:07
• hmmm ok. Didn't know there was some support form, will write there. good to know it :). – David Jaramillo May 28 '19 at 9:40
• If you want to easily report to WRI you can click "Help" on the menu bar and select "GIve Feedback..." which will launch a browser for the WRI Support URL with several fileds already filled in. – Somos May 29 '19 at 1:42

This works: Normalize the series first, then do the replacement, then series-expand again:

S = temp2[[8]];
Series[Normal[S] /. replacement, {s, 0, 2}]


SeriesData[s, 0, {t[2] t[4], 0, Rational[3, 2] u[1] u[4]}, 0, 3, 1]

You can extract the series parameters from S==temp2[[8]] directly, instead of hard-coding them:

Series[Normal[S] /. replacement, {s, S[[2]], (S[[5]] - 1)/S[[6]]}]


(same result)

• Thanks. That works. But I would like to know what's exactly the problem, because I am doing several operations with series and I don't want to get the same error somewhere else. I do not want to take Normal and Series neither because, I believe, it will make my program very slow. – David Jaramillo May 27 '19 at 18:56