Compute $\int_0^{\pi/4}\frac{(1-x^2)\ln(1+x^2)+(1+x^2)-(1-x^2)\ln(1-x^2)}{(1-x^4)(1+x^2)} x\exp(\frac{x^2-1}{x^2+1}) dx$ 
Compute the following integral
  \begin{equation}
\int_0^{\Large\frac{\pi}{4}}\left[\frac{(1-x^2)\ln(1+x^2)+(1+x^2)-(1-x^2)\ln(1-x^2)}{(1-x^4)(1+x^2)}\right] x\, \exp\left[\frac{x^2-1}{x^2+1}\right]\, dx
\end{equation}

I was given two integral questions by my teacher. I can answer this one although it took a lot of time to compute it. I want to share this problem to the other users here and I would love to see how Mathematics SE users compute this monster. Thank you.
 A: From the numerator, collect the logarithmic terms first. 
$$\displaystyle \int_0^{\pi/4} x\frac{(1+x^2)+(x^2-1)\ln\left(\frac{1-x^2}{1+x^2}\right)}{(1-x^4)(1+x^2)}\exp\left(\frac{x^2-1}{x^2+1}\right)\,dx$$
Rewrite $(1-x^4)=(1-x^2)(1+x^2)$ and divide the numerator by $(1+x^2)$.
$$\displaystyle \int_0^{\pi/4} \frac{x}{(1-x^2)(1+x^2)}\left(1+\frac{x^2-1}{x^2+1}\ln\left(\frac{1-x^2}{1+x^2}\right)\right)\exp\left(\frac{x^2-1}{x^2+1}\right)\,dx $$
Use the substitution $\displaystyle \frac{x^2-1}{x^2+1}=t \Rightarrow \frac{4x}{(1+x^2)^2}\,dx=dt$ to get:
$$\displaystyle \frac{1}{4}\int_{a}^{-1}\frac{e^t}{t}\left(1+t\ln(-t)\right)\,dt= \frac{1}{4}\int_{a}^{-1}e^t\left(\frac{1}{t}+\ln(-t)\right)\,dt$$
where $\displaystyle a=\frac{\pi^2/16-1}{\pi^2/16+1}$
Since $\displaystyle \int e^x(f'(x)+f(x))\,dx=e^xf(x)+C $, the above definite integral is:
$$\displaystyle \frac{1}{4}\left(e^t \ln(-t) \right|_{a}^{-1}=-\frac{1}{4}e^a\ln(-a) \approx \boxed{0.284007} $$ 
A: Rewrite
\begin{align}
&\int\left[\frac{(1-x^2)\ln(1+x^2)+(1+x^2)-(1-x^2)\ln(1-x^2)}{(1-x^4)(1+x^2)}\right] x\ \exp\left[\frac{x^2-1}{x^2+1}\right]\ dx\\
&=-\int\left[\frac{(1-x^2)\ln\left(\dfrac{1-x^2}{1+x^2}\right)-(1+x^2)}{(1-x^2)(1+x^2)(1+x^2)}\right] x\ \exp\left[-\frac{1-x^2}{1+x^2}\right]\ dx\\
&=-\frac14\int\left[\frac{(1-x^2)\ln\left(\dfrac{1-x^2}{1+x^2}\right)-(1+x^2)}{(1-x^2)}\right] \frac{2x}{1+x^2}\, \exp\left[-\frac{1-x^2}{1+x^2}\right]\ \frac{2\ dx}{1+x^2}\\
&=-\frac14\int\left[\ln\left(\frac{1-x^2}{1+x^2}\right)-\frac{1+x^2}{1-x^2}\right] \frac{2x}{1+x^2}\, \exp\left[-\frac{1-x^2}{1+x^2}\right]\ \frac{2\ dx}{1+x^2}.\tag1
\end{align}
Now, consider Weierstrass substitution:
$$
x=\tan\frac{t}{2}\;,\;\sin t=\frac{2x}{1+x^2}\;,\;\cos t=\frac{1-x^2}{1+x^2}\;,\;\text{ and }\;dt=\frac{2\ dx}{1+x^2}.
$$
The integral in $(1)$ turns out to be
$$
-\frac14\int\left[\ln\left(\cos t\right)-\frac{1}{\cos t}\right] \sin t\, \exp\left[-\cos t\right]\ dt.\tag2
$$
Let $y=\cos t\;\Rightarrow\;dy=-\sin t\ dt$, then $(2)$ becomes
$$
\frac14\int\left[\ln y-\frac{1}{y}\right] e^{-y}\ dy=\frac14\left[\int e^{-y}\ln y\ dy-\int\frac{e^{-y}}{y}\ dy\right].\tag3
$$
The second integral in the RHS $(3)$ can be evaluated by using IBP. Taking $u=e^{-y}\;\Rightarrow\;du=-e^{-y}\ dy$ and $dv=\dfrac1y\ dy\;\Rightarrow\;v=\ln y$, then
$$
\int\frac{e^{-y}}{y}\ dy=e^{-y}\ln y+\int e^{-y}\ln y\ dy.\tag4
$$
Substituting $(4)$ to $(3)$, we obtain
$$
\frac14\left[\int e^{-y}\ln y\ dy-e^{-y}\ln y-\int e^{-y}\ln y\ dy\right]=-\frac14e^{-y}\ln y+C.
$$
Thus
\begin{align}
&\int\left[\frac{(1-x^2)\ln(1+x^2)+(1+x^2)-(1-x^2)\ln(1-x^2)}{(1-x^4)(1+x^2)}\right] x\ \exp\left[\frac{x^2-1}{x^2+1}\right]\ dx\\
&=\color{blue}{-\frac14\exp\left[-\frac{1-x^2}{1+x^2}\right]\ln \left|\frac{1-x^2}{1+x^2}\right|+C}
\end{align}
and
\begin{align}
&\int_0^{\Large\frac\pi4}\left[\frac{(1-x^2)\ln(1+x^2)+(1+x^2)-(1-x^2)\ln(1-x^2)}{(1-x^4)(1+x^2)}\right] x\ \exp\left[\frac{x^2-1}{x^2+1}\right]\ dx\\
&=\color{blue}{-\frac14\exp\left[\frac{\pi^2-16}{\pi^2+16}\right]\ln \left|\frac{16-\pi^2}{16+\pi^2}\right|}.
\end{align}
