60.1 Problem number 28

\[ \int \cot (c+d x) (a+i a \tan (c+d x))^3 \, dx \]

Optimal antiderivative \[ 4 i a^{3} x +\frac {3 a^{3} \ln \left (\cos \left (d x +c \right )\right )}{d}+\frac {a^{3} \ln \left (\sin \left (d x +c \right )\right )}{d}+\frac {-a^{3}-i a^{3} \tan \left (d x +c \right )}{d} \]

command

integrate(cot(d*x+c)*(a+I*a*tan(d*x+c))**3,x)

Sympy 1.10.1 under Python 3.10.4 output

\[ \frac {2 a^{3}}{d e^{2 i c} e^{2 i d x} + d} + \frac {a^{3} \left (\log {\left (e^{2 i d x} - e^{- 2 i c} \right )} + 3 \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}\right )}{d} \]

Sympy 1.8 under Python 3.8.8 output

\[ \text {Exception raised: NotInvertible} \]________________________________________________________________________________________