Consider the two following ways to write down the same expression
ff1 = {(a - b)*Log[2 - z]*Log[z]*PolyLog[2, z/2] -
2*(a - b)*Log[z]*PolyLog[3, (2 - z)/2] + (7*(a - b)*Log[z]*Zeta[3])/4};
ff2 = {(a - b)*Log[z]*(Log[2 - z]*PolyLog[2, z/2] -
2*PolyLog[3, (2 - z)/2] + (7*Zeta[3])/4)};
Using Simplify[ff1 - ff2]
we can easily check that the two expressions are identical. Now let us expand both expressions around z=0
using Series
and Map
seriesFu[ex_] :=
Normal[Series[#, {z, 0, 0}, Assumptions -> {z > 0}]] & /@ ex
r1 = seriesFu /@ ff1
r2 = seriesFu /@ ff2
This yields
{-2 \[Zeta](3) (a-b) log(z)+7/4 (a \[Zeta](3) log(z)-b \[Zeta](3) log(z))+1/2 z (a log(2) log(z)-b log(2) log(z))}
{-(1/4) \[Zeta](3) (a-b) log(z)}
Surprisingly, in Mathematica 11.2 r1
and r2
are not the same, since
Simplify[r1 - r2]
returns
{1/2 z log(2) (a-b) log(z)}
Notice that if we apply Series
directly, the difference vanishes, as it should.
s1 = Normal[Series[ff1, {z, 0, 0}, Assumptions -> {z > 0}]]
s2 = Normal[Series[ff2, {z, 0, 0}, Assumptions -> {z > 0}]]
Simplify[s1 - s2]
gives
{1/4 (b \[Zeta](3) log(z)-a \[Zeta](3) log(z))}
{-(1/4) \[Zeta](3) (a-b) log(z)}
{0}
Mathematica 11.1 is also affected, while Mathematica 11.0 and Mathematica 10.3 do not have this problem.
I noticed this behavior, because a calculation I did with Mathematica 11.0 gave me completely wrong results once I evaluated the same notebook with the version 11.2.
Can someone reproduce this issue? Is it a bug, or have there been some fundamental changes in the way Series
works? Are there workarounds?
Edit: I'm afraid that my question was misunderstood. I'm well aware of the intricacies related to the expansion of functions around their singularities. But this is not what I'm asking. My point is that Mathematica versions before and after 11.1 give completely different result for the same piece of code and I want to understand why.
I made few more tests and it seems that the issue is related to Normal
not Map
. Consider the following
ff1 = (a - b)*Log[2 - z]*Log[z]*PolyLog[2, z/2] -
2*(a - b)*Log[z]*
PolyLog[3, (2 - z)/2] + (7*(a - b)*Log[z]*Zeta[3])/4;
ff2 = (a - b)*
Log[z]*(Log[2 - z]*PolyLog[2, z/2] -
2*PolyLog[3, (2 - z)/2] + (7*Zeta[3])/4);
and
(Series[#, {z, 0, 0}, Assumptions -> {z > 0}] & /@ (ff1)) // Simplify
(Series[#, {z, 0, 0}, Assumptions -> {z > 0}] & /@ (ff2)) // Simplify
Simplify[% - %%]
Even though here Series
is applied to each term separately, it still produces identical results.
1/4 \[Zeta](3) (b-a) log(z)+O(z^1)
-(1/4) \[Zeta](3) (a-b) log(z)+O(z^1)
O(z^1)
However, with Normal
we observe the behavior that I described earlier
(Normal[Series[#, {z, 0, 0},
Assumptions -> {z > 0}]] & /@ (ff1)) // Simplify
(Normal[Series[#, {z, 0, 0},
Assumptions -> {z > 0}]] & /@ (ff2)) // Simplify
Simplify[% - %%]
gives
1/4 (a-b) log(z) (z log(4)-\[Zeta](3))
-(1/4) \[Zeta](3) (a-b) log(z)
1/4 z log(4) (b-a) log(z)
Notice that with versions 11.0, 10.3 and 9.0 both codes give the same results.
This example might be somewhat artificial, but I think that it clearly shows
that something fundamental in Series
/Normal
was changed in version 11.1.
This is what I hope to understand, to avoid such pitfalls when running same
codes on different Mathematica versions.
I guess WRI would say that applying Series
to each term separately is undefined behavior so that one cannot expect any consistency across different versions.
Limit[]
withDirection -> -1
? $\endgroup$Map
that only serve to confuse things. The answer by @BobHanlon appears to show the results are essentially equivalent once the confusing clutter is removed. If you want to claim otherwise then a minimal example that shows the actual discrepancy is needed. $\endgroup$Normal
or not. Earlier versions give the same output regardless ofNormal
. $\endgroup$