# Products of logarithms under the integral sign

This question is a simplification of a previously asked question: Polylogarithmic integrals

Consider the following type of function: $$$$\int \frac{\prod_{i=1}^N \log(x-\beta_i)}{x-\alpha} dx$$$$

For the simple case of $$N=2$$ we have the following integral, $$$$\int \frac{\log(x-B) \log(x-C)}{x-A} dx$$$$ the result of which is already highly complicated. See for example the way the Risch algorithm in Wolfram Alpha tackles it: link. The dream is to generalise this $$N=2$$ result, but I can't seem to find information, references or some other canonical answer for the result shown in Wolfram Alpha/Mathematica/RUBI. Needless to say, my own efforts to derive the result have failed identically.

Sadly, for the case for $$N=3$$ logarithms under the integral, Wolfram Alpha and related methods do not even have any answer ready. From what I can see, Wolfram uses a lookup table to determine what the resulting integrand will look like for $$N=2$$, and there is no $$N=3$$ entry in the table.

The most verbose "step-by-step" derivation I have found was through RUBI, where RUBI rule 2485 appears to be invoked. This lead me to page 36 in this pdf, which appears to hint at some obscure sequence of integration by parts and substitutions, but I have found nothing that results in the expressions shown in that PDF.

Since I would like to somehow find a structure for higher $$N$$ of the above more general integral: does anyone have a reference for how to derive the ($$N=2$$) result shown in Wolfram Alpha or Mathematica? Or perhaps give a derivation of the result themselves? I'm aware I can take the derivative of the Wolfram Alpha result, but this will not give me new information on how to solve when $$N=3$$, so solutions going from the original integral to the result, as if there is no prior knowledge of the result, are the only ones I can accept.

He we derive the result for $$N=2$$. We assume that $$A \in {\mathbb R}$$, $$B \in {\mathbb R}$$ and $$C \in {\mathbb R}$$. Then we also take $$x_1 \in {\mathbb R}$$ and $$x_2 \in {\mathbb R}$$ such that $$max(A,B,C) \le x_1 < x_2$$.

We note an identity: $$$$u v=\frac{1}{4} \left[ (u+v)^2 - (u-v)^2\right] \quad (i)$$$$ and we also note the following anti-derivative: $$$$\int\frac{\log[u]^n}{u+A} du = \sum\limits_{p=1}^{n+1} (-1)^p \binom{n}{p-1} (p-1)! Li_p(-\frac{u}{A}) \log[u]^{n-p+1} \quad (ii)$$$$ Let us define: $$$${\mathfrak I}_A^{(B,C)}:=\int\limits_{x_1}^{x_2} \frac{\log(x-B)\log(x-C)}{x-A} dx$$$$ then we have: $$\begin{eqnarray} &&{\mathfrak I}_A^{(B,C)}=\\ &&\frac{1}{4} \left( \int\limits_{x_1}^{x_2} \frac{[\log[(x-B)(x-C)]]^2}{x-A} dx- \int\limits_{x_1}^{x_2} \frac{[\log[\frac{x-B}{x-C}]]^2}{x-A} dx \right)=\\ &&\frac{1}{4} \left( \int\limits_{x_1-B}^{x_2-B} \frac{\log[u]^2}{u+B-A} du + + 2 {\mathfrak I}_A^{(B,C)}+ \int\limits_{x_1-C}^{x_2-C} \frac{\log[u]^2}{u+C-A} du- \int\limits_{\frac{x_1-B}{x_1-C}}^{\frac{x_2-B}{x_2-C}} \left( \frac{1}{1-u} + \frac{1}{u+\frac{A-B}{C-A}}\right) \log[u]^2 du \right) \end{eqnarray}$$ In the first line we took $$(u,v):=(\log(x-B),\log(x-C))$$ and we used the identity $$(i)$$ and in the second line we substituted for $$u=(x-B)/(x-C)$$ in the second integral and we expanded the numerator in the first integral into three terms and substituted accordingly. At this point it was essential to assume that $$max(A,B,C) since otherwise the argument of the logarithm may jump by $$\pm 2 \pi$$.

Therefore we have: $$\begin{eqnarray} &&{\mathfrak I}_A^{(B,C)}= \frac{1}{2} \left(\right.\\ &&\left. \left. \sum\limits_{p=1}^3 (-1)^p \binom{2}{p-1} (p-1)! Li_p (\frac{x}{A-B}) \log[x]^{3-p} \right|_{x_1-B}^{x_2-B} +\right.\\ &&\left. \left. \sum\limits_{p=1}^3 (-1)^p \binom{2}{p-1} (p-1)! Li_p (\frac{x}{A-C}) \log[x]^{3-p} \right|_{x_1-C}^{x_2-C} +\right.\\ &&\left. \left. \sum\limits_{p=1}^3 (-1)^p \binom{2}{p-1} (p-1)! Li_p (x) \log[x]^{3-p} \right|_{\frac{x_1-B}{x_1-C}}^{\frac{x_2-B}{x_2-C}} -\right.\\ &&\left. \left. \sum\limits_{p=1}^3 (-1)^p \binom{2}{p-1} (p-1)! Li_p (x \frac{A-C}{A-B}) \log[x]^{3-p} \right|_{\frac{x_1-B}{x_1-C}}^{\frac{x_2-B}{x_2-C}}\right.\\ &&\left. \right) \end{eqnarray}$$ where we used the anti-derivative $$(ii)$$.

