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

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [B] (verified)
Fricas [B] (verification not implemented)
Sympy [B] (verification not implemented)
Maxima [A] (verification not implemented)
Giac [B] (verification not implemented)
Mupad [B] (verification not implemented)
Reduce [B] (verification not implemented)

Optimal result

Integrand size = 26, antiderivative size = 128 \[ \int (g+h x)^2 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right ) \, dx=-\frac {b (f g-e h)^2 p q x}{3 f^2}-\frac {b (f g-e h) p q (g+h x)^2}{6 f h}-\frac {b p q (g+h x)^3}{9 h}-\frac {b (f g-e h)^3 p q \log (e+f x)}{3 f^3 h}+\frac {(g+h x)^3 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right )}{3 h} \] Output:

-1/3*b*(-e*h+f*g)^2*p*q*x/f^2-1/6*b*(-e*h+f*g)*p*q*(h*x+g)^2/f/h-1/9*b*p*q 
*(h*x+g)^3/h-1/3*b*(-e*h+f*g)^3*p*q*ln(f*x+e)/f^3/h+1/3*(h*x+g)^3*(a+b*ln( 
c*(d*(f*x+e)^p)^q))/h
 

Mathematica [A] (verified)

Time = 0.20 (sec) , antiderivative size = 156, normalized size of antiderivative = 1.22 \[ \int (g+h x)^2 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right ) \, dx=\frac {6 b e^2 h (-3 f g+e h) p q \log (e+f x)+f \left (x \left (6 a f^2 \left (3 g^2+3 g h x+h^2 x^2\right )-b p q \left (6 e^2 h^2-3 e f h (6 g+h x)+f^2 \left (18 g^2+9 g h x+2 h^2 x^2\right )\right )\right )+6 b f \left (3 e g^2+f x \left (3 g^2+3 g h x+h^2 x^2\right )\right ) \log \left (c \left (d (e+f x)^p\right )^q\right )\right )}{18 f^3} \] Input:

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

Output:

(6*b*e^2*h*(-3*f*g + e*h)*p*q*Log[e + f*x] + f*(x*(6*a*f^2*(3*g^2 + 3*g*h* 
x + h^2*x^2) - b*p*q*(6*e^2*h^2 - 3*e*f*h*(6*g + h*x) + f^2*(18*g^2 + 9*g* 
h*x + 2*h^2*x^2))) + 6*b*f*(3*e*g^2 + f*x*(3*g^2 + 3*g*h*x + h^2*x^2))*Log 
[c*(d*(e + f*x)^p)^q]))/(18*f^3)
 

Rubi [A] (verified)

Time = 0.66 (sec) , antiderivative size = 117, normalized size of antiderivative = 0.91, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.154, Rules used = {2895, 2842, 49, 2009}

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 (g+h x)^2 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right ) \, dx\)

\(\Big \downarrow \) 2895

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

\(\Big \downarrow \) 2842

\(\displaystyle \frac {(g+h x)^3 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right )}{3 h}-\frac {b f p q \int \frac {(g+h x)^3}{e+f x}dx}{3 h}\)

\(\Big \downarrow \) 49

\(\displaystyle \frac {(g+h x)^3 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right )}{3 h}-\frac {b f p q \int \left (\frac {(f g-e h)^3}{f^3 (e+f x)}+\frac {h (f g-e h)^2}{f^3}+\frac {h (g+h x) (f g-e h)}{f^2}+\frac {h (g+h x)^2}{f}\right )dx}{3 h}\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {(g+h x)^3 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right )}{3 h}-\frac {b f p q \left (\frac {(f g-e h)^3 \log (e+f x)}{f^4}+\frac {h x (f g-e h)^2}{f^3}+\frac {(g+h x)^2 (f g-e h)}{2 f^2}+\frac {(g+h x)^3}{3 f}\right )}{3 h}\)

Input:

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

Output:

-1/3*(b*f*p*q*((h*(f*g - e*h)^2*x)/f^3 + ((f*g - e*h)*(g + h*x)^2)/(2*f^2) 
 + (g + h*x)^3/(3*f) + ((f*g - e*h)^3*Log[e + f*x])/f^4))/h + ((g + h*x)^3 
*(a + b*Log[c*(d*(e + f*x)^p)^q]))/(3*h)
 

Defintions of rubi rules used

