Evaluate the integral $\int \frac{1}{\sqrt[3]{(x+1)^2(x-2)^2}}\mathrm dx$

I found an interesting substitution by a bit of trial and error. $$\begin{align} x&=\frac{1+3\sin(u)}{2}\\ \therefore dx&=\frac{3\cos(u)}{2}du\\ x+1&=\frac{3+3\sin(u)}{2}&&=\frac{3(1+\sin(u))}{2}\\ x-2&=\frac{3\sin(u)-3}{2}&&=\frac{3(\sin(u)-1)}{2}\\ \therefore (x+1)(x-2)&=\frac{9(\sin^2(u)-1)}{4}&&=-\frac{9\cos^2(u)}{4} \end{align}$$ Using these leads to this interesting final integral:$$\left(\frac{2}{3}\right)^{\frac{1}{3}}\int\frac{du}{\cos^{\frac{1}{3}}(u)}$$


Change variable to $$x - \frac12 = \frac32 u \iff u = \frac{2x-1}{3} \quad\text{ followed by }\quad (u^2-1)^{1/3} = v \iff u = \sqrt{1+v^3}$$ We have $$\int\frac{dx}{\sqrt[3]{(x+1)^2(x-2)^2}} = \int\frac{dx}{(x^2-x-2)^{2/3}} = \int\frac{dx}{\left(\left(x-\frac12\right)^2-\frac{9}{4}\right)^{2/3}}\\ = \left(\frac{2}{3}\right)^{1/3}\int\frac{du}{(u^2-1)^{2/3}} = \left(\frac{2}{3}\right)^{1/3}\int\frac{d\sqrt{1+v^3}}{v^2} = \left(\frac{3}{2}\right)^{2/3}\int \frac{dv}{\sqrt{1+v^3}} $$ Using result from this answer, the integral becomes

$$\frac{3^{5/12}}{2^{2/3}} \left.F\left(\cos^{-1}\left(\frac{2\sqrt{3}}{1+\sqrt{3}+\sqrt[3]{\frac49(x+1)(x-2)}}-1\right)\right|\frac{2+\sqrt{3}}{4}\right) + \text{constant}$$ where $\displaystyle\;F(\phi|m) = \int_0^\phi \frac{d\theta}{\sqrt{1-m(\sin\theta)^2}}\;$ is the incomplete elliptic integral of the first kind.


As commented by Brevan Ellefsen, there is no elementary solution for $$I=\left(\frac{2}{3}\right)^{\frac{1}{3}}\int\frac{du}{\cos^{\frac{1}{3}}(u)}$$ but there is effectively a solution using hypergeometric function. It seems to be $$I=-\left(\frac{3}{2}\right)^{2/3} \cos ^{\frac{2}{3}}(u) \, _2F_1\left(\frac{1}{3},\frac{1}{2};\frac{4}{3};\cos ^2(u)\right)$$ where appears the Gaussian (sometimes called ordinary) hypergeometric function.

In terms of $x$, the antiderivative is then $$I=\int \frac{1}{\sqrt[3]{(x+1)^2(x-2)^2}}\, dx= \sqrt[3]{3(x-2)} \,\,\, _2F_1\left(\frac{1}{3},\frac{2}{3};\frac{4}{3};\frac{2-x}{3}\right)$$ Back to definitions (and getting rid of Pochhammer symbols), $$I=\sum_{n=0}^\infty \frac{3^{-4 n} \,\Gamma \left(\frac{1}{3}\right)\, \Gamma (3 n)}{n!\, \Gamma (n)\, \Gamma \left(n+\frac{4}{3}\right)} (2-x)^n$$

Edit

The coefficients in the last expression vary extremely fast ( the first is $1$, the tenth is $\approx 1.851\times 10^{-7}$, the hundredth is $\approx 1.025\times 10^{-51}$). For large values of $n$, they are $$\log(c_n)=-n \log (3)-\frac{4}{3} \log (n)+\log \left(\frac{\Gamma \left(\frac{1}{3}\right)}{2 \sqrt{3} \pi }\right)-\frac{4}{9 n}+O\left(\frac{1}{n^2}\right)$$