# Another “closed form expression” for a generating function involving harmonic numbers.

This question is closely related to Calculating alternating Euler sums of odd powers.

Let $p\ge 1$ and $q\ge 1$ be integers and $1> x\ge 0$ be real. We use the following definition: $${\bf H}^{(p)}_q(x):=\sum\limits_{n=1}^\infty \frac{H_n^{(p)}}{n^q} \cdot x^n$$ Now, by dividing the closed form expression for ${\bf H}^{(1)}_3(x)$ given in the answer to Generating function of squares of generalized harmonic numbers by $x$ and integrating we derived the following expression below: \begin{eqnarray} &&{\bf H}^{(1)}_4(x)=\\ &&-\text{Li}_5(1-x)+\text{Li}_5\left(\frac{x-1}{x}\right)+2 \text{Li}_5(x)-\frac{1}{2} \text{Li}_3(x) \log ^2(1-x)+\\ &&-\frac{1}{3} \text{Li}_3(1-x) \left(3 \log ^2(1-x)-3 \log (x) \log (1-x)+\pi ^2\right)-\frac{1}{4} \text{Li}_2(x){}^2 \log (1-x)+\\ &&+\frac{1}{12} \text{Li}_2(x) \left(\pi ^2-9 \log (1-x) \log (x)\right) \log (1-x)+\\ &&\text{Li}_4(1-x) \log (1-x)-\text{Li}_4\left(\frac{x-1}{x}\right) \log (1-x)-\text{Li}_4(1-x) \log (x)+\frac{1}{2} \zeta (3) \log ^2(1-x)+\\ &&\frac{1}{20} \log ^5(1-x)-\frac{\log ^5(x)}{120}-\frac{1}{4} \log (x) \log ^4(1-x)+\frac{1}{18} \pi ^2 \log ^3(1-x)-\frac{1}{36} \pi ^2 \log ^3(x)+\\ &&\frac{1}{24} \pi ^2 \log (x) \log ^2(1-x)-\frac{1}{4} \log ^2(x) \log ^3(1-x)+\frac{1}{12} \log ^3(x) \log ^2(1-x)+\\ &&\frac{1}{48} \pi ^4 \log (1-x)-\frac{1}{120} \pi ^4 \log (x)+\\ &&\zeta (5)+\frac{\pi ^2 \zeta (3)}{3}+\\ &&-{\mathcal S}_2^{(2)}(x)+{\mathcal S}_2^{(2)}(\frac{x}{x-1})-\frac{5}{4} ({\mathcal S}_2^{(2)}(1)-{\mathcal S}_2^{(2)}(1-x))+\\ &&\frac{1}{4}({\mathcal D}^{(2)}_2(1)-{\mathcal D}^{(2)}_2(1-x)) \end{eqnarray} where \begin{eqnarray} {\mathcal S}^{(2)}_2(x)&:=& \int\limits_0^x \frac{Li_2(t)^2}{t} dt \\ &=&2 \cdot \left( {\bf H}^{(2)}_3(x) - Li_5(x) \right) + 4 \left( {\bf H}^{(1)}_4(x) - Li_5(x) \right) \end{eqnarray} and \begin{eqnarray} {\mathcal D}^{(2)}_2(x)&:=&\int\limits_0^x \log(t)^2 \cdot \frac{Li_2(t)}{1-t}dt\\ &=& 2 \left( {\bf H}^{(2)}_3(x)- Li_5(x) \right) - 2 \log(x) \cdot \left({\bf H}^{(2)}_2(x)-Li_4(x) \right) + [\log(x)]^2 \cdot \left( {\bf H}^{(2)}_1(x) - Li_3(x)\right) \end{eqnarray} where \begin{eqnarray} {\bf H}^{(2)}_1(x) &=& 2 Li_3(1-x) - 2 \zeta(3) - \frac{\pi^2}{3} \log(1-x) + \log(1-x)^2 \log(x) + \log(1-x) Li_2(x) + Li_3(x) \\ {\bf H}^{(2)}_2(x) &=& -2 \zeta(4) + 2 Li_4(1-x) - 2 \log(1-x) \zeta(3) - \frac{\pi^2}{6} \log(1-x)^2 - \frac{1}{12} \log(1-x)^4 +\\ && \frac{1}{3} \log(1-x)^3 \log(x) + \frac{1}{2} Li_2(x)^2 + 2 \log(1-x) Li_3(x) - Li_4(x) - 2 Li_4(\frac{x}{x-1}) \end{eqnarray} Now I have two questions. The first one is a rhetoric one and it reads can the residual terms,i.e. the integrals on the very bottom, be expressed via poly-logarithms and elementary functions only? The second one can we derive closed form expressions for other values of $p$ and $q$ especially when $p+q \ge 5$.

