Evaluating: $\int \frac{t}{\cos{t}} dt$ How would you evaluate the following indefinite integral? In fact, I did evaluate 
$\int \frac{\cos{t}}{t} dt$ by parametric integration and then I thought of this variant.
$$\int \frac{t}{\cos{t}} dt$$
Here you may find the result given by W|A.
 A: Let's start with $\ \displaystyle f(x):=\log(\tan(x/2))\ $ then :
$$f'(x)=\frac{\tan(x/2)^2+1}{2\tan(x/2)}=\frac{\sin(x/2)^2+\cos(x/2)^2}{2\cos(x/2)^2\tan(x/2)}=\frac 1{\sin(x)}$$
so that $\ f'\left(t+\frac {\pi}2\right)=\dfrac 1{\cos(t)}$.
We want (ignoring integration constants up to the end) :
$$\int \dfrac t{\cos(t)}\,dt=\int tf'\left(t+\frac {\pi}2\right) dt=\left[tf\left(t+\frac {\pi}2\right)\right]-\int f\left(t+\frac {\pi}2\right)\,dt$$
Setting $\ u:=\tan\bigl(\frac x2\bigr)\ $ so that $\ dx=\dfrac {2\;du}{1+u^2}$ we rewrite the integral of $f$ as :
$$\int f(x)\;dx=\int \log\left(\tan\left(\frac x2\right)\right)\;dx=2\int \frac{\log(u)}{1+u^2}\;du$$
$$=\left[2\log(u)\arctan(u)\right]-2\int \frac {\arctan(u)}u\,du=2\left[\log(u)\arctan(u)-\rm{Ti}_2(u)\right]$$ with $\rm{Ti}_2$ the inverse tangent integral proposed by J.M. (see Lewin 1981 "Polylogarithms and associated functions" ch. 2 for more information). $\rm{Ti}_2$ may be rewritten as Clausen functions or as complex polylogarithms.
We want $\ \int f\bigl(t+\frac {\pi}2\bigr)\,dt\ $ so that $\ u:=\tan\bigl(\frac t2+\frac {\pi}4\bigr)\ $ 
and 
$$\int f\left(t+\frac {\pi}2\right)\,dt=2\left[\log\left(\tan\left(\frac t2+\frac {\pi}4\right)\right)\left(\frac t2+\frac {\pi}4\right)-\rm{Ti}_2\left(\tan\left(\frac t2+\frac {\pi}4\right)\right)\right]$$
getting :
$$\int \dfrac t{\cos(t)}\,dt=t\left[\log\left(\tan\left(\frac t2+\frac {\pi}4\right)\right)\right]-2\left[\log\left(\tan\left(\frac t2+\frac {\pi}4\right)\right)\left(\frac t2+\frac {\pi}4\right)-\rm{Ti}_2\left(\tan\left(\frac t2+\frac {\pi}4\right)\right)\right]$$
and finally :
$$\int_0^t \dfrac x{\cos(x)}\,dx=-\frac {\pi}2\log\left(\tan\left(\frac t2+\frac {\pi}4\right)\right)+2\rm{Ti}_2\left(\tan\left(\frac t2+\frac {\pi}4\right)\right)+C$$
where the additional constant $\ C=-2\;\rm{Ti}_2(1)=-2K\quad$ ($K$ is the Catalan constant).
To rewrite this with Clausen functions we may use (4.31) of Lewin's reference :
$$\rm{Ti}_2(\tan \theta)=\theta\log(\tan\theta)+\frac 12\left(\rm{Cl}_2(2\theta)-\rm{Cl}_2(\pi-2\theta)\right)$$
A: Note that
$$
\frac{1}{\cos t}=
\frac{2}{e^{it}+e^{-it}}=
\frac{2e^{it}}{1+e^{2it}}
$$
so integration by parts gives
$$
\int\frac{t}{\cos t}dt=
\int 2t\frac{e^{it}}{1+e^{2it}}dt=
\int 2t\frac{(-i)d(e^{it})}{1+e^{2it}}=
\int -2itd(\arctan(e^{it}))=
$$
$$
-2it\arctan(e^{it})-\int\arctan(e^{it})d(-2it)=
-2it\arctan(e^{it})+2i\int\arctan(e^{it})dt
$$
It is remains to compute the last integral
$$
\int\arctan(e^{it})dt=
\int\sum\limits_{k=1}^\infty \frac{(-1)^k(e^{it})^{2k+1}}{2k+1}dt=
\int\sum\limits_{k=1}^\infty \frac{(ie^{it})^{2k+1}}{i(2k+1)}dt=
\int\frac{1}{2i}\left(\sum\limits_{k=1}^\infty\frac{(ie^{it})^k}{k}-
\sum\limits_{k=1}^\infty\frac{(-ie^{it})^k}{k}\right)dt=
\frac{1}{2i}\sum\limits_{k=1}^\infty\int\frac{(ie^{it})^k}{k}dt-
\frac{1}{2i}\sum\limits_{k=1}^\infty\int\frac{(-ie^{it})^k}{k}dt=
$$
$$
\frac{1}{2i}\sum\limits_{k=1}^\infty\frac{(ie^{it})^k}{ik^2}-
\frac{1}{2i}\sum\limits_{k=1}^\infty\frac{(-ie^{it})^k}{ik^2}=
\frac{1}{2}\left(\mathrm{Li}_2(-ie^{it})-\mathrm{Li}_2(ie^{it})\right)
$$
The final result is
$$
\int\frac{t}{\cos t}=-2it\arctan(e^{it})+i(\mathrm{Li}_2(-ie^{it})-\mathrm{Li}_2(ie^{it}))
$$
