7.1 Problem number 312

\[ \int (d \tan (e+f x))^n (a+i a \tan (e+f x))^2 \, dx \]

Optimal antiderivative \[ -\frac {a^{2} \left (d \tan \! \left (f x +e \right )\right )^{1+n}}{d f \left (1+n \right )}+\frac {2 a^{2} \hypergeom \! \left (\left [1, 1+n \right ], \left [2+n \right ], \mathrm {I} \tan \! \left (f x +e \right )\right ) \left (d \tan \! \left (f x +e \right )\right )^{1+n}}{d f \left (1+n \right )} \]

command

Integrate[(d*Tan[e + f*x])^n*(a + I*a*Tan[e + f*x])^2,x]

Mathematica 13.1 output

\[ \int (d \tan (e+f x))^n (a+i a \tan (e+f x))^2 \, dx \]

Mathematica 12.3 output

\[ \frac {e^{-2 i e} 2^{-n} \left (-\frac {i \left (-1+e^{2 i (e+f x)}\right )}{1+e^{2 i (e+f x)}}\right )^{n+1} \cos ^2(e+f x) (a+i a \tan (e+f x))^2 \left (-2^n+\left (1+e^{2 i (e+f x)}\right )^{n+1} \, _2F_1\left (n+1,n+1;n+2;\frac {1}{2} \left (1-e^{2 i (e+f x)}\right )\right )\right ) \tan ^{-n}(e+f x) (d \tan (e+f x))^n}{f (n+1) (\cos (f x)+i \sin (f x))^2} \]