# How does Mathematica understand branchcuts of the complex logarithm? [Part 2]

I observe that the answer generated by the first integration is not in any simple way related to the next two answers. (some simple jump of i 2\pi across the branchcut of the logarithm is not helping either - as discussed in the previous question Mathematica puts the branchcut of the function $log(z^2 +4)$ as being along the positive imaginary axis starting at 2i )

Can someone help understand what Mathematica is doing mathematically?

Integrate [ Exp[I p] Log [ (3 Exp [I p])^2 + 4] , {p, 0, π}]

 2/3 I (-6 + π + 4 ArcTan[3/2] + Log[2197])

Integrate [ Exp[I p] Log [ (3 Exp [I p])^2 + 4] , {p, 0, π/2}]

 -2 + I π + 4/3 ArcTanh[3/2] + Log[5] +  1/3 I (-6 + 4 ArcTan[3/2] + Log[2197])

Integrate [ Exp[I p] Log [ (3 Exp [I p])^2 + 4] , {p, π/2, π}]

1/3 I ((-6 - 6 I) + π + 4 ArcTan[3/2] + 5 I Log[5] + Log[2197])

-
Observation: the definite integral found on $(0, \pi/2)$ equals the difference, at the two endpoints, of the antiderivative that Mathematica can calculate for the integrand. This is not the case, however, on $(0, \pi/2)$. –  murray Mar 27 at 15:46