TITLE: Evaluating: $\int \frac{t}{\cos{t}} dt$
QUESTION [7 upvotes]: 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.

REPLY [5 votes]: 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)$$