What is the integral of n-th root of tan x?

What will be the value of

$\int\sqrt[n]{\tan x},dx$

?

I have solved the cases for n=2 and n=3 but can't see how I can generalize it.

-
Wolfram alpha gives a pretty nasty answer... –  user667648 May 7 at 5:48
Can you give the expressions for the expressions that you have obtained for $n=2$ and $n=3$? It may help to guess how to proceed for the general $n$. –  William Hilbert May 7 at 6:04
Since your asking for a "value"; is it really the antiderivative you're after, or are you looking for a definite integral (and omitted the limits for some reason)? EDIT: Ah, now I see the tag indefinite-integrals. –  Daniel R May 7 at 6:32
If this is a definite integral over $[0,\frac{\pi}{2} ]$, it has a very simple closed form $\displaystyle\;\;\frac{\pi}{2\cos\left(\frac{\pi}{2n}\right)}$. –  achille hui May 7 at 8:44
$n$ is for an integer, a rational number, or a real number, or else? –  Harry Peter May 8 at 10:06

The generalization is tedious but actually pretty straight forward. The key is perform partial fraction decomposition of some rational function in a systematic manner.

Introduce variables $y$ and $z$ such that $y = \tan x = z^{n}$, we have

$$\int \sqrt[n]{\,\tan x} dx = \int \frac{y^{1/n}}{1+y^2} dy = \int \frac{n z^n}{1+z^{2n}} dz$$ For any integer $k$, let $\displaystyle\;\theta_k = \frac{(2k+1)\pi}{2n}\;$. We can factorize the denominator of the integrand as

$$z^{2n}+1 = \prod_{k=0}^{n-1}\left(z- e^{i\theta_k}\right)\left(z - e^{-i\theta_k}\right) = \prod_{k=0}^{n-1}\left(z^2 - 2\cos\theta_k z + 1\right)$$ What make life easier is all the roots of the denominator are simple. Given any two polynomials $p(z)$ and $q(z)$ with $\deg p < \deg q$. If all the roots $\lambda_1, \lambda_2, \ldots, \lambda_{\deg q}$ of $q(z)$ are simple, we can read off the partial fraction decomposition of their quotient easily:

$$\frac{p(z)}{q(z)} = \sum_{k=1}^{\deg q} \frac{p(\lambda_k)}{q'(\lambda_k)(z - \lambda_k)}$$

Apply this to our integrand and notice $e^{in\theta_k} = (-1)^k i$, we can simplify $\displaystyle\;\frac{n z^n}{1+z^{2n}}\;$ as

\begin{align} & n \sum_{k=0}^{n-1} \left[ \frac{ e^{in\theta_k} }{2n e^{i(2n-1)\theta_k} (z - e^{i\theta_k} ) } + \frac{ e^{-in\theta_k} }{2n e^{-i(2n-1)\theta_k} (z - e^{-i\theta_k} ) } \right]\\ =& \frac{1}{2i}\sum_{k=0}^{n-1} (-1)^k \left[ \frac{e^{i\theta_k}}{z-e^{i\theta_k}} - \frac{e^{-i\theta_k}}{z-e^{-i\theta_k}} \right]\\ =& \sum_{k=0}^{n-1} (-1)^k\sin\theta_k \left( \frac{z}{z^2 - 2\cos\theta_k z + 1}\right)\\ =& \sum_{k=0}^{n-1} (-1)^k\left[ \sin\theta_k \left(\frac{z - \cos\theta_k}{z^2 - 2\cos\theta_k z + 1}\right) + \cos\theta_k\left(\frac{\sin\theta_k}{(z - \cos\theta_k)^2 + (\sin\theta_k)^2}\right)\right] \end{align} and evaluate the indefinite integral as

$$\sum_{k=0}^{n-1}(-1)^k\left[ \frac{\sin\theta_k}{2} \log\left(z^2 - 2\cos\theta_k z + 1\right) + \cos\theta_k \arctan\left(\frac{z - \cos\theta_k}{\sin\theta_k}\right) \right] + \text{const.}$$

-
I think there's a typo, in the first displayed line of math you wrote $y^{1/n} = z^n$, but by definition of your $z$ that should be $y^{1/n} = z$ (its in the integral sign, you see what i mean?) –  Joachim May 7 at 12:47
@Joachim It is not a typo, it comes from $dy$. i.e. $y^{1/n} dy = z dz^n = nz^n dz$ –  achille hui May 7 at 12:51
Ah, i was too quick, sorry for the hassle! –  Joachim May 7 at 16:10

As said in comments, this a quite difficult integral. However, if you change variable $x=\tan ^{-1}(y)$, you have $$\int\sqrt[n]{\tan x} dx=\int \frac {y^{1/n}} {1+y^2} dy =\frac{n y^{\frac{1}{n}+1} \, _2F_1\left(1,\frac{n+1}{2 n};\frac{1}{2} \left(3+\frac{1}{n}\right);-y^2\right)}{n+1}$$ which looks slightly better than in the original form for which you would have a lot of trouble for some specific values of $n$ ($5$,$7$,..).

This explains why, for $n=3$, you have (this could be significantly simplified with patience) $$\frac{1}{4} \left(-2 \sqrt{3} \tan ^{-1}\left(\sqrt{3}-2 \sqrt[3]{\tan (x)}\right)-2 \sqrt{3} \tan ^{-1}\left(2 \sqrt[3]{\tan (x)}+\sqrt{3}\right)-2 \log \left(\tan ^{\frac{2}{3}}(x)+1\right)+\log \left(\tan ^{\frac{2}{3}}(x)-\sqrt{3} \sqrt[3]{\tan (x)}+1\right)+\log \left(\tan ^{\frac{2}{3}}(x)+\sqrt{3} \sqrt[3]{\tan (x)}+1\right)\right)$$

If one makes a second change of variable $y=z^n$, he should arrive to a very nice integral which is $$n \int \frac {z^n}{1+z^{2n}} dz$$