rule 49
Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int 
[ExpandIntegrand[(a + b*x)^m*(c + d*x)^n, x], x] /; FreeQ[{a, b, c, d}, x] 
&& IGtQ[m, 0] && IGtQ[m + n + 2, 0]
 

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 2842
Int[((a_.) + Log[(c_.)*((d_) + (e_.)*(x_))^(n_.)]*(b_.))*((f_.) + (g_.)*(x_ 
))^(q_.), x_Symbol] :> Simp[(f + g*x)^(q + 1)*((a + b*Log[c*(d + e*x)^n])/( 
g*(q + 1))), x] - Simp[b*e*(n/(g*(q + 1)))   Int[(f + g*x)^(q + 1)/(d + e*x 
), x], x] /; FreeQ[{a, b, c, d, e, f, g, n, q}, x] && NeQ[e*f - d*g, 0] && 
NeQ[q, -1]
 

rule 2895
Int[((a_.) + Log[(c_.)*((d_.)*((e_.) + (f_.)*(x_))^(m_.))^(n_)]*(b_.))^(p_. 
)*(u_.), x_Symbol] :> Subst[Int[u*(a + b*Log[c*d^n*(e + f*x)^(m*n)])^p, x], 
 c*d^n*(e + f*x)^(m*n), c*(d*(e + f*x)^m)^n] /; FreeQ[{a, b, c, d, e, f, m, 
 n, p}, x] &&  !IntegerQ[n] &&  !(EqQ[d, 1] && EqQ[m, 1]) && IntegralFreeQ[ 
IntHide[u*(a + b*Log[c*d^n*(e + f*x)^(m*n)])^p, x]]
 
Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(289\) vs. \(2(118)=236\).

Time = 2.25 (sec) , antiderivative size = 290, normalized size of antiderivative = 2.27

method result size
parallelrisch \(\frac {-2 x^{3} b e \,f^{3} h^{2} p q +6 x^{3} \ln \left (c \left (d \left (f x +e \right )^{p}\right )^{q}\right ) b e \,f^{3} h^{2}+3 x^{2} b \,e^{2} f^{2} h^{2} p q -9 x^{2} b e \,f^{3} g h p q +6 \ln \left (f x +e \right ) b \,e^{4} h^{2} p q -18 \ln \left (f x +e \right ) b \,e^{3} f g h p q +36 \ln \left (f x +e \right ) b \,e^{2} f^{2} g^{2} p q +6 x^{3} a e \,f^{3} h^{2}+18 x^{2} \ln \left (c \left (d \left (f x +e \right )^{p}\right )^{q}\right ) b e \,f^{3} g h -6 x b \,e^{3} f \,h^{2} p q +18 x b \,e^{2} f^{2} g h p q -18 x b e \,f^{3} g^{2} p q +18 x^{2} a e \,f^{3} g h +18 x \ln \left (c \left (d \left (f x +e \right )^{p}\right )^{q}\right ) b e \,f^{3} g^{2}+18 x a e \,f^{3} g^{2}-18 \ln \left (c \left (d \left (f x +e \right )^{p}\right )^{q}\right ) b \,e^{2} f^{2} g^{2}}{18 f^{3} e}\) \(290\)

Input:

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

Output:

1/18*(-2*x^3*b*e*f^3*h^2*p*q+6*x^3*ln(c*(d*(f*x+e)^p)^q)*b*e*f^3*h^2+3*x^2 
*b*e^2*f^2*h^2*p*q-9*x^2*b*e*f^3*g*h*p*q+6*ln(f*x+e)*b*e^4*h^2*p*q-18*ln(f 
*x+e)*b*e^3*f*g*h*p*q+36*ln(f*x+e)*b*e^2*f^2*g^2*p*q+6*x^3*a*e*f^3*h^2+18* 
x^2*ln(c*(d*(f*x+e)^p)^q)*b*e*f^3*g*h-6*x*b*e^3*f*h^2*p*q+18*x*b*e^2*f^2*g 
*h*p*q-18*x*b*e*f^3*g^2*p*q+18*x^2*a*e*f^3*g*h+18*x*ln(c*(d*(f*x+e)^p)^q)* 
b*e*f^3*g^2+18*x*a*e*f^3*g^2-18*ln(c*(d*(f*x+e)^p)^q)*b*e^2*f^2*g^2)/f^3/e
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 268 vs. \(2 (118) = 236\).

