BlackHolePerturbationToolkit / PostNewtonianSelfForce

Post-Newtonian expansions in the self-force regime
MIT License
4 stars 0 forks source link

Undesirable behavior in Mathematica's handling of series with logarithmic terms #5

Open cmm0052 opened 1 year ago

cmm0052 commented 1 year ago

Creating this issue to prompt an eventual discussion about the best way to handle this on the toolkit.

Recent versions of Mathematica launch automatic rearrangements of series that contain Log[] terms with the series parameter. In the case of double series (e.g., SeriesData[y, 0, {SeriesData[e, 0, {1, 3, Log[y]}, ...] ...]), Mathematica will automatically reverse the order of the series, creating SeriesData[e, 0, {SeriesData[y, 0, ...] ...]). The toolkit seems to dodge this problem through the use of the ResummedSeriesData construct, but any inner series not contained within a ResummedSeriesData will probably induce this behavior. Also, even without a double series, Mathematica will try to simplify series with Log[y] terms, which usually ends up making them much less simplified and more computationally expensive.

In the expansion process, I got around this problem by renaming the expansion parameter within log terms -- e.g. SeriesData[y, 0, {SeriesData[e, 0, {1, 3, Log[yy]}, ...] ...]). We could consider something like this in the toolkit, but we would have to change the way log terms are extracted from the series. Or we could just deal with the new default behavior as is, but be aware that it is happening.

barrywardell commented 1 year ago

This also seems to be the root cause of the slowdown reported in #3. Making the replacement Log[y] -> Logy was enough to resolve the issue.