$$ I=\int_0^\pi \dfrac{dx}{a+\cos^2{x}} $$
広義積分の場合は雑魚問題です。
$$
I=\int_0^\pi \frac{dx}{a+\cos^2{x}}
$$
$y=x-\dfrac{\pi}{2}$とおく。
$$
=\int_{-\frac{\pi}{2}}^\frac{\pi}{2} \frac{dy}{a+\sin^2{y}}
$$
$$
=2\int_0^\frac{\pi}{2} \frac{dy}{a+\sin^2{y}}
$$
$t=\tan{y}$とおく。
$$
\dfrac{I}{2}=\int_0^{\infty} \frac{1}{a+\frac{y^2}{1+y^2}}\cdot\frac{1}{1+y^2} dy
$$
$$
=\int_0^{\infty} \frac{dy}{(a+1)y^2+a}
$$
$$
=\frac{1}{a} \int_0^{\infty} \dfrac{dy}{\big( \frac{\sqrt{a^2+a}}{a}y\big)^2+1}
$$
$$
=\frac{1}{a}\cdot\frac{a}{\sqrt{a^2+a}}\bigg[\tan^{-1}{\frac{\sqrt{a^2+a}}{a}y} \bigg]_0^{\infty}
$$
$$ \dfrac{I}{2}=\frac{1}{a}\cdot\frac{a}{\sqrt{a^2+a}}\cdot\dfrac{\pi}{2}=\frac{\pi}{2\sqrt{a^2+a}} $$
$$ \dfrac{I}{2}=\frac{1}{a}\cdot\frac{a}{\sqrt{a^2+a}}\cdot\bigg(-\dfrac{\pi}{2}\bigg)=-\frac{\pi}{2\sqrt{a^2+a}} $$
$(i),\ (ii)$より
$$ \therefore I=\frac{\abs{a}\pi}{a\sqrt{a^2+a}} =\frac{\pi\ \rm{sgn}{\textit{a}}}{\sqrt{a^2+a}} $$
$$ I=\int_0^\pi \frac{dx}{a+\cos^2{x}} $$
対称性より
$$ \dfrac{I}{2}=\int_0^\frac{\pi}{2} \frac{dx}{a+\cos^2{x}} $$
$$
\dfrac{I}{2}=\int_0^\frac{\pi}{2} \frac{dx}{a+1-\sin^2{x}}
$$
$$
I\sqrt{a+1}=\int_0^\frac{\pi}{2} \frac{1}{\sqrt{a+1}-\sin{x}}+\frac{1}{\sqrt{a+1}+\sin{x}}dx
$$
$t=\tan{\dfrac{x}{2}}$とおく。
$$
I\sqrt{a+1}=\int_0^1 \bigg(\frac{1}{\sqrt{a+1}-\frac{2t}{1+t^2}}+\frac{1}{\sqrt{a+1}+\frac{2t}{1+t^2}}\bigg)\cdot\dfrac{2}{1+t^2}dt
$$
$$
\dfrac{\sqrt{a+1}}{2}I=\int_0^1 \frac{1}{(1+t^2)\sqrt{a+1}-2t}+\frac{1}{(1+t^2)\sqrt{a+1}+2t}dt
$$
$$
\dfrac{a+1}{2}I=\int_0^1 \frac{1}{\big(t-\frac{1}{\sqrt{a+1}}\big)^2+\frac{a}{1+a}}+\frac{1}{\big(t+\frac{1}{\sqrt{a+1}}\big)^2+\frac{a}{1+a}}dt
$$
$$
=\dfrac{a+1}{a}\int_0^1 \frac{1}{\big(\frac{\sqrt{a^2+a}}{a} t-\frac{1}{\sqrt{a}}\big)^2+1}+\frac{1}{\big(\frac{\sqrt{a^2+a}}{a}t+\frac{1}{\sqrt{a}}\big)^2+1}dt
$$
$$
\dfrac{a}{2}I=\cfrac{a}{\sqrt{a^2+a}}\bigg[\tan^{-1}\bigg( \frac{\sqrt{a^2+a}}{a} t-\dfrac{1}{\sqrt{a}} \bigg)+\tan^{-1}\bigg( \frac{\sqrt{a^2+a}}{a} t+\dfrac{1}{\sqrt{a}} \bigg) \bigg]_0^1
$$
$$
\dfrac{\sqrt{a^2+a}}{2} I=\bigg\{\tan^{-1}\bigg( \frac{\sqrt{a^2+a}-\sqrt{a}}{a} \bigg)+\tan^{-1}\bigg( \frac{\sqrt{a^2+a}+\sqrt{a}}{a} \bigg) \bigg\}
-\bigg\{\tan^{-1}\bigg( -\dfrac{1}{\sqrt{a}} \bigg)+\tan^{-1}\bigg( \dfrac{1}{\sqrt{a}} \bigg) \bigg\}
$$
$\bigg( \dfrac{\sqrt{a^2+a}-\sqrt{a}}{a} \bigg)\bigg( \dfrac{\sqrt{a^2+a}+\sqrt{a}}{a} \bigg)=1$より
$\tan^{-1}\bigg( \dfrac{\sqrt{a^2+a}-\sqrt{a}}{a} \bigg)+\tan^{-1}\bigg( \dfrac{\sqrt{a^2+a}+\sqrt{a}}{a} \bigg)=\dfrac{\pi}{2}$
また
$\tan^{-1}\bigg( -\dfrac{1}{\sqrt{a}} \bigg)+\tan^{-1}\bigg( \dfrac{1}{\sqrt{a}} \bigg)=0$より
$$
\dfrac{\sqrt{a^2+a}}{2} I=\dfrac{\pi}{2}
$$
$$
\therefore I=\frac{\pi}{\sqrt{a^2+a}}
$$
$$
\dfrac{I}{2}=\int_0^\frac{\pi}{2} \frac{dx}{a+\cos^2{x}}
$$
$$
=-\dfrac{1}{2\sqrt{-a}}\int_0^\frac{\pi}{2} \frac{1}{\sqrt{-a}-\cos{x}}+\frac{1}{\sqrt{-a}+\cos{x}} dx
$$
$t=\tan{\dfrac{x}{2}}$とおく。
$$
-I\sqrt{-a}=\int_0^1 \bigg(\frac{1}{\sqrt{-a}-\frac{1-t^2}{1+t^2}}+\frac{1}{\sqrt{-a}+\frac{1-t^2}{1+t^2}}\bigg)\cdot\dfrac{2}{1+t^2} dt
$$
$$
-\dfrac{\sqrt{-a}}{2}I=\int_0^1 \frac{1}{(\sqrt{-a}+1)t^2+\sqrt{-a}-1}+\frac{1}{(\sqrt{-a}-1)t^2+\sqrt{-a}+1}dt
$$
$$
=\int_0^1 \dfrac{1}{\sqrt{-a}-1}\cdot\frac{1}{\frac{\sqrt{-a}+1}{\sqrt{-a}-1}t^2+1}+\dfrac{1}{\sqrt{-a}+1}\cdot\frac{1}{\frac{\sqrt{-a}-1}{\sqrt{-a}+1}t^2+1}dt
$$
$$
=\bigg[\dfrac{1}{\sqrt{-a}-1}\cdot\sqrt{\dfrac{\sqrt{-a}-1}{\sqrt{-a}+1}}\cdot\tan^{-1}\bigg( t\ \sqrt{\dfrac{\sqrt{-a}+1}{\sqrt{-a}-1}} \bigg)
+\dfrac{1}{\sqrt{-a}+1}\cdot\sqrt{\dfrac{\sqrt{-a}+1}{\sqrt{-a}-1}}\cdot\tan^{-1}\bigg( t\ \sqrt{\dfrac{\sqrt{-a}-1}{\sqrt{-a}+1}}\bigg)\bigg]_0^1
$$
$$
=\bigg[\dfrac{1}{\sqrt{-a-1}}\bigg(\tan^{-1}\bigg( t\ \sqrt{\dfrac{\sqrt{-a}+1}{\sqrt{-a}-1}} \bigg)
+\tan^{-1}\bigg( t\ \sqrt{\dfrac{\sqrt{-a}-1}{\sqrt{-a}+1}}\bigg)\bigg)\bigg]_0^1
$$
$$
=\dfrac{1}{\sqrt{-a-1}}\bigg(\tan^{-1}\sqrt{\dfrac{\sqrt{-a}+1}{\sqrt{-a}-1}}
+\tan^{-1}\sqrt{\dfrac{\sqrt{-a}-1}{\sqrt{-a}+1}}\bigg)
$$
$\bigg(\ \sqrt{\dfrac{\sqrt{-a}+1}{\sqrt{-a}-1}} \bigg)\bigg(\ \sqrt{\dfrac{\sqrt{-a}-1}{\sqrt{-a}+1}} \bigg)=1$より
$$
-\dfrac{\sqrt{-a}}{2}I=\dfrac{\pi}{2\sqrt{-a-1}}
$$
$$
\therefore I=-\dfrac{\pi}{\sqrt{a^2+a}}
$$
$(i),\ (ii)$より
$$ \therefore I=\frac{\abs{a}\pi}{a\sqrt{a^2+a}} =\frac{\pi\ \rm{sgn}{\textit{a}}}{\sqrt{a^2+a}} $$
$$ J=\int_0^{\pi} \dfrac{\sin{x}}{2+\sqrt{3+\sin{2x}}}\ dx $$
積分ガチャ超級に応募しなかった例の問題をそのまま出したところ、友人に想定してない方法で解かれまして、これならズルできまいと作った問題です。解き方は例の問題と一緒ですので、途中は省略して解答は以下の通りです。
$$ J=\dfrac{\pi}{6}-2+\sqrt{3}+\log( 1+\sqrt{3})-\dfrac{1}{2} \log{2}-\sqrt{2}\log{(\sqrt{2}-1)(\sqrt{3}+\sqrt{2})} $$