Time = 0.09 (sec) , antiderivative size = 268, normalized size of antiderivative = 2.09 \[ \int (g+h x)^2 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right ) \, dx=-\frac {2 \, {\left (b f^{3} h^{2} p q - 3 \, a f^{3} h^{2}\right )} x^{3} - 3 \, {\left (6 \, a f^{3} g h - {\left (3 \, b f^{3} g h - b e f^{2} h^{2}\right )} p q\right )} x^{2} - 6 \, {\left (3 \, a f^{3} g^{2} - {\left (3 \, b f^{3} g^{2} - 3 \, b e f^{2} g h + b e^{2} f h^{2}\right )} p q\right )} x - 6 \, {\left (b f^{3} h^{2} p q x^{3} + 3 \, b f^{3} g h p q x^{2} + 3 \, b f^{3} g^{2} p q x + {\left (3 \, b e f^{2} g^{2} - 3 \, b e^{2} f g h + b e^{3} h^{2}\right )} p q\right )} \log \left (f x + e\right ) - 6 \, {\left (b f^{3} h^{2} x^{3} + 3 \, b f^{3} g h x^{2} + 3 \, b f^{3} g^{2} x\right )} \log \left (c\right ) - 6 \, {\left (b f^{3} h^{2} q x^{3} + 3 \, b f^{3} g h q x^{2} + 3 \, b f^{3} g^{2} q x\right )} \log \left (d\right )}{18 \, f^{3}} \] Input:

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

Output:

-1/18*(2*(b*f^3*h^2*p*q - 3*a*f^3*h^2)*x^3 - 3*(6*a*f^3*g*h - (3*b*f^3*g*h 
 - b*e*f^2*h^2)*p*q)*x^2 - 6*(3*a*f^3*g^2 - (3*b*f^3*g^2 - 3*b*e*f^2*g*h + 
 b*e^2*f*h^2)*p*q)*x - 6*(b*f^3*h^2*p*q*x^3 + 3*b*f^3*g*h*p*q*x^2 + 3*b*f^ 
3*g^2*p*q*x + (3*b*e*f^2*g^2 - 3*b*e^2*f*g*h + b*e^3*h^2)*p*q)*log(f*x + e 
) - 6*(b*f^3*h^2*x^3 + 3*b*f^3*g*h*x^2 + 3*b*f^3*g^2*x)*log(c) - 6*(b*f^3* 
h^2*q*x^3 + 3*b*f^3*g*h*q*x^2 + 3*b*f^3*g^2*q*x)*log(d))/f^3
 

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 286 vs. \(2 (112) = 224\).

Time = 1.35 (sec) , antiderivative size = 286, normalized size of antiderivative = 2.23 \[ \int (g+h x)^2 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right ) \, dx=\begin {cases} a g^{2} x + a g h x^{2} + \frac {a h^{2} x^{3}}{3} + \frac {b e^{3} h^{2} \log {\left (c \left (d \left (e + f x\right )^{p}\right )^{q} \right )}}{3 f^{3}} - \frac {b e^{2} g h \log {\left (c \left (d \left (e + f x\right )^{p}\right )^{q} \right )}}{f^{2}} - \frac {b e^{2} h^{2} p q x}{3 f^{2}} + \frac {b e g^{2} \log {\left (c \left (d \left (e + f x\right )^{p}\right )^{q} \right )}}{f} + \frac {b e g h p q x}{f} + \frac {b e h^{2} p q x^{2}}{6 f} - b g^{2} p q x + b g^{2} x \log {\left (c \left (d \left (e + f x\right )^{p}\right )^{q} \right )} - \frac {b g h p q x^{2}}{2} + b g h x^{2} \log {\left (c \left (d \left (e + f x\right )^{p}\right )^{q} \right )} - \frac {b h^{2} p q x^{3}}{9} + \frac {b h^{2} x^{3} \log {\left (c \left (d \left (e + f x\right )^{p}\right )^{q} \right )}}{3} & \text {for}\: f \neq 0 \\\left (a + b \log {\left (c \left (d e^{p}\right )^{q} \right )}\right ) \left (g^{2} x + g h x^{2} + \frac {h^{2} x^{3}}{3}\right ) & \text {otherwise} \end {cases} \] Input:

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

Output:

Piecewise((a*g**2*x + a*g*h*x**2 + a*h**2*x**3/3 + b*e**3*h**2*log(c*(d*(e 
 + f*x)**p)**q)/(3*f**3) - b*e**2*g*h*log(c*(d*(e + f*x)**p)**q)/f**2 - b* 
e**2*h**2*p*q*x/(3*f**2) + b*e*g**2*log(c*(d*(e + f*x)**p)**q)/f + b*e*g*h 
*p*q*x/f + b*e*h**2*p*q*x**2/(6*f) - b*g**2*p*q*x + b*g**2*x*log(c*(d*(e + 
 f*x)**p)**q) - b*g*h*p*q*x**2/2 + b*g*h*x**2*log(c*(d*(e + f*x)**p)**q) - 
 b*h**2*p*q*x**3/9 + b*h**2*x**3*log(c*(d*(e + f*x)**p)**q)/3, Ne(f, 0)), 
((a + b*log(c*(d*e**p)**q))*(g**2*x + g*h*x**2 + h**2*x**3/3), True))
 

Maxima [A] (verification not implemented)

Time = 0.04 (sec) , antiderivative size = 202, normalized size of antiderivative = 1.58 \[ \int (g+h x)^2 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right ) \, dx=-b f g^{2} p q {\left (\frac {x}{f} - \frac {e \log \left (f x + e\right )}{f^{2}}\right )} + \frac {1}{18} \, b f h^{2} p q {\left (\frac {6 \, e^{3} \log \left (f x + e\right )}{f^{4}} - \frac {2 \, f^{2} x^{3} - 3 \, e f x^{2} + 6 \, e^{2} x}{f^{3}}\right )} - \frac {1}{2} \, b f g h p q {\left (\frac {2 \, e^{2} \log \left (f x + e\right )}{f^{3}} + \frac {f x^{2} - 2 \, e x}{f^{2}}\right )} + \frac {1}{3} \, b h^{2} x^{3} \log \left (\left ({\left (f x + e\right )}^{p} d\right )^{q} c\right ) + \frac {1}{3} \, a h^{2} x^{3} + b g h x^{2} \log \left (\left ({\left (f x + e\right )}^{p} d\right )^{q} c\right ) + a g h x^{2} + b g^{2} x \log \left (\left ({\left (f x + e\right )}^{p} d\right )^{q} c\right ) + a g^{2} x \] Input:

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

Output:

-b*f*g^2*p*q*(x/f - e*log(f*x + e)/f^2) + 1/18*b*f*h^2*p*q*(6*e^3*log(f*x 
+ e)/f^4 - (2*f^2*x^3 - 3*e*f*x^2 + 6*e^2*x)/f^3) - 1/2*b*f*g*h*p*q*(2*e^2 
*log(f*x + e)/f^3 + (f*x^2 - 2*e*x)/f^2) + 1/3*b*h^2*x^3*log(((f*x + e)^p* 
d)^q*c) + 1/3*a*h^2*x^3 + b*g*h*x^2*log(((f*x + e)^p*d)^q*c) + a*g*h*x^2 + 
 b*g^2*x*log(((f*x + e)^p*d)^q*c) + a*g^2*x
 

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 544 vs. \(2 (118) = 236\).

