\[ \int \frac {a d n x^m-a d m x^m \log \left (c x^n\right )-b d n (-1+q) \log ^q\left (c x^n\right )}{x \left (a x^m+b \log ^q\left (c x^n\right )\right )^2} \, dx \]
Optimal antiderivative \[ \frac {d \ln \left (c \,x^{n}\right )}{a \,x^{m}+b \ln \left (c \,x^{n}\right )^{q}} \]
command
integrate((a*d*n*x**m-a*d*m*x**m*ln(c*x**n)-b*d*n*(-1+q)*ln(c*x**n)**q)/x/(a*x**m+b*ln(c*x**n)**q)**2,x)
Sympy 1.10.1 under Python 3.10.4 output
\[ \frac {d \log {\left (c x^{n} \right )}}{a x^{m} + b \log {\left (c x^{n} \right )}^{q}} \]
Sympy 1.8 under Python 3.8.8 output
\[ \text {Timed out} \]________________________________________________________________________________________