\[ \int (c+d x)^4 \cos (a+b x) \cot ^2(a+b x) \, dx \]
Optimal antiderivative \[ -\frac {8 d \left (d x +c \right )^{3} \arctanh \left ({\mathrm e}^{i \left (b x +a \right )}\right )}{b^{2}}+\frac {24 d^{3} \left (d x +c \right ) \cos \left (b x +a \right )}{b^{4}}-\frac {4 d \left (d x +c \right )^{3} \cos \left (b x +a \right )}{b^{2}}-\frac {\left (d x +c \right )^{4} \csc \left (b x +a \right )}{b}+\frac {12 i d^{2} \left (d x +c \right )^{2} \polylog \left (2, -{\mathrm e}^{i \left (b x +a \right )}\right )}{b^{3}}-\frac {12 i d^{2} \left (d x +c \right )^{2} \polylog \left (2, {\mathrm e}^{i \left (b x +a \right )}\right )}{b^{3}}-\frac {24 d^{3} \left (d x +c \right ) \polylog \left (3, -{\mathrm e}^{i \left (b x +a \right )}\right )}{b^{4}}+\frac {24 d^{3} \left (d x +c \right ) \polylog \left (3, {\mathrm e}^{i \left (b x +a \right )}\right )}{b^{4}}-\frac {24 i d^{4} \polylog \left (4, -{\mathrm e}^{i \left (b x +a \right )}\right )}{b^{5}}+\frac {24 i d^{4} \polylog \left (4, {\mathrm e}^{i \left (b x +a \right )}\right )}{b^{5}}-\frac {24 d^{4} \sin \left (b x +a \right )}{b^{5}}+\frac {12 d^{2} \left (d x +c \right )^{2} \sin \left (b x +a \right )}{b^{3}}-\frac {\left (d x +c \right )^{4} \sin \left (b x +a \right )}{b} \]
command
integrate((d*x+c)^4*cos(b*x+a)*cot(b*x+a)^2,x, algorithm="maxima")
Maxima 5.46 SBCL 2.0.1.debian via sagemath 9.6 output
\[ \text {output too large to display} \]
Maxima 5.44 via sagemath 9.3 output \[ \text {Timed out} \]_____________________________________________________