\(\int (a+b \log (c x^n))^2 (d+e \log (f (g+h x)^q)) \, dx\) [412]

Optimal result
Mathematica [B] (verified)
Rubi [F]
Maple [C] (warning: unable to verify)
Fricas [F]
Sympy [F(-1)]
Maxima [F]
Giac [F]
Mupad [F(-1)]
Reduce [F]

Optimal result

Integrand size = 27, antiderivative size = 278 \[ \int \left (a+b \log \left (c x^n\right )\right )^2 \left (d+e \log \left (f (g+h x)^q\right )\right ) \, dx=2 b^2 d n^2 x+4 a b e n q x-6 b^2 e n^2 q x+4 b^2 e n q x \log \left (c x^n\right )-e q x \left (a+b \log \left (c x^n\right )\right )^2+\frac {2 b^2 e n^2 (g+h x) \log \left (f (g+h x)^q\right )}{h}-2 b n x \left (a+b \log \left (c x^n\right )\right ) \left (d+e \log \left (f (g+h x)^q\right )\right )+x \left (a+b \log \left (c x^n\right )\right )^2 \left (d+e \log \left (f (g+h x)^q\right )\right )-\frac {2 b e g n q \left (a+b \log \left (c x^n\right )\right ) \log \left (1+\frac {h x}{g}\right )}{h}+\frac {e g q \left (a+b \log \left (c x^n\right )\right )^2 \log \left (1+\frac {h x}{g}\right )}{h}-\frac {2 b^2 e g n^2 q \operatorname {PolyLog}\left (2,-\frac {h x}{g}\right )}{h}+\frac {2 b e g n q \left (a+b \log \left (c x^n\right )\right ) \operatorname {PolyLog}\left (2,-\frac {h x}{g}\right )}{h}-\frac {2 b^2 e g n^2 q \operatorname {PolyLog}\left (3,-\frac {h x}{g}\right )}{h} \] Output:

2*b^2*d*n^2*x+4*a*b*e*n*q*x-6*b^2*e*n^2*q*x+4*b^2*e*n*q*x*ln(c*x^n)-e*q*x* 
(a+b*ln(c*x^n))^2+2*b^2*e*n^2*(h*x+g)*ln(f*(h*x+g)^q)/h-2*b*n*x*(a+b*ln(c* 
x^n))*(d+e*ln(f*(h*x+g)^q))+x*(a+b*ln(c*x^n))^2*(d+e*ln(f*(h*x+g)^q))-2*b* 
e*g*n*q*(a+b*ln(c*x^n))*ln(1+h*x/g)/h+e*g*q*(a+b*ln(c*x^n))^2*ln(1+h*x/g)/ 
h-2*b^2*e*g*n^2*q*polylog(2,-h*x/g)/h+2*b*e*g*n*q*(a+b*ln(c*x^n))*polylog( 
2,-h*x/g)/h-2*b^2*e*g*n^2*q*polylog(3,-h*x/g)/h
 

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(604\) vs. \(2(278)=556\).