• @ Przemo How did you do the integrals, "by hand" or with a symbolic calculator like Mathematica? I noticed that Mathematica can't solve some of the integrals appearing, and that's why I have considered this case as "not soluble". I admit, however, that you expression looks much more elegant than mine. Have to check it. – Dr. Wolfgang Hintze Nov 30 '17 at 21:16
• @Dr. Wolfgang Hintze Well I admit that I am using Mathematica however I use it only to get a hint of how the result might look like and then to understand how the result was actually derived. Most of the integrals can be easily done using just integration by parts however there are certain cases where it is not possible to do and one only obtains some sort of functional relation for the quantity to be sought for. Indeed out of the different terms that I integrated only $\int \log(1-x)^3 \log(x)/x dx$ leads to nontrivial results. – Przemo Dec 1 '17 at 18:38
• @ Przemo I have typed in your expression and find that the Expansion about x=0 contains a Log term. Hence it is not correct. I suggest that you provide the mathematica code for easy check. This time I'll put it into a solution. You can review it and correct it if necessary. – Dr. Wolfgang Hintze Dec 2 '17 at 20:11
• @Dr. Wolfgang Hintze Please see my answer below. – Przemo Dec 4 '17 at 14:18
• @ Przemo Congratulation to your correct expression for $S_{1,4}$ ! You have pushed the frontier ahead ! Please provide also the Mathematica expressions for the resolution of the integrals $D$ and $S$ into terms of $Hs$. By the way: which values do you obtain for $x=-1/2$ and in the limit $x\to-1$ – Dr. Wolfgang Hintze Dec 4 '17 at 16:29

This is an answer to Dr. Wolfgang Hintze's comment above. First of all thank you for your interest in this question:). Secondly the way I derive the various expressions is error proof since, before I make any change, I always test whether the right hand side equals the left hand side for some randomly chosen parameters (in this case for the parameter $x$). Therefore I am usually pretty confident that my expressions are correct. Yet, having said that, I admit that I haven't done the series expansion which you did before. I did it now and the results are below:

x =.; Clear[h4]; Clear[S22]; Clear[D22];
S22[x_] := Integrate[PolyLog[2, t]^2/t, {t, 0, x}];
D22[x_] := Integrate[Log[t]^2 PolyLog[2, t]/(1 - t), {t, 0, x}];
h4[x_] := -PolyLog[5, 1 - x] + PolyLog[5, (-1 + x)/x] +
2 PolyLog[5, x] +
-(1/2) Log[1 - x]^2 PolyLog[3, x] -
1/3 (\[Pi]^2 + 3 Log[1 - x]^2 - 3 Log[1 - x] Log[x]) PolyLog[3,
1 - x] +
-(1/4) Log[1 - x] PolyLog[2, x]^2 +
1/12 Log[1 - x] (\[Pi]^2 - 9 Log[1 - x] Log[x]) PolyLog[2, x] +
Log[1 - x] PolyLog[4, 1 - x] - Log[1 - x] PolyLog[4, (-1 + x)/x] -
Log[x] PolyLog[4, 1 - x] + 1/2 Log[1 - x]^2 Zeta[3] +
1/20 Log[1 - x]^5 - Log[x]^5/120 - 1/4 Log[1 - x]^4 Log[x] +
1/18 \[Pi]^2 Log[1 - x]^3 - 1/36 \[Pi]^2 Log[x]^3 +
1/24 \[Pi]^2 Log[1 - x]^2 Log[x] - 1/4 Log[1 - x]^3 Log[x]^2 +
1/12 Log[1 - x]^2 Log[x]^3 + 1/48 \[Pi]^4 Log[1 - x] -
1/120 \[Pi]^4 Log[x] + 1/3 \[Pi]^2 Zeta[3] + Zeta[5] -
S22[x] + S22[x/(x - 1)] +
-5/4 (S22[1] - S22[1 - x]) +
1/4 (D22[1] - D22[1 - x]);
Simplify[Normal[Series[h4[x], {x, 0, 3}]], Assumptions -> 0 < x < 1]


