# Using Mathematica to help obtain correct analytic formula for logarithm integration

I need to program into my Mathematica code the analytic form for the result of the integral:

$$I(a,b)=\int ^1 _0 dx \frac{\ln(x-a)}{x-b}$$

that is valid for all complex $a$ and $b$ (but $\text{Im } b\neq0)$. Following the steps that I posted in this math SE question, I arrived at

\begin{aligned}I(a,b)&=\text{Li}_2\Big(\frac{-1+a}{a-b}\Big)-\text{Li}_2\Big(\frac{a}{a-b}\Big)\\ &\qquad+\ln\Big(1+\frac{1-a}{a-b}\Big)\ln(1-a)-\ln\Big(1-\frac{a}{a-b}\Big)\ln(-a)\,.\end{aligned}

But this is only valid for a subset of $a$ and $b$ since I haven't paid attention to how the logarithmic cut of the integrand may be crossed by the integration contour. Indeed comparing the numerically integrated result with the analytic one I derived, there is a wedge in the complex $a$ plane (for fixed $b$) for which my formula is wrong:

(*Numerical integration and analytic formula*)
fnum[a_, b_] /; Im[a] != 0 := NIntegrate[Log[x - a]/(x - b), {x, 0, 1}];

fanal[a_, b_] = PolyLog[2, (-1 + a)/(a - b)] - PolyLog[2, a/(a - b)] +
Log[1 + (1 - a)/(a - b)] Log[1 - a] - Log[1 - a/(a - b)] Log[-a];


Now compare:

GraphicsRow[
{Plot3D[Im[fnum[x + I y, .4 + 2 I]], {x, -5, 5}, {y, -5, 5}],
Plot3D[Im[fanal[x + I y, .4 + 2 I]], {x, -5, 5}, {y, -5, 5}]}
]


I have checked that the difference between fnum and fanal is indeed zero except inside the wedge.

I'm desperately trying to get the analytic formula correct for all $a$ and $b$, but as evidenced by the math SE question I posted, my mathematical skills are simply not strong enough. I know that I must add/subtract $i\pi$ from the logarithms to select the right branch. But I don't know exactly what the conditions on $a$ and $b$ are.

Is it possible for Mathematica to help me out (basically picking up slack) in obtaining the more general analytic formula that is valid for all complex values of $a$ and $b$, including inside the wedge?

-
FWIW, here's a Manipulate that might be useful to play with - Manipulate[Grid@Partition[ContourPlot[#[Log[z - a]/(z - b)] /. {z -> x + I y, a -> Complex @@ ac, b -> Complex @@ bc}, {x, -2, 2}, {y, -2, 2}, Axes -> True, ColorFunction -> "Rainbow", PlotLabel -> #, Epilog -> {Red, Thick, Line[{{0, 0}, {1, 0}}]}] & /@ {Re, Im, Abs, Arg}, 2], {{ac, {0, 0}, "a"}, {-2, -2}, {2, 2}}, {{bc, {0, 0}, "b"}, {-2, -2}, {2, 2}}]. –  Stephen Luttrell Jul 26 at 22:25