Time = 0.29 (sec) , antiderivative size = 604, normalized size of antiderivative = 2.17 \[ \int \left (a+b \log \left (c x^n\right )\right )^2 \left (d+e \log \left (f (g+h x)^q\right )\right ) \, dx=\frac {a^2 d h x-2 a b d h n x+2 b^2 d h n^2 x-a^2 e h q x+4 a b e h n q x-6 b^2 e h n^2 q x+2 a b d h x \log \left (c x^n\right )-2 b^2 d h n x \log \left (c x^n\right )-2 a b e h q x \log \left (c x^n\right )+4 b^2 e h n q x \log \left (c x^n\right )+b^2 d h x \log ^2\left (c x^n\right )-b^2 e h q x \log ^2\left (c x^n\right )+a^2 e g q \log (g+h x)-2 a b e g n q \log (g+h x)+2 b^2 e g n^2 q \log (g+h x)-2 a b e g n q \log (x) \log (g+h x)+2 b^2 e g n^2 q \log (x) \log (g+h x)+b^2 e g n^2 q \log ^2(x) \log (g+h x)+2 a b e g q \log \left (c x^n\right ) \log (g+h x)-2 b^2 e g n q \log \left (c x^n\right ) \log (g+h x)-2 b^2 e g n q \log (x) \log \left (c x^n\right ) \log (g+h x)+b^2 e g q \log ^2\left (c x^n\right ) \log (g+h x)+a^2 e h x \log \left (f (g+h x)^q\right )-2 a b e h n x \log \left (f (g+h x)^q\right )+2 b^2 e h n^2 x \log \left (f (g+h x)^q\right )+2 a b e h x \log \left (c x^n\right ) \log \left (f (g+h x)^q\right )-2 b^2 e h n x \log \left (c x^n\right ) \log \left (f (g+h x)^q\right )+b^2 e h x \log ^2\left (c x^n\right ) \log \left (f (g+h x)^q\right )+2 a b e g n q \log (x) \log \left (1+\frac {h x}{g}\right )-2 b^2 e g n^2 q \log (x) \log \left (1+\frac {h x}{g}\right )-b^2 e g n^2 q \log ^2(x) \log \left (1+\frac {h x}{g}\right )+2 b^2 e g n q \log (x) \log \left (c x^n\right ) \log \left (1+\frac {h x}{g}\right )+2 b e g n q \left (a-b n+b \log \left (c x^n\right )\right ) \operatorname {PolyLog}\left (2,-\frac {h x}{g}\right )-2 b^2 e g n^2 q \operatorname {PolyLog}\left (3,-\frac {h x}{g}\right )}{h} \] Input:

Integrate[(a + b*Log[c*x^n])^2*(d + e*Log[f*(g + h*x)^q]),x]
 

Output:

(a^2*d*h*x - 2*a*b*d*h*n*x + 2*b^2*d*h*n^2*x - a^2*e*h*q*x + 4*a*b*e*h*n*q 
*x - 6*b^2*e*h*n^2*q*x + 2*a*b*d*h*x*Log[c*x^n] - 2*b^2*d*h*n*x*Log[c*x^n] 
 - 2*a*b*e*h*q*x*Log[c*x^n] + 4*b^2*e*h*n*q*x*Log[c*x^n] + b^2*d*h*x*Log[c 
*x^n]^2 - b^2*e*h*q*x*Log[c*x^n]^2 + a^2*e*g*q*Log[g + h*x] - 2*a*b*e*g*n* 
q*Log[g + h*x] + 2*b^2*e*g*n^2*q*Log[g + h*x] - 2*a*b*e*g*n*q*Log[x]*Log[g 
 + h*x] + 2*b^2*e*g*n^2*q*Log[x]*Log[g + h*x] + b^2*e*g*n^2*q*Log[x]^2*Log 
[g + h*x] + 2*a*b*e*g*q*Log[c*x^n]*Log[g + h*x] - 2*b^2*e*g*n*q*Log[c*x^n] 
*Log[g + h*x] - 2*b^2*e*g*n*q*Log[x]*Log[c*x^n]*Log[g + h*x] + b^2*e*g*q*L 
og[c*x^n]^2*Log[g + h*x] + a^2*e*h*x*Log[f*(g + h*x)^q] - 2*a*b*e*h*n*x*Lo 
g[f*(g + h*x)^q] + 2*b^2*e*h*n^2*x*Log[f*(g + h*x)^q] + 2*a*b*e*h*x*Log[c* 
x^n]*Log[f*(g + h*x)^q] - 2*b^2*e*h*n*x*Log[c*x^n]*Log[f*(g + h*x)^q] + b^ 
2*e*h*x*Log[c*x^n]^2*Log[f*(g + h*x)^q] + 2*a*b*e*g*n*q*Log[x]*Log[1 + (h* 
x)/g] - 2*b^2*e*g*n^2*q*Log[x]*Log[1 + (h*x)/g] - b^2*e*g*n^2*q*Log[x]^2*L 
og[1 + (h*x)/g] + 2*b^2*e*g*n*q*Log[x]*Log[c*x^n]*Log[1 + (h*x)/g] + 2*b*e 
*g*n*q*(a - b*n + b*Log[c*x^n])*PolyLog[2, -((h*x)/g)] - 2*b^2*e*g*n^2*q*P 
olyLog[3, -((h*x)/g)])/h
 

