How can i obtain general form of this integtral $\int_0^{\pi/4}\frac{x^3}{1+b\tan x}\ dx$
This is how i tried
$$\int_0^{\pi/4}\frac{x^3}{1+b\tan x}\ dx$$
writing $\tan x=\frac{e^{ix}-e^{-ix}}{i(e^{ix}+e^{-ix})}$
$$i\int_0^{\pi/4}\frac{x^3(e^{ix}+e^{-ix})}{i(e^{ix}+e^{-ix})+b(e^{ix}-e^{-ix})}\ dx$$
substituting $e^{ix}=t;x=-i\ln t; dx=-\frac{i\ dt}{t}$
$$-\int_{1}^{e^{i\pi/4}}\frac{\ln^3t\left(t^2+1\right)}{i(t^2+1)+b(t^2-1)} dt$$
$$-\frac{1}{(i+b)}\int_{1}^{e^{i\pi/4}}\frac{\ln^3t\left(t^2+1\right)}{t^2+\frac{(i-b)}{(i+b)}} dt$$
Solution 1:
First off, note that
$$\forall(b,x)\in\mathbb{R}\times\left(-\frac{\pi}{2},\frac{\pi}{2}\right):\left(-1<b\land0\le x\le\frac{\pi}{4}\right)\implies0<1+b\tan{\left(x\right)}.$$
Define the function $\mathcal{I}:\left(-1,\infty\right)\rightarrow\mathbb{R}$ via the definite integral
$$\mathcal{I}{\left(b\right)}:=\int_{0}^{\frac{\pi}{4}}\mathrm{d}x\,\frac{x^{3}}{1+b\tan{\left(x\right)}}.$$
We seek a general closed-form expression for $\mathcal{I}$ in terms of elementary or well-known special functions.
Suppose $b\in\left(-1,\infty\right)$. The following derivative is readily verified:
$$\frac{d}{dx}\left[x+b\ln{\left(\cos{\left(x\right)}\right)}+b\ln{\left(1+b\tan{\left(x\right)}\right)}\right]=\frac{1+b^{2}}{1+b\tan{\left(x\right)}};~~~\small{x\in\left(0,\frac{\pi}{4}\right)}.$$
We can use the derivative above to facilitate the integration by parts of $\mathcal{I}$:
$$\begin{align} \left(1+b^{2}\right)\mathcal{I}{\left(b\right)} &=\left(1+b^{2}\right)\int_{0}^{\frac{\pi}{4}}\mathrm{d}x\,\frac{x^{3}}{1+b\tan{\left(x\right)}}\\ &=\int_{0}^{\frac{\pi}{4}}\mathrm{d}x\,x^{3}\left[\frac{1+b^{2}}{1+b\tan{\left(x\right)}}\right]\\ &=\int_{0}^{\frac{\pi}{4}}\mathrm{d}x\,x^{3}\frac{d}{dx}\left[x+b\ln{\left(\cos{\left(x\right)}\right)}+b\ln{\left(1+b\tan{\left(x\right)}\right)}\right]\\ &=\lim_{x\to\frac{\pi}{4}}x^{3}\left[x+b\ln{\left(\cos{\left(x\right)}\right)}+b\ln{\left(1+b\tan{\left(x\right)}\right)}\right]\\ &~~~~~-\lim_{x\to0}x^{3}\left[x+b\ln{\left(\cos{\left(x\right)}\right)}+b\ln{\left(1+b\tan{\left(x\right)}\right)}\right]\\ &~~~~~-\int_{0}^{\frac{\pi}{4}}\mathrm{d}x\,\left(3x^{2}\right)\left[x+b\ln{\left(\cos{\left(x\right)}\right)}+b\ln{\left(1+b\tan{\left(x\right)}\right)}\right];~~~\small{I.B.P.}\\ &=\left(\frac{\pi}{4}\right)^{3}\left[\frac{\pi}{4}+b\ln{\left(\cos{\left(\frac{\pi}{4}\right)}\right)}+b\ln{\left(1+b\tan{\left(\frac{\pi}{4}\right)}\right)}\right]\\ &~~~~~-3\int_{0}^{\frac{\pi}{4}}\mathrm{d}x\,x^{3}-3b\int_{0}^{\frac{\pi}{4}}\mathrm{d}x\,x^{2}\ln{\left(\cos{\left(x\right)}\right)}-3b\int_{0}^{\frac{\pi}{4}}\mathrm{d}x\,x^{2}\ln{\left(1+b\tan{\left(x\right)}\right)}\\ &=\left(\frac{\pi}{4}\right)^{3}\left[\frac{\pi}{4}+b\ln{\left(\frac{1}{\sqrt{2}}\right)}+b\ln{\left(1+b\right)}\right]\\ &~~~~~-\frac34\left(\frac{\pi}{4}\right)^{4}+3b\int_{0}^{\frac{\pi}{4}}\mathrm{d}x\,x^{2}\ln{\left(\sec{\left(x\right)}\right)}-3b\int_{0}^{\frac{\pi}{4}}\mathrm{d}x\,x^{2}\ln{\left(1+b\tan{\left(x\right)}\right)}\\ &=\frac14\left(\frac{\pi}{4}\right)^{4}+\left(\frac{\pi}{4}\right)^{3}b\ln{\left(\frac{1+b}{\sqrt{2}}\right)}+3b\int_{0}^{\frac{\pi}{4}}\mathrm{d}x\,x^{2}\ln{\left(\sec{\left(x\right)}\right)}\\ &~~~~~-3b\int_{0}^{\frac{\pi}{4}}\mathrm{d}x\,x^{2}\ln{\left(1+b\tan{\left(x\right)}\right)}\\ &=\frac14\left(\frac{\pi}{4}\right)^{4}+\left(\frac{\pi}{4}\right)^{3}b\ln{\left(\frac{1+b}{\sqrt{2}}\right)}+3b\,\mathcal{J}-3b\,\mathcal{K}{\left(b\right)},\\ \end{align}$$
where in the last line above $\mathcal{J}$ denotes the value of the definite integral
$$\mathcal{J}:=\int_{0}^{\frac{\pi}{4}}\mathrm{d}x\,x^{2}\ln{\left(\sec{\left(x\right)}\right)}\approx0.032411999,$$
and we've introduced the function $\mathcal{K}:\left(-1,\infty\right)\rightarrow\mathbb{R}$ defined by the integral representation
$$\mathcal{K}{\left(b\right)}:=\int_{0}^{\frac{\pi}{4}}\mathrm{d}x\,x^{2}\ln{\left(1+b\tan{\left(x\right)}\right)}.$$
The integral $\mathcal{K}$ can be resolved in terms of Clausen functions. Suppose $b\in\left(-1,\infty\right)$, and set
$$\beta:=\arctan{\left(b\right)}\in\left(-\frac{\pi}{4},\frac{\pi}{2}\right).$$
Then,
$$\begin{align} \mathcal{K}{\left(b\right)} &=\int_{0}^{\frac{\pi}{4}}\mathrm{d}\tau\,\tau^{2}\ln{\left(1+b\tan{\left(\tau\right)}\right)}\\ &=\int_{0}^{\frac{\pi}{4}}\mathrm{d}\tau\,\tau^{2}\ln{\left(\left|1+b\tan{\left(\tau\right)}\right|\right)}\\ &=\int_{0}^{\frac{\pi}{4}}\mathrm{d}\tau\,\tau^{2}\ln{\left(\left|1+\tan{\left(\beta\right)}\tan{\left(\tau\right)}\right|\right)}\\ &=\int_{0}^{\frac{\pi}{4}}\mathrm{d}\tau\,\tau^{2}\bigg{[}-\ln{\left(\cos{\left(\beta\right)}\right)}+\ln{\left(\cos{\left(\beta\right)}\right)}-\ln{\left(\cos{\left(\tau\right)}\right)}+\ln{\left(\cos{\left(\tau\right)}\right)}\\ &~~~~~+\ln{\left(\left|1+\tan{\left(\beta\right)}\tan{\left(\tau\right)}\right|\right)}\bigg{]}\\ &=\int_{0}^{\frac{\pi}{4}}\mathrm{d}\tau\,\tau^{2}\bigg{[}\ln{\left(\sec{\left(\beta\right)}\right)}+\ln{\left(\sec{\left(\tau\right)}\right)}+\ln{\left(\cos{\left(\beta\right)}\cos{\left(\tau\right)}\left|1+\tan{\left(\beta\right)}\tan{\left(\tau\right)}\right|\right)}\bigg{]}\\ &=\int_{0}^{\frac{\pi}{4}}\mathrm{d}\tau\,\tau^{2}\ln{\left(\sec{\left(\beta\right)}\right)}+\int_{0}^{\frac{\pi}{4}}\mathrm{d}\tau\,\tau^{2}\ln{\left(\sec{\left(\tau\right)}\right)}\\ &~~~~~+\int_{0}^{\frac{\pi}{4}}\mathrm{d}\tau\,\tau^{2}\ln{\left(\cos{\left(\beta\right)}\cos{\left(\tau\right)}\left|1+\tan{\left(\beta\right)}\tan{\left(\tau\right)}\right|\right)}\\ &=\frac13\left(\frac{\pi}{4}\right)^{3}\ln{\left(\sec{\left(\beta\right)}\right)}+\mathcal{J}+\int_{0}^{\frac{\pi}{4}}\mathrm{d}\tau\,\tau^{2}\ln{\left(\left|\cos{\left(\beta\right)}\cos{\left(\tau\right)}+\sin{\left(\beta\right)}\sin{\left(\tau\right)}\right|\right)}\\ &=\frac13\left(\frac{\pi}{4}\right)^{3}\ln{\left(\sec{\left(\beta\right)}\right)}+\mathcal{J}+\int_{0}^{\frac{\pi}{4}}\mathrm{d}\tau\,\tau^{2}\ln{\left(\left|\cos{\left(\beta-\tau\right)}\right|\right)}\\ &=\frac13\left(\frac{\pi}{4}\right)^{3}\ln{\left(\sec{\left(\beta\right)}\right)}+\mathcal{J}+\int_{\beta-\frac{\pi}{4}}^{\beta}\mathrm{d}\vartheta\,\left(\beta-\vartheta\right)^{2}\ln{\left(\left|\cos{\left(\vartheta\right)}\right|\right)};~~~\small{\left[\tau=\beta-\vartheta\right]}\\ &=\frac13\left(\frac{\pi}{4}\right)^{3}\ln{\left(\sec{\left(\beta\right)}\right)}+\mathcal{J}\\ &~~~~~+\int_{\frac{\pi}{2}-\beta}^{\frac{3\pi}{4}-\beta}\mathrm{d}\varphi\,\left(\beta-\frac{\pi}{2}+\varphi\right)^{2}\ln{\left(\left|\sin{\left(\varphi\right)}\right|\right)};~~~\small{\left[\vartheta=\frac{\pi}{2}-\varphi\right]}\\ &=\frac13\left(\frac{\pi}{4}\right)^{3}\ln{\left(\sec{\left(\beta\right)}\right)}+\mathcal{J}\\ &~~~~~+\int_{\pi-2\beta}^{\frac{3\pi}{2}-2\beta}\mathrm{d}x\,\frac12\left(\beta-\frac{\pi}{2}+\frac{x}{2}\right)^{2}\ln{\left(\left|\sin{\left(\frac{x}{2}\right)}\right|\right)};~~~\small{\left[\varphi=\frac{x}{2}\right]}\\ &=\frac13\left(\frac{\pi}{4}\right)^{3}\ln{\left(\sec{\left(\beta\right)}\right)}+\mathcal{J}\\ &~~~~~+\frac18\int_{\pi-2\beta}^{\frac{3\pi}{2}-2\beta}\mathrm{d}x\,\left(2\beta-\pi+x\right)^{2}\left[-\ln{\left(2\right)}+\ln{\left(\left|2\sin{\left(\frac{x}{2}\right)}\right|\right)}\right]\\ &=\frac13\left(\frac{\pi}{4}\right)^{3}\ln{\left(\sec{\left(\beta\right)}\right)}+\mathcal{J}-\frac18\ln{\left(2\right)}\int_{\pi-2\beta}^{\frac{3\pi}{2}-2\beta}\mathrm{d}x\,\left(2\beta-\pi+x\right)^{2}\\ &~~~~~+\frac18\int_{\pi-2\beta}^{\frac{3\pi}{2}-2\beta}\mathrm{d}x\,\left(2\beta-\pi+x\right)^{2}\ln{\left(\left|2\sin{\left(\frac{x}{2}\right)}\right|\right)}\\ &=\frac13\left(\frac{\pi}{4}\right)^{3}\ln{\left(\sec{\left(\beta\right)}\right)}+\mathcal{J}\\ &~~~~~-\ln{\left(2\right)}\int_{0}^{\frac{\pi}{4}}\mathrm{d}y\,y^{2};~~~\small{\left[2\beta-\pi+x=2y\right]}\\ &~~~~~+\frac18\int_{\alpha}^{\frac{\pi}{2}+\alpha}\mathrm{d}x\,\left(x-\alpha\right)^{2}\ln{\left(\left|2\sin{\left(\frac{x}{2}\right)}\right|\right)};~~~\small{\left[\alpha:=\pi-2\beta\in\left(0,\frac{3\pi}{2}\right)\right]}\\ &=\frac13\left(\frac{\pi}{4}\right)^{3}\ln{\left(\sec{\left(\beta\right)}\right)}+\mathcal{J}-\frac13\left(\frac{\pi}{4}\right)^{3}\ln{\left(2\right)}\\ &~~~~~-\frac18\int_{\alpha}^{\frac{\pi}{2}+\alpha}\mathrm{d}x\,\left(x-\alpha\right)^{2}(-1)\ln{\left(\left|2\sin{\left(\frac{x}{2}\right)}\right|\right)}\\ &=\mathcal{J}+\frac13\left(\frac{\pi}{4}\right)^{3}\ln{\left(\frac12\sec{\left(\beta\right)}\right)}-\frac18\int_{\alpha}^{\frac{\pi}{2}+\alpha}\mathrm{d}x\,\left(x-\alpha\right)^{2}\frac{d}{dx}\operatorname{Cl}_{2}{\left(x\right)},\\ \end{align}$$
and then,
$$\begin{align} \mathcal{K}{\left(b\right)} &=\mathcal{J}+\frac13\left(\frac{\pi}{4}\right)^{3}\ln{\left(\frac12\sec{\left(\beta\right)}\right)}-\frac18\int_{\alpha}^{\frac{\pi}{2}+\alpha}\mathrm{d}x\,\left(x-\alpha\right)^{2}\frac{d}{dx}\operatorname{Cl}_{2}{\left(x\right)}\\ &=\mathcal{J}+\frac13\left(\frac{\pi}{4}\right)^{3}\ln{\left(\frac12\sec{\left(\beta\right)}\right)}\\ &~~~~~-\frac18\left(\frac{\pi}{2}\right)^{2}\operatorname{Cl}_{2}{\left(\frac{\pi}{2}+\alpha\right)}+\frac14\int_{\alpha}^{\frac{\pi}{2}+\alpha}\mathrm{d}x\,\left(x-\alpha\right)\operatorname{Cl}_{2}{\left(x\right)};~~~\small{I.B.P.}\\ &=\mathcal{J}+\frac13\left(\frac{\pi}{4}\right)^{3}\ln{\left(\frac12\sec{\left(\beta\right)}\right)}-\frac12\left(\frac{\pi}{4}\right)^{2}\operatorname{Cl}_{2}{\left(\frac{\pi}{2}+\alpha\right)}\\ &~~~~~-\frac{\pi}{8}\operatorname{Cl}_{3}{\left(\frac{\pi}{2}+\alpha\right)}+\frac14\int_{\alpha}^{\frac{\pi}{2}+\alpha}\mathrm{d}x\,\operatorname{Cl}_{3}{\left(x\right)};~~~\small{I.B.P.}\\ &=\mathcal{J}+\frac13\left(\frac{\pi}{4}\right)^{3}\ln{\left(\frac12\sec{\left(\beta\right)}\right)}-\frac12\left(\frac{\pi}{4}\right)^{2}\operatorname{Cl}_{2}{\left(\frac{\pi}{2}+\alpha\right)}\\ &~~~~~-\frac{\pi}{8}\operatorname{Cl}_{3}{\left(\frac{\pi}{2}+\alpha\right)}+\frac14\left[\operatorname{Cl}_{4}{\left(\frac{\pi}{2}+\alpha\right)}-\operatorname{Cl}_{4}{\left(\alpha\right)}\right]\\ &=\mathcal{J}-\frac13\left(\frac{\pi}{4}\right)^{3}\ln{\left(2\cos{\left(\beta\right)}\right)}-\frac12\left(\frac{\pi}{4}\right)^{2}\operatorname{Cl}_{2}{\left(\frac{3\pi}{2}-2\beta\right)}\\ &~~~~~-\frac{\pi}{8}\operatorname{Cl}_{3}{\left(\frac{3\pi}{2}-2\beta\right)}+\frac14\operatorname{Cl}_{4}{\left(\frac{3\pi}{2}-2\beta\right)}-\frac14\operatorname{Cl}_{4}{\left(\pi-2\beta\right)}.\\ \end{align}$$
We can now complete our evaluation of $\mathcal{I}$. We finally obtain
$$\begin{align} \mathcal{I}{\left(b\right)} &=\frac{\pi^{4}}{4^{5}}\cdot\frac{1}{1+b^{2}}+\frac{\pi^{3}}{4^{3}}\cdot\frac{b}{1+b^{2}}\ln{\left(\frac{1+b}{\sqrt{2}}\right)}+\frac{3b}{1+b^{2}}\left[\mathcal{J}-\mathcal{K}{\left(b\right)}\right]\\ &=\frac{\pi^{4}}{4^{5}}\cdot\frac{1}{1+b^{2}}+\frac{\pi^{3}}{4^{3}}\cdot\frac{b}{1+b^{2}}\ln{\left(\frac{1+b}{\sqrt{2}}\right)}\\ &~~~~~+\frac{3b}{1+b^{2}}\bigg{[}\frac13\left(\frac{\pi}{4}\right)^{3}\ln{\left(2\cos{\left(\beta\right)}\right)}+\frac12\left(\frac{\pi}{4}\right)^{2}\operatorname{Cl}_{2}{\left(\frac{3\pi}{2}-2\beta\right)}\\ &~~~~~+\frac{\pi}{8}\operatorname{Cl}_{3}{\left(\frac{3\pi}{2}-2\beta\right)}-\frac14\operatorname{Cl}_{4}{\left(\frac{3\pi}{2}-2\beta\right)}+\frac14\operatorname{Cl}_{4}{\left(\pi-2\beta\right)}\bigg{]}\\ &=\frac{\pi^{4}}{4^{5}}\cos^{2}{\left(\beta\right)}+\frac{\pi^{3}}{2^{7}}\sin{\left(2\beta\right)}\ln{\left(2\sin{\left(\frac{\pi}{4}+\beta\right)}\right)}\\ &~~~~~+\frac38\sin{\left(2\beta\right)}\bigg{[}\frac{\pi^{2}}{2^{3}}\operatorname{Cl}_{2}{\left(\frac{3\pi}{2}-2\beta\right)}+\frac{\pi}{2}\operatorname{Cl}_{3}{\left(\frac{3\pi}{2}-2\beta\right)}\\ &~~~~~-\operatorname{Cl}_{4}{\left(\frac{3\pi}{2}-2\beta\right)}+\operatorname{Cl}_{4}{\left(\pi-2\beta\right)}\bigg{]}.\blacksquare\\ \end{align}$$