Integrate $\int_{0}^{\pi/2} \ln(p + q \cos^2x)\,dx$ Integrate $$\int_{0}^{\pi/2} \ln(p + q  \cos^2x)dx,$$
where $p > 0, q \geq 0$
What I tried already
This task seems to be about parameter derivation. I tried both to differentiate by $p$ or by $q$. By $q$ it seems more logical - because $q\geq 0$, it would be easy to find constant when $q = 0.$ After derivation I get a pretty stange integral, which I sometimes with plenty of mistakes manage to count, but it becomes almost impossible to integrate it after.
2. I tried to use that when $x = 0$  to $\pi/2d$,
$$I = \int_{0}^{\pi/2} \ln(p + q \cos^2x)dx = \int_{0}^{\pi/2} \ln(p + q \sin^2x)dx,$$
which implies
$$\begin{align}
I &= \frac{1}{2}(I + I) \\
&= \frac{1}{2}\int_{0}^{\pi/2} (\ln(p + q \cos^2x) + \ln(p + q \sin^2x)) dx \\
&= \frac{1}{2} \int_{0}^{\pi/2} \ln((p + q \cos^2x)(p + q \sin^2x))dx \\
&= \frac{1}{2} \int_{0}^{\pi/2} \ln(p^2 + pq + q^2 \frac{\sin^22x}{4})dx\|
& = \frac{1}{2} \int_{0}^{\pi} \ln(p^2 + pq + q^2 \frac{\sin^2x}{4})dx
\end{align}$$
This almost gives nothing, I tried to count the last integral also by derivation, but got nothing. Maybe problem is wrong, but I don't think so.
Thanks for the help)
 A: Please consider this post as a some development of the solution provided by @FShrike. It's a bit longue for a comment.
$$I(p,q)=\int_0^{\pi/2}\ln(p+q\cdot\cos^2x)d x$$
$$\frac{\partial}{\partial p}I(p,q)=I'_p(p,q)=\int_0^{\pi/2}\frac{1}{p+q\cos^2x}d x$$
Using the substitution $t=\tan x$
$$I'_p(p,q)=\int_0^\infty\frac{dt}{p+q+pt^2}=\frac{1}{p+q}\int_0^\infty\frac{dt}{1+\frac{p}{p+q}t^2}=\frac{\pi}{2}\frac{1}{\sqrt p\sqrt{p+q}}$$
$$I(p,q)=\frac{\pi}{2}\int^p\frac{ds}{\sqrt s\sqrt{s+q}}+f(q)=\frac{\pi}{2}\int^\frac{p}{q}\frac{dt}{\sqrt t\sqrt{t+1}}+f(q)=\pi\int^\sqrt{\frac{p}{q}}\frac{dx}{\sqrt{x^2+1}}+f(q)$$
$$I(p,q)=\pi\ln\Big(\sqrt\frac{p}{q}+\sqrt{\frac{p}{q}+1}\,\Big)+f(q)$$
At $p=0$
$$I(o,q)=\int_0^{\pi/2}\ln(q\cos^2x)d x=\frac{\pi}{2}\ln q+2\int_0^{\pi/2}\ln(\cos x)d x=\frac{\pi}{2}\ln q-\pi\ln 2=f(q)$$
Finally,
$$I(p,q)=\pi\ln\Big(\sqrt\frac{p}{q}+\sqrt{\frac{p}{q}+1}\,\Big)+\frac{\pi}{2}\ln q-\pi\ln 2=\pi\ln\frac{\sqrt p+\sqrt{p+q}}{2}$$
A: With $t=2x$
$$
I=\int_{0}^{\pi/2} \ln(p + q  \cos^2x)dx
=\frac12\int^{\pi}_{0} \ln[a(1+2r\cos t +r^2)] dt$$
where $a=\frac14\left(\sqrt p+\sqrt{p+q}\right)^2$
and $r = \frac q{4a}$.
Then, utilize the result $\int^{\pi}_{0}
{\ln(1+r^2 +2r\cos t)}dt=0$ to obtain
$$
I
=\frac\pi2\ln a
=\pi\ln\frac{\sqrt p+\sqrt{p+q}}2$$
A: $\newcommand{\d}{\,\mathrm{d}}\newcommand{\arcosh}{\operatorname{arcosh}}$A different approach based on J.G's comment:
$$I(p):=\int_0^{\pi/2}\ln(p+q\cdot\cos^2x)\d x\overset{t=\tan x}{=}\underset{J(p)}{\underbrace{\int_0^\infty\frac{\ln(p(1+t^2)+q)}{1+t^2}\d t}}-\underset{\pi\ln2}{\underbrace{\int_0^\infty\frac{\ln(1+t^2)}{1+t^2}\d t}}$$
About why the latter integral is $\pi\ln2$.
Differentiate $J$ w.r.t $p$:
$$J'(p)=\frac{1}{x}\int_0^\infty\frac{1}{t^2+\frac{p+q}{p}}\d t=\frac{1}{p\sqrt{\frac{p+q}{p}}}\int_0^\infty\frac{1}{t^2+1}\d t=\frac{\pi}{2}\cdot\frac{1}{\sqrt{p^2+pq}}$$
So that:
$$\begin{align}J(p)&=\frac{\pi}{2}\int_0^p\frac{1}{\sqrt{x^2+qx}}\d x+C\\&=\frac{\pi}{2}\int_0^p\frac{1}{\sqrt{(x+q/2)^2-q^2/4}}\d x+C\\&=\frac{\pi}{q}\int_0^p\frac{1}{\sqrt{\left(\frac{2}{q}x+1\right)^2-1}}\d x+C\\&=\frac{\pi}{2}\int_1^{\frac{2}{q}p+1}\frac{1}{\sqrt{x^2-1}}\d x+C\\&=\frac{\pi}{2}\arcosh\left(\frac{2}{q}p+1\right)+C\end{align}$$
We have:
$$C=J(0)=\int_0^\infty\frac{\ln q}{1+t^2}\d t=\frac{\pi}{2}\ln q$$
Putting it all together:
$$I(p)=J(p)-\pi\ln2=\frac{\pi}{2}\cdot\left(\ln q-2\ln2+\arcosh\left(\frac{2}{q}p+1\right)\right)$$
N.B. If the results concerning the $\pi\ln2$ integral are too complicated I expect you can solve the integral without subtracting out $\ln(1+t^2)$, it'd just be more tedious I think.