In[3396]:= {x1, x2} =
Sort[RandomReal[{-10, 10}, 2, WorkingPrecision -> 50]];
{A, B, CC} = RandomReal[{-20, x1}, 3, WorkingPrecision -> 50];
Delta[f_, a_, b_] := f[b] - f[a]; n = 2;

NIntegrate[(Log[(x - B)] Log[(x - CC)])/(x - A), {x, x1, x2},
WorkingPrecision -> 20]
1/2 (Delta[
Sum[(-1)^p Binomial[n, p - 1] (p - 1)! PolyLog[
p, #/(A - B)]  Log[#]^(n - p + 1), {p, 1, n + 1}] &, x1 - B,
x2 - B] +
Delta[Sum[(-1)^p Binomial[n, p - 1] (p - 1)! PolyLog[
p, #/(A - CC)]  Log[#]^(n - p + 1), {p, 1, n + 1}] &, x1 - CC,
x2 - CC] +
Delta[Sum[(-1)^p Binomial[n, p - 1] (p - 1)! PolyLog[
p, #]  Log[#]^(n - p + 1), {p, 1, n + 1}] &, (x1 - B)/(
x1 - CC), (x2 - B)/(x2 - CC)] -
Delta[Sum[(-1)^p Binomial[n, p - 1] (p - 1)! PolyLog[
p, # ((A - CC)/(A - B))]  Log[#]^(n - p + 1), {p, 1,
n + 1}] &, (x1 - B)/(x1 - CC), (x2 - B)/(x2 - CC)])

Out[3399]= 0.97636054602843021192

Out[3400]= 0.9763605460284302119212052702582348188593322097

• What was the reason for down-voting this answer ? – Przemo May 9 at 14:58

I have managed to do the first two steps of the attached PDF:

\begin{align*} \int \frac{\log(a+bx)\log(c+dx)}{x} dx &=\log(a+bx)\log(c+dx)\log\left[-\frac{bx}a\right] - b\int dx \frac{\log\left[-\frac{bx}a\right] \log(c+dx)}{a+bx} - d\int \frac{\log\left[-\frac{bx}a\right] \log(a+bx)}{c+dx} \\ &=\log(a+bx)\log(c+dx)\log\left[-\frac{bx}a\right] - b\int dx \frac{\log\left[-\frac{bx}a\right] \left[\log(c+dx) - \log\left[\frac{a(c+dx)}{c(a+bx)}\right]\right]}{a+bx} -\cdots\\ &\phantom=\cdots- b\int dx \frac{\log\left[-\frac{bx}a\right] \log\left[\frac{a(c+dx)}{c(a+bx)}\right]}{a+bx}- d\int dx\frac{\log\left[-\frac{bx}a\right] \left[\log(a+bx) + \log\left[\frac{a(c+dx)}{c(a+bx)}\right]\right]}{c+dx} + \cdots \\ &\phantom= \cdots+ d \int dx \frac{\log\left[-\frac{bx}a\right] \log\left[\frac{a(c+dx)}{c(a+bx)}\right]}{c+dx} \\ &=\log(a+bx)\log(c+dx)\log\left[-\frac{bx}a\right] - b\int dx \frac{\log\left[-\frac{bx}a\right] \left[\log(c+dx) - \log\left[\frac{a(c+dx)}{c(a+bx)}\right]\right]}{a+bx} -\cdots\\ &\phantom=\cdots- d\left[\log\left[-\frac{bx}a\right] - \log\left[-\frac{dx}{c}\right]\right]\int dx\frac{\log(a+bx) + \log\left[\frac{a(c+dx)}{c(a+bx)}\right]}{c+dx} - \cdots \\ &\phantom= \cdots -d\int dx\frac{\log\left[-\frac{dx}c\right]\left[\log(a+bx) + \log\left[\frac{a(c+dx)}{c(a+bx)}\right]\right]}{c+dx} - \int dx \log\left[-\frac{bx}a\right] \log\left[\frac{a(c+dx)}{c(a+bx)}\right]\left[\frac{ b(c+dx)-d(a+bx)}{(a+bx)(c+dx)}\right]\\ &=\log(a+bx)\log(c+dx)\log\left[-\frac{bx}a\right] - b\int dx \frac{\log\left[-\frac{bx}a\right] \left[\log(c+dx) - \log\left[\frac{a(c+dx)}{c(a+bx)}\right]\right]}{a+bx} -\cdots\\ &\phantom=\cdots- d\left[\log\left[-\frac{bx}a\right] - \log\left[-\frac{dx}{c}\right]\right]\int dx\frac{\log(a+bx) + \log\left[\frac{a(c+dx)}{c(a+bx)}\right]}{c+dx} - \cdots \\ &\phantom= \cdots -d\int dx\frac{\log\left[-\frac{dx}c\right]\left[\log(a+bx) + \log\left[\frac{a(c+dx)}{c(a+bx)}\right]\right]}{c+dx} - (bc-ad)\int dx \frac{\log\left[-\frac{bx}a\right] \log\left[\frac{a(c+dx)}{c(a+bx)}\right]}{(a+bx)(c+dx)} \end{align*}

This reduces the integral to known integrals.

I have used the "add and subtract" method, and I have exchanged the constant inside the logarithm by twofold partial integration, back and forth. If anything is unclear leave a comment:)