0
$\begingroup$

When performing manipulations on nested series, I need the series to retain the nesting order I originally defined. In Mathematica versions 8.0 and 10.4, this was almost always the default behavior. However, I recently started using Mathematica 13.0 and found that this was no longer the case. The problem appears to occur whenever a Log[] term is introduced. For instance, see the following example:

test=SeriesData[x, 0, {SeriesData[e, 0, {5, 0, Rational[-15, 2], 0, Rational[15, 8], 0, Rational[5, 16], 0, Rational[15, 128]}, 0, 9, 1], 0, SeriesData[e, 0, {-6, 0, 24, 0, Rational[-99, 4], 0, Rational[21, 4], 0, Rational[51, 64]}, 0, 9, 1], SeriesData[e, 0, {3 a, 0, Rational[-39, 2] a, 0, Rational[189, 8] a, 0, Rational[-87, 16] a, 0, Rational[-111, 128] a}, 0, 9, 1], SeriesData[e, 0, {2 (Rational[-9, 2] + Rational[-3, 2] a^2), 0, 3 (9 + Rational[3, 2] a^2) + 2 (6 + Rational[15, 4] a^2), 0, 2 (Rational[45, 8] + Rational[-45, 16] a^2) + 3 (Rational[-117, 16] + Rational[-9, 4] a^2), 0, 2 (Rational[-165, 16] + Rational[15, 32] a^2) + 3 (Rational[-51, 8] + Rational[9, 16] a^2), 0, 2 (Rational[345, 128] + Rational[15, 256] a^2) + 3 (Rational[873, 256] + Rational[3, 32] a^2)}, 0, 9, 1], SeriesData[e, 0, {30 a, 0, (-138) a, 0, Rational[393, 4] a, 0, Rational[99, 2] a, 0, Rational[-1857, 64] a}, 0, 9, 1], SeriesData[e, 0, {3 a^2 + 2 (Rational[-27, 2] + Rational[-31, 2] a^2), 0, 3 (36 + Rational[45, 2] a^2) + 2 (9 + Rational[123, 4] a^2), 0, 3 (Rational[-111, 8] + Rational[-105, 4] a^2) + 2 (Rational[249, 8] + Rational[-123, 16] a^2), 0, 2 (Rational[-375, 16] + Rational[-413, 32] a^2) + 3 (Rational[-75, 2] + Rational[-91, 16] a^2), 0, 2 (Rational[-1575, 128] + Rational[1125, 256] a^2) + 3 (Rational[45, 128] + Rational[93, 16] a^2)}, 0, 9, 1]}, 3, 10, 1];

We can perform standard operations on this series such as multiplication/addition and keep x as the outer series without a problem. However, if we try the following operations

Print[test+Log[x]];
Print[ExpandAll[test+Log[x]]];
Print[ExpandAll[test+Log[x]*e^4*x^3]];
test[[3,1]]+=Log[x];
Print[test];
test[[3,1]]+=Log[e];
Print[test];

we find that all but the first rearrange the series so that e is on the outside.

This is a problem for my code, which involves a great number of series manipulations involving log terms. Thus far, I have been addressing the issue by manually going into logarithms and substituting in a dummy variable like "xx" for x. However, this is far from ideal, and it would be much simpler if I could change the behavior in a more universal manner. Otherwise, I may just have to stick with the older versions of Mathematica.

$\endgroup$
4
  • $\begingroup$ My guess is that you're out of luck, since With[{s = ReplacePart[test, {3, 1} -> test[[3, 1]] + Log[x]]}, ReplacePart[s, {3, 1} -> s[[3, 1]] + Log[e]] ] has x on the outside, but if we replace Log[e] -> 0 in it, it automatically reverts to e on the outside. $\endgroup$
    – Michael E2
    May 23, 2022 at 18:49
  • $\begingroup$ Yes, I was afraid that might be the case. This new behavior seems rather curious. I wonder what was changed in the Series functionality to have it check for Log terms and then reevaluate like this. $\endgroup$
    – cmm0052
    May 23, 2022 at 18:56
  • $\begingroup$ I can't figure out what you want. Does this help? Collect[test, e] or this: Map[Simplify, Collect[test, e], 2] or this Map[Simplify[Collect[#, a]] &, Collect[test, x], 2]? You might also take a look at ComplexityFunction $\endgroup$ May 24, 2022 at 6:16
  • $\begingroup$ Also, instead of manually inserting a dummy variable, you could do this: expr = expr/.x->xx $\endgroup$ May 24, 2022 at 6:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.