Time = 0.13 (sec) , antiderivative size = 544, normalized size of antiderivative = 4.25 \[ \int (g+h x)^2 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right ) \, dx=\frac {{\left (f x + e\right )} b g^{2} p q \log \left (f x + e\right )}{f} + \frac {{\left (f x + e\right )}^{2} b g h p q \log \left (f x + e\right )}{f^{2}} - \frac {2 \, {\left (f x + e\right )} b e g h p q \log \left (f x + e\right )}{f^{2}} + \frac {{\left (f x + e\right )}^{3} b h^{2} p q \log \left (f x + e\right )}{3 \, f^{3}} - \frac {{\left (f x + e\right )}^{2} b e h^{2} p q \log \left (f x + e\right )}{f^{3}} + \frac {{\left (f x + e\right )} b e^{2} h^{2} p q \log \left (f x + e\right )}{f^{3}} - \frac {{\left (f x + e\right )} b g^{2} p q}{f} - \frac {{\left (f x + e\right )}^{2} b g h p q}{2 \, f^{2}} + \frac {2 \, {\left (f x + e\right )} b e g h p q}{f^{2}} - \frac {{\left (f x + e\right )}^{3} b h^{2} p q}{9 \, f^{3}} + \frac {{\left (f x + e\right )}^{2} b e h^{2} p q}{2 \, f^{3}} - \frac {{\left (f x + e\right )} b e^{2} h^{2} p q}{f^{3}} + \frac {{\left (f x + e\right )} b g^{2} q \log \left (d\right )}{f} + \frac {{\left (f x + e\right )}^{2} b g h q \log \left (d\right )}{f^{2}} - \frac {2 \, {\left (f x + e\right )} b e g h q \log \left (d\right )}{f^{2}} + \frac {{\left (f x + e\right )}^{3} b h^{2} q \log \left (d\right )}{3 \, f^{3}} - \frac {{\left (f x + e\right )}^{2} b e h^{2} q \log \left (d\right )}{f^{3}} + \frac {{\left (f x + e\right )} b e^{2} h^{2} q \log \left (d\right )}{f^{3}} + \frac {{\left (f x + e\right )} b g^{2} \log \left (c\right )}{f} + \frac {{\left (f x + e\right )}^{2} b g h \log \left (c\right )}{f^{2}} - \frac {2 \, {\left (f x + e\right )} b e g h \log \left (c\right )}{f^{2}} + \frac {{\left (f x + e\right )}^{3} b h^{2} \log \left (c\right )}{3 \, f^{3}} - \frac {{\left (f x + e\right )}^{2} b e h^{2} \log \left (c\right )}{f^{3}} + \frac {{\left (f x + e\right )} b e^{2} h^{2} \log \left (c\right )}{f^{3}} + \frac {{\left (f x + e\right )} a g^{2}}{f} + \frac {{\left (f x + e\right )}^{2} a g h}{f^{2}} - \frac {2 \, {\left (f x + e\right )} a e g h}{f^{2}} + \frac {{\left (f x + e\right )}^{3} a h^{2}}{3 \, f^{3}} - \frac {{\left (f x + e\right )}^{2} a e h^{2}}{f^{3}} + \frac {{\left (f x + e\right )} a e^{2} h^{2}}{f^{3}} \] Input:

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

Output:

(f*x + e)*b*g^2*p*q*log(f*x + e)/f + (f*x + e)^2*b*g*h*p*q*log(f*x + e)/f^ 
2 - 2*(f*x + e)*b*e*g*h*p*q*log(f*x + e)/f^2 + 1/3*(f*x + e)^3*b*h^2*p*q*l 
og(f*x + e)/f^3 - (f*x + e)^2*b*e*h^2*p*q*log(f*x + e)/f^3 + (f*x + e)*b*e 
^2*h^2*p*q*log(f*x + e)/f^3 - (f*x + e)*b*g^2*p*q/f - 1/2*(f*x + e)^2*b*g* 
h*p*q/f^2 + 2*(f*x + e)*b*e*g*h*p*q/f^2 - 1/9*(f*x + e)^3*b*h^2*p*q/f^3 + 
1/2*(f*x + e)^2*b*e*h^2*p*q/f^3 - (f*x + e)*b*e^2*h^2*p*q/f^3 + (f*x + e)* 
b*g^2*q*log(d)/f + (f*x + e)^2*b*g*h*q*log(d)/f^2 - 2*(f*x + e)*b*e*g*h*q* 
log(d)/f^2 + 1/3*(f*x + e)^3*b*h^2*q*log(d)/f^3 - (f*x + e)^2*b*e*h^2*q*lo 
g(d)/f^3 + (f*x + e)*b*e^2*h^2*q*log(d)/f^3 + (f*x + e)*b*g^2*log(c)/f + ( 
f*x + e)^2*b*g*h*log(c)/f^2 - 2*(f*x + e)*b*e*g*h*log(c)/f^2 + 1/3*(f*x + 
e)^3*b*h^2*log(c)/f^3 - (f*x + e)^2*b*e*h^2*log(c)/f^3 + (f*x + e)*b*e^2*h 
^2*log(c)/f^3 + (f*x + e)*a*g^2/f + (f*x + e)^2*a*g*h/f^2 - 2*(f*x + e)*a* 
e*g*h/f^2 + 1/3*(f*x + e)^3*a*h^2/f^3 - (f*x + e)^2*a*e*h^2/f^3 + (f*x + e 
)*a*e^2*h^2/f^3
 

Mupad [B] (verification not implemented)