Rubi [F]

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \left (a+b \log \left (c x^n\right )\right )^2 \left (d+e \log \left (f (g+h x)^q\right )\right ) \, dx\)

\(\Big \downarrow \) 2880

\(\displaystyle \int \left (a+b \log \left (c x^n\right )\right )^2 \left (d+e \log \left (f (g+h x)^q\right )\right )dx\)

Input:

Int[(a + b*Log[c*x^n])^2*(d + e*Log[f*(g + h*x)^q]),x]
 

Output:

$Aborted
 

Defintions of rubi rules used

rule 2880
Int[((a_.) + Log[(c_.)*((d_) + (e_.)*(x_))^(n_.)]*(b_.))^(p_.)*((f_.) + Log 
[(h_.)*((i_.) + (j_.)*(x_))^(m_.)]*(g_.))^(q_.), x_Symbol] :> Unintegrable[ 
(a + b*Log[c*(d + e*x)^n])^p*(f + g*Log[h*(i + j*x)^m])^q, x] /; FreeQ[{a, 
b, c, d, e, f, g, h, i, j, m, n, p}, x]
 
Maple [C] (warning: unable to verify)

Result contains higher order function than in optimal. Order 9 vs. order 4.

Time = 107.21 (sec) , antiderivative size = 3820, normalized size of antiderivative = 13.74

method result size
risch \(\text {Expression too large to display}\) \(3820\)

Input:

int((a+b*ln(c*x^n))^2*(d+e*ln(f*(h*x+g)^q)),x,method=_RETURNVERBOSE)
 

Output:

(x*b^2*e*ln(x^n)^2+x*b*e*(I*Pi*b*csgn(I*x^n)*csgn(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I*c)+4*I*Pi*b^2*n*csgn(I*x^n)*csgn(I*c*x^ 
n)*csgn(I*c)))*ln((h*x+g)^q)-q*e*b^2*ln(x^n)^2*x-2*q*e*x*ln(c)*a*b+a^2*e*q 
/h*g*ln(h*x+g)+2*q/h*b^2*e*n^2*g*dilog(-h*x/g)+2*q/h*e*g*ln(h*x+g)*b^2*n^2 
+q/h*e*b^2*ln(x^n)^2*g*ln(h*x+g)+q/h*e*g*ln(h*x+g)*ln(c)^2*b^2+(1/8*I*e*Pi 
*csgn(I*(h*x+g)^q)*csgn(I*f*(h*x+g)^q)^2-1/8*I*e*Pi*csgn(I*(h*x+g)^q)*csgn 
(I*f*(h*x+g)^q)*csgn(I*f)-1/8*I*e*Pi*csgn(I*f*(h*x+g)^q)^3+1/8*I*e*Pi*c...
 

Fricas [F]

\[ \int \left (a+b \log \left (c x^n\right )\right )^2 \left (d+e \log \left (f (g+h x)^q\right )\right ) \, dx=\int { {\left (e \log \left ({\left (h x + g\right )}^{q} f\right ) + d\right )} {\left (b \log \left (c x^{n}\right ) + a\right )}^{2} \,d x } \] Input:

integrate((a+b*log(c*x^n))^2*(d+e*log(f*(h*x+g)^q)),x, algorithm="fricas")
 

Output:

integral(b^2*d*log(c*x^n)^2 + 2*a*b*d*log(c*x^n) + a^2*d + (b^2*e*log(c*x^ 
n)^2 + 2*a*b*e*log(c*x^n) + a^2*e)*log((h*x + g)^q*f), x)
 

Sympy [F(-1)]

Timed out. \[ \int \left (a+b \log \left (c x^n\right )\right )^2 \left (d+e \log \left (f (g+h x)^q\right )\right ) \, dx=\text {Timed out} \] Input:

integrate((a+b*ln(c*x**n))**2*(d+e*ln(f*(h*x+g)**q)),x)
 

Output:

Timed out
                                                                                    
                                                                                    
 

Maxima [F]

\[ \int \left (a+b \log \left (c x^n\right )\right )^2 \left (d+e \log \left (f (g+h x)^q\right )\right ) \, dx=\int { {\left (e \log \left ({\left (h x + g\right )}^{q} f\right ) + d\right )} {\left (b \log \left (c x^{n}\right ) + a\right )}^{2} \,d x } \] Input:

integrate((a+b*log(c*x^n))^2*(d+e*log(f*(h*x+g)^q)),x, algorithm="maxima")
 

Output:

-a^2*e*h*q*(x/h - g*log(h*x + g)/h^2) + b^2*d*x*log(c*x^n)^2 - 2*a*b*d*n*x 
 + a^2*e*x*log((h*x + g)^q*f) + 2*a*b*d*x*log(c*x^n) + 2*(n^2*x - n*x*log( 
c*x^n))*b^2*d + a^2*d*x + ((b^2*e*g*q*log(h*x + g) - (h*q - h*log(f))*b^2* 
e*x)*log(x^n)^2 + (b^2*e*h*x*log(x^n)^2 + 2*(a*b*e*h - (e*h*n - e*h*log(c) 
)*b^2)*x*log(x^n) - (2*(e*h*n - e*h*log(c))*a*b - (2*e*h*n^2 - 2*e*h*n*log 
(c) + e*h*log(c)^2)*b^2)*x)*log((h*x + g)^q))/h - integrate(-((2*(e*h^2*n* 
q - (h^2*q - h^2*log(f))*e*log(c))*a*b - (2*e*h^2*n^2*q - 2*e*h^2*n*q*log( 
c) + (h^2*q - h^2*log(f))*e*log(c)^2)*b^2)*x^2 + (b^2*e*g*h*log(c)^2*log(f 
) + 2*a*b*e*g*h*log(c)*log(f))*x - 2*(((h^2*q - h^2*log(f))*a*b*e + ((h^2* 
q - h^2*log(f))*e*log(c) - (2*h^2*n*q - h^2*n*log(f))*e)*b^2)*x^2 - (a*b*e 
*g*h*log(f) + (e*g*h*log(c)*log(f) + (g*h*n*q - g*h*n*log(f))*e)*b^2)*x + 
(b^2*e*g*h*n*q*x + b^2*e*g^2*n*q)*log(h*x + g))*log(x^n))/(h^2*x^2 + g*h*x 
), x)
 

Giac [F]

\[ \int \left (a+b \log \left (c x^n\right )\right )^2 \left (d+e \log \left (f (g+h x)^q\right )\right ) \, dx=\int { {\left (e \log \left ({\left (h x + g\right )}^{q} f\right ) + d\right )} {\left (b \log \left (c x^{n}\right ) + a\right )}^{2} \,d x } \] Input:

integrate((a+b*log(c*x^n))^2*(d+e*log(f*(h*x+g)^q)),x, algorithm="giac")
 

Output:

integrate((e*log((h*x + g)^q*f) + d)*(b*log(c*x^n) + a)^2, x)
 

Mupad [F(-1)]

Timed out. \[ \int \left (a+b \log \left (c x^n\right )\right )^2 \left (d+e \log \left (f (g+h x)^q\right )\right ) \, dx=\int \left (d+e\,\ln \left (f\,{\left (g+h\,x\right )}^q\right )\right )\,{\left (a+b\,\ln \left (c\,x^n\right )\right )}^2 \,d x \] Input:

int((d + e*log(f*(g + h*x)^q))*(a + b*log(c*x^n))^2,x)
 

Output:

int((d + e*log(f*(g + h*x)^q))*(a + b*log(c*x^n))^2, x)
 

Reduce [F]

\[ \int \left (a+b \log \left (c x^n\right )\right )^2 \left (d+e \log \left (f (g+h x)^q\right )\right ) \, dx=\frac {-6 \left (\int \frac {\mathrm {log}\left (x^{n} c \right )}{h \,x^{2}+g x}d x \right ) a b e \,g^{2} n q +6 \,\mathrm {log}\left (\left (h x +g \right )^{q} f \right ) \mathrm {log}\left (x^{n} c \right ) a b e h n x -6 \,\mathrm {log}\left (x^{n} c \right ) a b e h n q x +3 \,\mathrm {log}\left (\left (h x +g \right )^{q} f \right ) \mathrm {log}\left (x^{n} c \right )^{2} b^{2} e h n x -6 \,\mathrm {log}\left (\left (h x +g \right )^{q} f \right ) \mathrm {log}\left (x^{n} c \right ) b^{2} e h \,n^{2} x -6 \,\mathrm {log}\left (\left (h x +g \right )^{q} f \right ) a b e h \,n^{2} x -3 \mathrm {log}\left (x^{n} c \right )^{2} b^{2} e h n q x +6 \,\mathrm {log}\left (x^{n} c \right ) a b d h n x +12 \,\mathrm {log}\left (x^{n} c \right ) b^{2} e h \,n^{2} q x +12 a b e h \,n^{2} q x +\mathrm {log}\left (x^{n} c \right )^{3} b^{2} e g q +3 \,\mathrm {log}\left (\left (h x +g \right )^{q} f \right ) a^{2} e h n x -6 \,\mathrm {log}\left (\left (h x +g \right )^{q} f \right ) a b e g \,n^{2}+6 \,\mathrm {log}\left (\left (h x +g \right )^{q} f \right ) b^{2} e h \,n^{3} x +3 \mathrm {log}\left (x^{n} c \right )^{2} a b e g q +3 \mathrm {log}\left (x^{n} c \right )^{2} b^{2} d h n x -3 \mathrm {log}\left (x^{n} c \right )^{2} b^{2} e g n q -6 \,\mathrm {log}\left (x^{n} c \right ) b^{2} d h \,n^{2} x -3 a^{2} e h n q x -6 a b d h \,n^{2} x -18 b^{2} e h \,n^{3} q x -3 \left (\int \frac {\mathrm {log}\left (x^{n} c \right )^{2}}{h \,x^{2}+g x}d x \right ) b^{2} e \,g^{2} n q +6 \left (\int \frac {\mathrm {log}\left (x^{n} c \right )}{h \,x^{2}+g x}d x \right ) b^{2} e \,g^{2} n^{2} q +3 \,\mathrm {log}\left (\left (h x +g \right )^{q} f \right ) a^{2} e g n +6 \,\mathrm {log}\left (\left (h x +g \right )^{q} f \right ) b^{2} e g \,n^{3}+3 a^{2} d h n x +6 b^{2} d h \,n^{3} x}{3 h n} \] Input:

int((a+b*log(c*x^n))^2*(d+e*log(f*(h*x+g)^q)),x)
 

Output:

( - 3*int(log(x**n*c)**2/(g*x + h*x**2),x)*b**2*e*g**2*n*q - 6*int(log(x** 
n*c)/(g*x + h*x**2),x)*a*b*e*g**2*n*q + 6*int(log(x**n*c)/(g*x + h*x**2),x 
)*b**2*e*g**2*n**2*q + 3*log((g + h*x)**q*f)*log(x**n*c)**2*b**2*e*h*n*x + 
 6*log((g + h*x)**q*f)*log(x**n*c)*a*b*e*h*n*x - 6*log((g + h*x)**q*f)*log 
(x**n*c)*b**2*e*h*n**2*x + 3*log((g + h*x)**q*f)*a**2*e*g*n + 3*log((g + h 
*x)**q*f)*a**2*e*h*n*x - 6*log((g + h*x)**q*f)*a*b*e*g*n**2 - 6*log((g + h 
*x)**q*f)*a*b*e*h*n**2*x + 6*log((g + h*x)**q*f)*b**2*e*g*n**3 + 6*log((g 
+ h*x)**q*f)*b**2*e*h*n**3*x + log(x**n*c)**3*b**2*e*g*q + 3*log(x**n*c)** 
2*a*b*e*g*q + 3*log(x**n*c)**2*b**2*d*h*n*x - 3*log(x**n*c)**2*b**2*e*g*n* 
q - 3*log(x**n*c)**2*b**2*e*h*n*q*x + 6*log(x**n*c)*a*b*d*h*n*x - 6*log(x* 
*n*c)*a*b*e*h*n*q*x - 6*log(x**n*c)*b**2*d*h*n**2*x + 12*log(x**n*c)*b**2* 
e*h*n**2*q*x + 3*a**2*d*h*n*x - 3*a**2*e*h*n*q*x - 6*a*b*d*h*n**2*x + 12*a 
*b*e*h*n**2*q*x + 6*b**2*d*h*n**3*x - 18*b**2*e*h*n**3*q*x)/(3*h*n)