# Integral $\int_0^{\pi/2} \log^n (\sin t)\log^p (\cos t) dt$

I am looking for a closed form expression for the logarithmic trigonometric integral $$I_{n,p}=\int_0^{\pi/2} \log^n (\sin t)\log^p (\cos t) dt \quad (n\geq 0, p\geq 0).$$ Closed form expression does exist except I cannot seem to find it when looking through my collection. This integral comes from this paper which was quite a big hit in the early 80's. There are many other excellent integrals you can find in here! I am not sure how to approach this integral due to the powers of $n,p$.

Thanks

• This is directly related to the polygamma function, since we are dealing with derivatives of the beta function. – Lucian Apr 16 '14 at 20:28
• There is a closed form in this paper by the same author, which is reference 5 in the paper you linked to in the question. – Kirill Apr 16 '14 at 20:36
• @Kirill I saw that but have had a hard time getting the whole paper still. If you can get it, please post it – Jeff Faraci Apr 16 '14 at 20:47

## 1 Answer

The closed form is given in this paper by the same author. I'll transcribe it in this answer, I'm not sure I how to post the pdf directly in this answer.

Define $$r_{np} = \int_0^{\pi/2}(\log\cos x)^n (\log\sin x)^p\,dx$$ (I will use that paper's notation; you have $n$ and $p$ the other way around).

Then $$r_{np} = \frac{\pi n! p!}{2^{n+p+1}} \sum_{k=1}^{n+p}\frac1{k!} \sum_{\{p_i\}}\sum_{\{n_i\}}\prod_{i=1}^{k}f(p_i,n_i),$$ where the inner sums over $\{p_i\}$ and $\{n_i\}$ are defined as sums over indices $p_1,\ldots,p_k$ with $\sum_i p_i = p$, and over $n_1,\ldots,n_k$ with $\sum n_i = n$. They are sums over ordered integer partitions of size $k$, allowing the partitions to include zeros. $f$ is defined below.

The inner double sum $\sum_{\{p_i\}}\sum_{\{n_i\}}\prod_i f(p_i,n_i)$, the author points out can be written as $$\sum_{\{p\},\{n\}} \frac{k!}{l_0!l_1!\cdots l_p! m_0!m_1!\cdots m_n!}\sum_{\psi\in S_k}\prod_{1\leq i\leq k}f(p_i, n_{\psi(i)}),$$ where $\psi$ runs over permutations of $\{1,\ldots,k\}$, the sum being some kind of permanent of a matrix with elements $f$. Here the sum now runs over distinct unordered integer partitions of $p$ and $n$ of length $k$, including zeros, and $l$'s and $m$'s are defined by saying that $p$ consists of $l_i$ copies of $i$, $0\leq i\leq p$, and $n$ consists of $m_i$ copies of $i$, $0\leq i\leq n$.

Finally, $$f(p,n) = [p\neq0,n\neq0]\frac{(-1)^{p+n-1}}{p+n}\binom{p+n}{p}\zeta(p+n) + [[p=0]\neq[n=0]]\xi(p+n),$$ $$\xi(q) = -2\log2, \quad (q=1), \qquad \xi(q) = (-1)^q\frac{2^q-2}{q}\zeta(q), \quad(q>1).$$ I used Iverson bracket notation, $[p]$ is $1$ is $p$ is true, $0$ otherwise.

Here is a Mathematica implementation I wrote to make sure I got the notation and conventions actually right:

partdecomp[partition_, n_] := Table[Count[partition, k], {k, 1, n}]
f[p_, n_] :=
If[p != 0 && n != 0, (-1)^(p + n - 1)/(p + n)
Binomial[p + n, p] Zeta[p + n], 0] +
If[Boole[0 == p] != Boole[0 == n], xi[p + n], 0]
xi[q_] := If[q == 1, -2 Log, (-1)^q*(2^q - 2)/q Zeta[q]]
r2[n_, p_] := (\[Pi] n! p!)/2^(n + p + 1) Sum[
1/k! Module[{l = partdecomp[pp, p], m = partdecomp[nn, n]},
(k!)/(Product[l[[i]]!, {i, 1, p}] Product[
m[[i]]!, {i, 1, n}] (k - Total[l])! (k - Total[m])!)
Sum[
Product[f[pp[[i]], nn[[ni[[i]]]]], {i, 1, k}]
, {ni, Permutations[Range[k]]}]
]
, {k, 1, n + p}
, {pp, Map[PadLeft[#, k] &, IntegerPartitions[p, k]]}
, {nn, Map[PadLeft[#, k] &, IntegerPartitions[n, k]]}]