Time = 26.05 (sec) , antiderivative size = 225, normalized size of antiderivative = 1.76 \[ \int (g+h x)^2 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right ) \, dx=\ln \left (c\,{\left (d\,{\left (e+f\,x\right )}^p\right )}^q\right )\,\left (b\,g^2\,x+b\,g\,h\,x^2+\frac {b\,h^2\,x^3}{3}\right )+x^2\,\left (\frac {h\,\left (a\,e\,h+2\,a\,f\,g-b\,f\,g\,p\,q\right )}{2\,f}-\frac {e\,h^2\,\left (3\,a-b\,p\,q\right )}{6\,f}\right )+x\,\left (\frac {3\,a\,f\,g^2+6\,a\,e\,g\,h-3\,b\,f\,g^2\,p\,q}{3\,f}-\frac {e\,\left (\frac {h\,\left (a\,e\,h+2\,a\,f\,g-b\,f\,g\,p\,q\right )}{f}-\frac {e\,h^2\,\left (3\,a-b\,p\,q\right )}{3\,f}\right )}{f}\right )+\frac {\ln \left (e+f\,x\right )\,\left (b\,p\,q\,e^3\,h^2-3\,b\,p\,q\,e^2\,f\,g\,h+3\,b\,p\,q\,e\,f^2\,g^2\right )}{3\,f^3}+\frac {h^2\,x^3\,\left (3\,a-b\,p\,q\right )}{9} \] Input:

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

Output:

log(c*(d*(e + f*x)^p)^q)*((b*h^2*x^3)/3 + b*g^2*x + b*g*h*x^2) + x^2*((h*( 
a*e*h + 2*a*f*g - b*f*g*p*q))/(2*f) - (e*h^2*(3*a - b*p*q))/(6*f)) + x*((3 
*a*f*g^2 + 6*a*e*g*h - 3*b*f*g^2*p*q)/(3*f) - (e*((h*(a*e*h + 2*a*f*g - b* 
f*g*p*q))/f - (e*h^2*(3*a - b*p*q))/(3*f)))/f) + (log(e + f*x)*(b*e^3*h^2* 
p*q + 3*b*e*f^2*g^2*p*q - 3*b*e^2*f*g*h*p*q))/(3*f^3) + (h^2*x^3*(3*a - b* 
p*q))/9
 

Reduce [B] (verification not implemented)

Time = 0.18 (sec) , antiderivative size = 269, normalized size of antiderivative = 2.10 \[ \int (g+h x)^2 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right ) \, dx=\frac {6 \,\mathrm {log}\left (d^{q} \left (f x +e \right )^{p q} c \right ) b \,e^{3} h^{2}-18 \,\mathrm {log}\left (d^{q} \left (f x +e \right )^{p q} c \right ) b \,e^{2} f g h +18 \,\mathrm {log}\left (d^{q} \left (f x +e \right )^{p q} c \right ) b e \,f^{2} g^{2}+18 \,\mathrm {log}\left (d^{q} \left (f x +e \right )^{p q} c \right ) b \,f^{3} g^{2} x +18 \,\mathrm {log}\left (d^{q} \left (f x +e \right )^{p q} c \right ) b \,f^{3} g h \,x^{2}+6 \,\mathrm {log}\left (d^{q} \left (f x +e \right )^{p q} c \right ) b \,f^{3} h^{2} x^{3}+18 a \,f^{3} g^{2} x +18 a \,f^{3} g h \,x^{2}+6 a \,f^{3} h^{2} x^{3}-6 b \,e^{2} f \,h^{2} p q x +18 b e \,f^{2} g h p q x +3 b e \,f^{2} h^{2} p q \,x^{2}-18 b \,f^{3} g^{2} p q x -9 b \,f^{3} g h p q \,x^{2}-2 b \,f^{3} h^{2} p q \,x^{3}}{18 f^{3}} \] Input:

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

Output:

(6*log(d**q*(e + f*x)**(p*q)*c)*b*e**3*h**2 - 18*log(d**q*(e + f*x)**(p*q) 
*c)*b*e**2*f*g*h + 18*log(d**q*(e + f*x)**(p*q)*c)*b*e*f**2*g**2 + 18*log( 
d**q*(e + f*x)**(p*q)*c)*b*f**3*g**2*x + 18*log(d**q*(e + f*x)**(p*q)*c)*b 
*f**3*g*h*x**2 + 6*log(d**q*(e + f*x)**(p*q)*c)*b*f**3*h**2*x**3 + 18*a*f* 
*3*g**2*x + 18*a*f**3*g*h*x**2 + 6*a*f**3*h**2*x**3 - 6*b*e**2*f*h**2*p*q* 
x + 18*b*e*f**2*g*h*p*q*x + 3*b*e*f**2*h**2*p*q*x**2 - 18*b*f**3*g**2*p*q* 
x - 9*b*f**3*g*h*p*q*x**2 - 2*b*f**3*h**2*p*q*x**3)/(18*f**3)