7.3 Problem number 1319

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

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

command

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

Mathematica 13.1 output

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

Mathematica 12.3 output

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