This gives us after two minutes of Mathematica's "thinking the following output:

x + (3 x^2)/32 + (11 x^3)/486


Now, from my experience with Mathematica it follows that the code is sometimes prone to some redundant trailing characters. It happens at times that if you break a line some special character is inserted which may scramble the result. Therefore I always make sure that there are no unnecessary line breaks in a long code.

• @ Przemo Your recent expression correct. I have checked (as you did) the expasion but as well the numeric values at x=1/2 whch is 0.526931... It was, as you suggested indeed an unnoted line break. i.e. a typing error on my side, which made the difference. As I said before, it is generally a good idea tp provide long expressions in a formalized system like Mathematica, instead of simple text. – Dr. Wolfgang Hintze Dec 4 '17 at 15:38

You probably know this already, but in case you don't, here we go. ${\bf H}^{(3)}_2 (x)$ satisfies your requirement of $p + q \geqslant 5$ and is very easy to find.

From $${\bf H}^{(3)}_1 (x) = \sum^\infty_{n = 1} \frac{H^{(3)}_n}{n} x^n = \text{Li}_4 (x) - \text{Li}_3 (x) \ln (1 - x) - \frac{1}{2} \text{Li}^2_2 (x),$$ dividing throughout by $x$ before integrating from $0$ to $x$ gives \begin{align*} {\bf H}^{(3)}_2 (x) &= \text{Li}_5 (x) - \int^x_0 \frac{\text{Li}_3 (u) \ln (1 - u)}{u} \, du - \frac{1}{2} \int^x_0 \frac{\text{Li}_2^2 (u)}{u} \, du. \end{align*} As $$\int^x_0 \frac{\text{Li}_3 (u) \ln (1 - u)}{u} \, du = - \text{Li}_2 (x) \text{Li}_3 (x) + \int^x_0 \frac{\text{Li}^2_2 (u)}{u} \, du,$$ a result which can be readily found by parts, we have $${\bf H}^{(3)}_2 (x) = \text{Li}_5 (x) + \text{Li}_2 (x) \text{Li}_3 (x) - \frac{3}{2} \mathcal{S}^{(2)}_2 (x),$$ where, in your notation, $$\mathcal{S}^{(2)}_2 (x) = \int^x_0 \frac{\text{Li}^2_2 (u)}{u} \, du.$$ Of course, as you point out, since $${\mathcal S}^{(2)}_2(x) = \int\limits_0^x \frac{\text{Li}^2_2(u)}{u} du = 2 \left( {\bf H}^{(2)}_3(x) - \text{Li}_5(x) \right) + 4 \left( {\bf H}^{(1)}_4(x) - \text{Li}_5(x) \right),$$ this makes $\mathcal{S}^{(2)}_2 (x)$ a really troublesome term to have to deal with.

This is not an answer but just your expression for ${\bf H}^{(1)}_4(x)$ typed in in Mathematica in order to check it.

If it contains typing errors then please correct it.

EDIT 4.12.17

It did indeed contain a typing error (spurious line break). The correct expression was provided by Przemo in his answer of today.

This is not an answer to this question but, as I believe, it is a step towards it. Again, let $p\ge 1$ and $q\ge 1$ be integers and $x\in (-1,1)$. Then the following identity holds: \begin{eqnarray} &&{\bf H}^{(p)}_q(x)=\\ &&Li_p(x) Li_q(x) + Li_{p+q}(x) + \\ &&\sum\limits_{j=1}^{p-1} (-1)^j \binom{q+j-1}{j} Li_{q+j}(x) Li_{p-j}(x)+\\ &&(-1)^p\sum\limits_{j=p}^{q+p-1} \binom{j-1}{p-1} Li_{q-j+p}(x) Li_j(x)+\\ &&\sum\limits_{j_2=0}^{q-1} [\log(x)]^{j_2} \cdot \sum\limits_{j=p}^{(q+p-1-j_2)} \sum\limits_{j_1=1}^{(q+p-j-j_2)} \frac{(-1)^{q+1-j-j_1-j_2}}{(j_2)!(q+p-j-j_1-j_2)!} \binom{j-1}{p-1} \cdot \\ &&\int\limits_0^x [\log(t)]^{q+p-j-j_1-j_2} \cdot \frac{Li_{j_1}(t) Li_{j-1}(t)}{t} dt \end{eqnarray} I have derived this identity using integration by parts. Below is a piece of Mathematica's code that verifies it:

M = 1000;
x = RandomReal[{-1, 1}, WorkingPrecision -> 50];
AA = Map[N[Take[Accumulate[#], -5], 30] &,
Table[HarmonicNumber[n, p] x^n/n^q, {p, 1, 5}, {q, 1, 5}, {n, 1,
M}], {2}];
AA1 = Table[
PolyLog[q, x] PolyLog[p, x] +  PolyLog[q + p, x] +
Sum[(-1)^j Binomial[q + j - 1, j] PolyLog[p - j, x] PolyLog[q + j,
x], {j, 1, p - 1}] + (-1)^p Sum[
Binomial[j - 1, p - 1] PolyLog[q - j + p, x] PolyLog[j, x], {j,
p, q + p - 1}] +
Sum[ Log[x]^j2 ((-1)^(
q + 1 - j - j2 + j1)) /((j2)! (q + p - j - j2 - j1)!)
Binomial[j - 1, p - 1] NIntegrate[
Log[t]^(q + p - j - j1 - j2) (
PolyLog[j1, t] PolyLog[j - 1, t])/t , {t, 0, x},
WorkingPrecision :> 30], {j2, 0, q - 1}, {j, p,
q + p - 1 - j2}, {j1, 1, q + p - j - j2}], {p, 1, 5}, {q, 1,
5}];
MatrixForm[#] & /@ {AA1, AA[[All, All, -1]] - AA1}


After running it we are getting a following output:

Now let us take $p=1$ and $q=4$. Then we have: $${\bf H}^{(1)}_4(x)= -2 Li_2(x) Li_3(x)+ \log(1-x) Li_4(x) + Li_5(x) + \sum\limits_{j_2=0}^3 [\log(x)]^{j_2} {\mathcal s}_{4-j_2}$$ where \begin{eqnarray} {\mathcal s}_1&=&\frac{1}{12} \log(1-x)^2\\ {\mathcal s}_2&=&\frac{1}{12} \left(-6 \text{Li}_3(1-x)-12 \text{Li}_2(x) \log (1-x)-6 \log (x) \log ^2(1-x)+\pi ^2 \log (1-x)+6 \zeta (3)\right)\\ {\mathcal s}_3&=&\text{Li}_2(x){}^2-\text{Li}_4(1-x)+\text{Li}_4(x)+\text{Li}_4\left(\frac{x}{x-1}\right)+2 \text{Li}_2(x) \log (x) \log (1-x)-2 \text{Li}_3(x) \log (1-x)+\text{Li}_3(1-x) \log (x)+\zeta (3) \log (1-x)-\zeta (3) \log (x)+\frac{1}{24} \log ^4(1-x)-\frac{1}{6} \log (x) \log ^3(1-x)+\frac{3}{4} \log ^2(x) \log ^2(1-x)+\frac{1}{12} \pi ^2 \log ^2(1-x)-\frac{1}{6} \pi ^2 \log (x) \log (1-x)+\frac{\pi ^4}{90}\\ {\mathcal s}_4&=&-\frac{1}{12} \log (1-x) \left(12 \text{Li}_4(x)-12 \text{Li}_3(x) \log (x)+\log (1-x) \log ^3(x)\right)+\text{Li}_2(x) \left(2 \text{Li}_3(x)-\frac{3}{4} \log (1-x) \log ^2(x)\right)-\frac{5}{4} \text{Li}_2(x){}^2 \log (x)+\frac{1}{4}\left( {\mathcal S}^{(2)}_2(x) - {\mathcal D}^{(2)}_2(x)\right) \end{eqnarray} Below is the Mathematica code that verifies the expression above:

x =.; t =.;
S22[x_] := Integrate[ PolyLog[2, t]^2/t, {t, 0, x}];
D22[x_] := Integrate[(Log[t]^2 PolyLog[2, t])/ (1 - t), {t, 0, x}];
ss := {1/12 Log[1 - x]^2,
1/12 (\[Pi]^2 Log[1 - x] - 6 Log[1 - x]^2 Log[x] -
12 Log[1 - x] PolyLog[2, x] - 6 PolyLog[3, 1 - x] +
6 Zeta[3]), \[Pi]^4/90 + 1/12 \[Pi]^2 Log[1 - x]^2 +
1/24 Log[1 - x]^4 - 1/6 \[Pi]^2 Log[1 - x] Log[x] -
1/6 Log[1 - x]^3 Log[x] + 3/4 Log[1 - x]^2 Log[x]^2 +
2 Log[1 - x] Log[x] PolyLog[2, x] + PolyLog[2, x]^2 +
Log[x] PolyLog[3, 1 - x] - 2 Log[1 - x] PolyLog[3, x] -
PolyLog[4, 1 - x] + PolyLog[4, x] + PolyLog[4, x/(-1 + x)] +
Log[1 - x] Zeta[3] - Log[x] Zeta[3],
-(5/4) Log[x] PolyLog[2, x]^2 +
PolyLog[2, x] (-(3/4) Log[1 - x] Log[x]^2 + 2 PolyLog[3, x]) -
1/12 Log[
1 - x] (Log[1 - x] Log[x]^3 - 12 Log[x] PolyLog[3, x] +
12 PolyLog[4, x]) + 1/4 (-D22[x] + S22[x])};

{p, q} = {1, 4};
{t0, dummy} = Timing[Simplify[Normal[Series[
-2 PolyLog[2, x] PolyLog[3, x] + Log[1 - x] PolyLog[4, x] +
PolyLog[5, x] +
Total[Table[Log[x]^j2 ss[[4 - j2]], {j2, 0, q - 1}]], {x, 0,
3}]], Assumptions -> -1 < x < 1]]


If you run that code after about 105 seconds Mathematica 9.0 produces the following result:

as it should be. Likewise let us take $p=2$ and $q=3$ then we have: $${\bf H}^{(2)}_3(x) = 4 Li_2(x) Li_3(x) +Li_5(x) + \sum\limits_{j_2=0}^2 [\log(x)]^{j_2} {\mathcal s}_{3-j_2}$$ where \begin{eqnarray} {\mathcal s}_1 &=& \text{Li}_3(1-x)-\text{Li}_2(1-x) \log (1-x)-\frac{1}{2} \log (x) \log ^2(1-x)-\zeta (3)\\ {\mathcal s}_2 &=& -\frac{3 \text{Li}_2(x){}^2}{2}+2 \text{Li}_4(1-x)-2 \text{Li}_4(x)-2 \text{Li}_4\left(\frac{x}{x-1}\right)-2 \text{Li}_2(x) \log (x) \log (1-x)+2 \text{Li}_3(x) \log (1-x)-2 \text{Li}_3(1-x) \log (x)-2 \zeta (3) \log (1-x)+2 \zeta (3) \log (x)-\frac{1}{12} \log ^4(1-x)+\frac{1}{3} \log (x) \log ^3(1-x)-\log ^2(x) \log ^2(1-x)-\frac{1}{6} \pi ^2 \log ^2(1-x)+\frac{1}{3} \pi ^2 \log (x) \log (1-x)-\frac{\pi ^4}{45}\\ {\mathcal s}_3 &=& \frac{1}{2} \text{Li}_2(x) \left(-8 \text{Li}_3(x)+4 \text{Li}_2(x) \log (x)+\log (1-x) \log ^2(x)\right)+ \frac{1}{2} {\mathcal D}^{(2)}_2(x) \end{eqnarray} Again , below is the Mathematica code that verifies that:

{p, q} = {2, 3}; x =.; t =.;
D22[x_] := Integrate[(Log[t]^2 PolyLog[2, t])/ (1 - t), {t, 0, x}];
ss := {-(1/2) Log[1 - x]^2 Log[x] - Log[1 - x] PolyLog[2, 1 - x] +
PolyLog[3, 1 - x] - Zeta[3], -(\[Pi]^4/45) -
1/6 \[Pi]^2 Log[1 - x]^2 - 1/12 Log[1 - x]^4 +
1/3 \[Pi]^2 Log[1 - x] Log[x] + 1/3 Log[1 - x]^3 Log[x] -
Log[1 - x]^2 Log[x]^2 - 2 Log[1 - x] Log[x] PolyLog[2, x] -
3/2 PolyLog[2, x]^2 - 2 Log[x] PolyLog[3, 1 - x] +
2 Log[1 - x] PolyLog[3, x] + 2 PolyLog[4, 1 - x] -
2 PolyLog[4, x] - 2 PolyLog[4, x/(-1 + x)] -
2 Log[1 - x] Zeta[3] + 2 Log[x] Zeta[3],
1/2 PolyLog[2,
x] (Log[1 - x] Log[x]^2 + 4 Log[x] PolyLog[2, x] -
8 PolyLog[3, x]) + 1/2 D22[x]};
{t0, dummy} =
Timing[Simplify[
Normal[Series[
4 PolyLog[2, x] PolyLog[3, x] + PolyLog[5, x] +
Total[Table[Log[x]^j2 ss[[3 - j2]], {j2, 0, q - 1}]], {x, 0,
10}]], Assumptions -> 0 < x < 1]]


The output being:

Now let us take $p=3$ and $q=2$. Then we have: $${\bf H}^{(3)}_2(x) = -2 Li_2(x) Li_3(x)+Li_5(x) + \sum\limits_{j_2=0}^1 [\log(x)]^{j_2} {\mathcal s}_{2-j_2}$$ where \begin{eqnarray} {\mathcal s}_1 &=& \frac{1}{2} [Li_2(x)]^2 \\ {\mathcal s}_2 &=& -\frac{1}{2} \log(x) Li_2(x)^2 + 3 Li_2(x) Li_3(x) - \frac{3}{2} {\mathcal S}^{(2)}_2(x) \end{eqnarray} The code that verifies this along with its output are below:

{p, q} = {3, 2}; x =.; t =.;
S22[x_] := Integrate[ PolyLog[2, t]^2/t, {t, 0, x}];
ss := {1/2 PolyLog[2, x]^2, -1/2 Log[x] PolyLog[2, x]^2  +
3 PolyLog[2, x] PolyLog[3, x] - 3/2 S22[x]};
{t0, dummy} =
Timing[Simplify[
Normal[Series[-2 PolyLog[2, x] PolyLog[3, x] + PolyLog[5, x] +
Total[Table[Log[x]^j2 ss[[2 - j2]], {j2, 0, q - 1}]], {x, 0,
10}]], Assumptions -> 0 < x < 1]]


Finally let us take $p=4$ and $q=1$. Then we have: $${\bf H}^{(4)}_1(x) = -\log(1-x) Li_4(x) + Li_5(x) + \sum\limits_{j_2=0}^0 [\log(x)]^{j_2} {\mathcal s}_{1-j_2}$$ where \begin{eqnarray} {\mathcal s}_1 &=& -Li_2(x) Li_3(x) + {\mathcal S}^{(2)}_2(x) \end{eqnarray} with the code and its output given below:

{p, q} = {4, 1}; x =.; t =.;
S22[x_] := Integrate[ PolyLog[2, t]^2/t, {t, 0, x}];
ss := {-PolyLog[2, x] PolyLog[3, x] + S22[x]}

{t0, dummy} =
Timing[Simplify[
Normal[Series[-Log[1 - x] PolyLog[4, x] + PolyLog[5, x] +
Total[Table[Log[x]^j2 ss[[1 - j2]], {j2, 0, q - 1}]], {x, 0,
10}]], Assumptions -> 0 < x < 1]]


The overall conclusion from this exercise is that whenever $p+q\ge 5$ the generating functions in question cannot be reduced to poly-logarithms only. If $p+q=5$ then the additional quantities that enter are ${\mathcal S}^{(2)}_2(x)$ and ${\mathcal D}^{(2)}_2(x)$ which themselves are independent from each other and also cannot be reduced to other generating functions.