Integral involving $\tan(\ln(x))$
I am trying to solve the following integral: $$I=\int\tan(\ln(x))dx$$ which I initially thought would be easy considering there are many ways to solve both: $$\int\sin(\ln(x))dx$$ $$\int\cos(\ln(x))dx$$ But I appear to be wrong. Upon substitution I can it into the following forms, although none of these appear to lead to anything promising and Wolfram Alpha seems to be showing the only solution involves the hypergeometric function. Since I have limited knowledge of this and how to arrive at this answer I was wondering if anybody had an easy way to derive this or point me in the right direction for finding a series which this can be expressed as. I have found it interesting that it can be expressed as: $$\int\tan(\ln(x))dx=-\int\frac{2}{x^{2i}+1}-1\,\,dx=\int\left[1+\frac{1}{x^i-i}-\frac{1}{x^i+i}\right]dx$$ Although I feel that this would probably be the best approach: $$\int\tan(\ln(x))dx=\int e^u\tan(u)du=e^u\tan(u)-\int e^u\sec^2(u)du$$ Any thoughts? Thanks
Another thought I am having is: $$\int\tan(\ln(x))dx=\int e^u\tan(u)du=\int_0^u\sum_{n=0}^\infty\frac{(-1)^n2^{2n+2}(2^{2n+2}-1)B_{2n+2}}{(2n+2)!}e^tt^{2n+1} $$$$=\int_0^u\sum_{n=0}^\infty\frac{(-1)^{3n}2^{2n+2}(2^{2n+2}-1)B_{2n+2}}{(2n+2)!}e^{-t}t^{2n+1}dt $$$$=\sum_{n=0}^\infty\frac{(-1)^{3n}2^{2n+2}(2^{2n+2}-1)B_{2n+2}}{(2n+2)!}\gamma(2n+2,\ln(x)) $$$$=\sum_{n=0}^\infty\sum_{k=0}^\infty\frac{(-1)^{3n}2^{2n+2}(2^{2n+2}-1)B_{2n+2}x^{k+2n+2}e^{-x}}{(2n+2)\Gamma(k+2n+3)}$$ $$=\sum_{n=0}^\infty\sum_{k=0}^\infty\sum_{r=1}^\infty\frac{2^{2n+3}(2^{2n+2}-1)x^{k+2n+2}e^{-x}}{(2\pi)^{2n}(2n+1)^r(2n+2)\Gamma(k+2n+3)}$$
The conversion to complex form:
$$\int \tan(\ln(x))\ dx = \int \left[1 + \frac{1}{x^i - i} - \frac{1}{x^i + i}\right]\ dx$$
seems to be what Wolfram Alpha is doing. The integral of
$$\int \frac{1}{1 - x^a}\ dx$$
can be expressed using hypergeometric functions: expand
$$\frac{1}{1 - x^a} = \sum_{n=0}^{\infty} (x^a)^n = \sum_{n=0}^{\infty} x^{an}$$
hence
$$\int \frac{1}{1 - x^a}\ dx = \sum_{n=0}^{\infty} \frac{x^{an + 1}}{an + 1} = x \left(\sum_{n=0}^{\infty} \frac{(x^a)^n}{an + 1}\right)$$
for which the right-hand series has coefficient ratio, where $a_n := \frac{n!}{an + 1}$,
$$ \begin{align} \frac{a_{n+1}}{a_n} &= \frac{(n+1)!/(a(n+1)+1)}{n!/(an+1)}\\ &= \frac{(n+1)! (an+1)}{(a(n+1)+1) n!}\\ &= \frac{(n+1) (an+1)}{a(n+1)+1}\\ &= \frac{(n+1)\left(n + \frac{1}{a}\right)}{\left(n + \left[1 + \frac{1}{a}\right]\right)}\end{align}$$
hence
$$\int \frac{1}{1 - x^a}\ dx = x\ _2 F_1\left(1, \frac{1}{a}; 1 + \frac{1}{a}; x^a\right)$$
and
$$\int \frac{1}{1 - (bx)^a}\ dx = x\ _2 F_1\left(1, \frac{1}{a}; 1 + \frac{1}{a}; (bx)^a\right)$$
so multiplying and dividing by $i$,
$$\begin{align} 1 + \frac{1}{x^i - i} - \frac{1}{x^i + i} &= \frac{1}{i} \left[i + \frac{1}{\frac{x^i}{i} - 1} - \frac{1}{\frac{x^i}{i} + 1}\right]\\ &= \frac{1}{i} \left[i + \frac{1}{\left(\frac{x}{i^{1/i}}\right)^i - 1} - \frac{1}{\left(\frac{x}{i^{1/i}}\right)^i + 1}\right]\\ &= \frac{1}{i} \left[i - \frac{1}{1 - \left(\frac{x}{i^{1/i}}\right)^i} - \frac{1}{1 - \left((-1)^{1/i} \frac{x}{i^{1/i}}\right)^i}\right]\end{align}$$
and using the identity just derived,
$$\int \tan(\ln(x))\ dx = \frac{1}{i} \left[ix - x\ _2 F_1\left(1, \frac{1}{i}; 1 + \frac{1}{i}; \left(\frac{x}{i^{1/i}}\right)^i\right) - x\ _2 F_1\left(1, \frac{1}{i}; 1 + \frac{1}{i}; -\left(\frac{x}{i^{1/i}}\right)^i\right)\right] + C$$
Yeah. YUCK. (and make sure to check this; my eyes are glazed right now.) And not very useful. And let's not get into whatever the right branch choices have to be on the complex powers (and likely the hypergeometric functions, too) to get a consistent result for real inputs.
This is why that trying to find an "explicit formula" isn't always the best option in actual practice(*) - and why one should not wed oneself too much to always favoring one particular representation of a mathematical object. If anything, it is much simpler to just treat the integral as-is. As someone I saw mention somewhere else: integrals really should not necessarily be thought of as things to be "solved", in so much as being taken as a mathematical operation in their own right. If this came up in actual use, I'd just leave as is (probably as a definite integral) and mention as a note that there is an ugly and not particularly illuminating expression with hypergeometric functions.
(*) PS. This is not an attack on you OP or to suggest you shouldn't want to try solving integrals, it's more of a gripe - out of many that I have - and small rant with how that maths is commonly taught and presented.
In the same spirit as The_Sympathizer's answer, we could arrive to the monstreous $$I=-i \left(\frac{1-2i}{5} x^{1+2 i} \, _2F_1\left(1,\frac{2-i}{2};\frac{4-i}{2};-x^{2 i}\right)-x \, _2F_1\left(-\frac{i}{2},1;\frac{2-i}{2};-x^{2 i}\right)\right)$$ If, as you did, you make $$\tan (u) = \sum^{\infty}_{n=1} \frac{B_{2n} (-4)^n \left(1-4^n\right)}{(2n)!} u^{2n-1}$$ where I see a problem is when $ 0\lt x \lt 1$.