\(\int (f+g x)^2 (A+B \log (e (\frac {a+b x}{c+d x})^n)) \, dx\) [59]

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 = 30, antiderivative size = 157 \[ \int (f+g x)^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \, dx=-\frac {B (b c-a d) g (3 b d f-b c g-a d g) n x}{3 b^2 d^2}-\frac {B (b c-a d) g^2 n x^2}{6 b d}-\frac {B (b f-a g)^3 n \log (a+b x)}{3 b^3 g}+\frac {(f+g x)^3 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )}{3 g}+\frac {B (d f-c g)^3 n \log (c+d x)}{3 d^3 g} \] Output:

-1/3*B*(-a*d+b*c)*g*(-a*d*g-b*c*g+3*b*d*f)*n*x/b^2/d^2-1/6*B*(-a*d+b*c)*g^ 
2*n*x^2/b/d-1/3*B*(-a*g+b*f)^3*n*ln(b*x+a)/b^3/g+1/3*(g*x+f)^3*(A+B*ln(e*( 
(b*x+a)/(d*x+c))^n))/g+1/3*B*(-c*g+d*f)^3*n*ln(d*x+c)/d^3/g
 

Mathematica [A] (verified)

Time = 0.17 (sec) , antiderivative size = 146, normalized size of antiderivative = 0.93 \[ \int (f+g x)^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \, dx=\frac {(f+g x)^3 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )-\frac {B n \left (2 b d (b c-a d) g^2 (3 b d f-b c g-a d g) x+b^2 d^2 (b c-a d) g^3 x^2+2 d^3 (b f-a g)^3 \log (a+b x)-2 b^3 (d f-c g)^3 \log (c+d x)\right )}{2 b^3 d^3}}{3 g} \] Input:

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

Output:

((f + g*x)^3*(A + B*Log[e*((a + b*x)/(c + d*x))^n]) - (B*n*(2*b*d*(b*c - a 
*d)*g^2*(3*b*d*f - b*c*g - a*d*g)*x + b^2*d^2*(b*c - a*d)*g^3*x^2 + 2*d^3* 
(b*f - a*g)^3*Log[a + b*x] - 2*b^3*(d*f - c*g)^3*Log[c + d*x]))/(2*b^3*d^3 
))/(3*g)
 

Rubi [A] (verified)

Time = 0.38 (sec) , antiderivative size = 159, normalized size of antiderivative = 1.01, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.100, Rules used = {2947, 93, 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 (f+g x)^2 \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right ) \, dx\)

\(\Big \downarrow \) 2947

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

\(\Big \downarrow \) 93

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

\(\Big \downarrow \) 2009

\(\displaystyle \frac {(f+g x)^3 \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )}{3 g}-\frac {B n (b c-a d) \left (\frac {(b f-a g)^3 \log (a+b x)}{b^3 (b c-a d)}+\frac {g^2 x (-a d g-b c g+3 b d f)}{b^2 d^2}-\frac {(d f-c g)^3 \log (c+d x)}{d^3 (b c-a d)}+\frac {g^3 x^2}{2 b d}\right )}{3 g}\)

Input:

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

Output:

((f + g*x)^3*(A + B*Log[e*((a + b*x)/(c + d*x))^n]))/(3*g) - (B*(b*c - a*d 
)*n*((g^2*(3*b*d*f - b*c*g - a*d*g)*x)/(b^2*d^2) + (g^3*x^2)/(2*b*d) + ((b 
*f - a*g)^3*Log[a + b*x])/(b^3*(b*c - a*d)) - ((d*f - c*g)^3*Log[c + d*x]) 
/(d^3*(b*c - a*d))))/(3*g)
 

Defintions of rubi rules used

rule 93
Int[((e_.) + (f_.)*(x_))^(p_)/(((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))), 
x_] :> Int[ExpandIntegrand[(e + f*x)^p/((a + b*x)*(c + d*x)), x], x] /; Fre 
eQ[{a, b, c, d, e, f}, x] && IntegerQ[p]
 

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

rule 2947
Int[((A_.) + Log[(e_.)*(((a_.) + (b_.)*(x_))/((c_.) + (d_.)*(x_)))^(n_.)]*( 
B_.))*((f_.) + (g_.)*(x_))^(m_.), x_Symbol] :> Simp[(f + g*x)^(m + 1)*((A + 
 B*Log[e*((a + b*x)/(c + d*x))^n])/(g*(m + 1))), x] - Simp[B*n*((b*c - a*d) 
/(g*(m + 1)))   Int[(f + g*x)^(m + 1)/((a + b*x)*(c + d*x)), x], x] /; Free 
Q[{a, b, c, d, e, f, g, A, B, m, n}, x] && NeQ[b*c - a*d, 0] && NeQ[m, -1] 
&& NeQ[m, -2]
 
Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(616\) vs. \(2(147)=294\).

Time = 1.06 (sec) , antiderivative size = 617, normalized size of antiderivative = 3.93

method result size
parallelrisch \(\frac {-6 B \ln \left (e \left (\frac {b x +a}{d x +c}\right )^{n}\right ) b^{3} c^{2} d f g n +6 B x \ln \left (e \left (\frac {b x +a}{d x +c}\right )^{n}\right ) b^{3} d^{3} f^{2} n +6 B \ln \left (b x +a \right ) a \,b^{2} d^{3} f^{2} n^{2}+2 B \,a^{3} d^{3} g^{2} n^{2}-2 B \,b^{3} c^{3} g^{2} n^{2}-6 B \,a^{2} b \,d^{3} f g \,n^{2}+6 B \,b^{3} c^{2} d f g \,n^{2}+6 B \ln \left (e \left (\frac {b x +a}{d x +c}\right )^{n}\right ) b^{3} c \,d^{2} f^{2} n +6 A \,x^{2} b^{3} d^{3} f g n -6 B \ln \left (b x +a \right ) b^{3} c \,d^{2} f^{2} n^{2}+B \,a^{2} b c \,d^{2} g^{2} n^{2}+2 A \,x^{3} b^{3} d^{3} g^{2} n +2 B \ln \left (e \left (\frac {b x +a}{d x +c}\right )^{n}\right ) b^{3} c^{3} g^{2} n -6 A a \,b^{2} c \,d^{2} f g n +6 B \,x^{2} \ln \left (e \left (\frac {b x +a}{d x +c}\right )^{n}\right ) b^{3} d^{3} f g n +6 B x a \,b^{2} d^{3} f g \,n^{2}-6 B x \,b^{3} c \,d^{2} f g \,n^{2}-6 B \ln \left (b x +a \right ) a^{2} b \,d^{3} f g \,n^{2}+6 B \ln \left (b x +a \right ) b^{3} c^{2} d f g \,n^{2}-6 A a \,b^{2} d^{3} f^{2} n -6 A \,b^{3} c \,d^{2} f^{2} n +6 A x \,b^{3} d^{3} f^{2} n +2 B \ln \left (b x +a \right ) a^{3} d^{3} g^{2} n^{2}-2 B \ln \left (b x +a \right ) b^{3} c^{3} g^{2} n^{2}-B a \,b^{2} c^{2} d \,g^{2} n^{2}+2 B \,x^{3} \ln \left (e \left (\frac {b x +a}{d x +c}\right )^{n}\right ) b^{3} d^{3} g^{2} n +B \,x^{2} a \,b^{2} d^{3} g^{2} n^{2}-B \,x^{2} b^{3} c \,d^{2} g^{2} n^{2}-2 B x \,a^{2} b \,d^{3} g^{2} n^{2}+2 B x \,b^{3} c^{2} d \,g^{2} n^{2}}{6 b^{3} d^{3} n}\) \(617\)

Input:

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

Output:

1/6*(-6*B*ln(e*((b*x+a)/(d*x+c))^n)*b^3*c^2*d*f*g*n+6*B*x*ln(e*((b*x+a)/(d 
*x+c))^n)*b^3*d^3*f^2*n+6*B*ln(b*x+a)*a*b^2*d^3*f^2*n^2+2*B*a^3*d^3*g^2*n^ 
2-2*B*b^3*c^3*g^2*n^2-6*B*a^2*b*d^3*f*g*n^2+6*B*b^3*c^2*d*f*g*n^2+6*B*ln(e 
*((b*x+a)/(d*x+c))^n)*b^3*c*d^2*f^2*n+6*A*x^2*b^3*d^3*f*g*n-6*B*ln(b*x+a)* 
b^3*c*d^2*f^2*n^2+B*a^2*b*c*d^2*g^2*n^2+2*A*x^3*b^3*d^3*g^2*n+2*B*ln(e*((b 
*x+a)/(d*x+c))^n)*b^3*c^3*g^2*n-6*A*a*b^2*c*d^2*f*g*n+6*B*x^2*ln(e*((b*x+a 
)/(d*x+c))^n)*b^3*d^3*f*g*n+6*B*x*a*b^2*d^3*f*g*n^2-6*B*x*b^3*c*d^2*f*g*n^ 
2-6*B*ln(b*x+a)*a^2*b*d^3*f*g*n^2+6*B*ln(b*x+a)*b^3*c^2*d*f*g*n^2-6*A*a*b^ 
2*d^3*f^2*n-6*A*b^3*c*d^2*f^2*n+6*A*x*b^3*d^3*f^2*n+2*B*ln(b*x+a)*a^3*d^3* 
g^2*n^2-2*B*ln(b*x+a)*b^3*c^3*g^2*n^2-B*a*b^2*c^2*d*g^2*n^2+2*B*x^3*ln(e*( 
(b*x+a)/(d*x+c))^n)*b^3*d^3*g^2*n+B*x^2*a*b^2*d^3*g^2*n^2-B*x^2*b^3*c*d^2* 
g^2*n^2-2*B*x*a^2*b*d^3*g^2*n^2+2*B*x*b^3*c^2*d*g^2*n^2)/b^3/d^3/n
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 334 vs. \(2 (147) = 294\).

Time = 0.12 (sec) , antiderivative size = 334, normalized size of antiderivative = 2.13 \[ \int (f+g x)^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \, dx=\frac {2 \, A b^{3} d^{3} g^{2} x^{3} + {\left (6 \, A b^{3} d^{3} f g - {\left (B b^{3} c d^{2} - B a b^{2} d^{3}\right )} g^{2} n\right )} x^{2} + 2 \, {\left (3 \, B a b^{2} d^{3} f^{2} - 3 \, B a^{2} b d^{3} f g + B a^{3} d^{3} g^{2}\right )} n \log \left (b x + a\right ) - 2 \, {\left (3 \, B b^{3} c d^{2} f^{2} - 3 \, B b^{3} c^{2} d f g + B b^{3} c^{3} g^{2}\right )} n \log \left (d x + c\right ) + 2 \, {\left (3 \, A b^{3} d^{3} f^{2} - {\left (3 \, {\left (B b^{3} c d^{2} - B a b^{2} d^{3}\right )} f g - {\left (B b^{3} c^{2} d - B a^{2} b d^{3}\right )} g^{2}\right )} n\right )} x + 2 \, {\left (B b^{3} d^{3} g^{2} x^{3} + 3 \, B b^{3} d^{3} f g x^{2} + 3 \, B b^{3} d^{3} f^{2} x\right )} \log \left (e\right ) + 2 \, {\left (B b^{3} d^{3} g^{2} n x^{3} + 3 \, B b^{3} d^{3} f g n x^{2} + 3 \, B b^{3} d^{3} f^{2} n x\right )} \log \left (\frac {b x + a}{d x + c}\right )}{6 \, b^{3} d^{3}} \] Input:

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

Output:

1/6*(2*A*b^3*d^3*g^2*x^3 + (6*A*b^3*d^3*f*g - (B*b^3*c*d^2 - B*a*b^2*d^3)* 
g^2*n)*x^2 + 2*(3*B*a*b^2*d^3*f^2 - 3*B*a^2*b*d^3*f*g + B*a^3*d^3*g^2)*n*l 
og(b*x + a) - 2*(3*B*b^3*c*d^2*f^2 - 3*B*b^3*c^2*d*f*g + B*b^3*c^3*g^2)*n* 
log(d*x + c) + 2*(3*A*b^3*d^3*f^2 - (3*(B*b^3*c*d^2 - B*a*b^2*d^3)*f*g - ( 
B*b^3*c^2*d - B*a^2*b*d^3)*g^2)*n)*x + 2*(B*b^3*d^3*g^2*x^3 + 3*B*b^3*d^3* 
f*g*x^2 + 3*B*b^3*d^3*f^2*x)*log(e) + 2*(B*b^3*d^3*g^2*n*x^3 + 3*B*b^3*d^3 
*f*g*n*x^2 + 3*B*b^3*d^3*f^2*n*x)*log((b*x + a)/(d*x + c)))/(b^3*d^3)
 

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 920 vs. \(2 (139) = 278\).

Time = 144.67 (sec) , antiderivative size = 920, normalized size of antiderivative = 5.86 \[ \int (f+g x)^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \, dx =\text {Too large to display} \] Input:

integrate((g*x+f)**2*(A+B*ln(e*((b*x+a)/(d*x+c))**n)),x)
 

Output:

Piecewise(((A + B*log(e*(a/c)**n))*(f**2*x + f*g*x**2 + g**2*x**3/3), Eq(b 
, 0) & Eq(d, 0)), (A*f**2*x + A*f*g*x**2 + A*g**2*x**3/3 + B*c**3*g**2*log 
(e*(a/(c + d*x))**n)/(3*d**3) - B*c**2*f*g*log(e*(a/(c + d*x))**n)/d**2 + 
B*c**2*g**2*n*x/(3*d**2) + B*c*f**2*log(e*(a/(c + d*x))**n)/d - B*c*f*g*n* 
x/d - B*c*g**2*n*x**2/(6*d) + B*f**2*n*x + B*f**2*x*log(e*(a/(c + d*x))**n 
) + B*f*g*n*x**2/2 + B*f*g*x**2*log(e*(a/(c + d*x))**n) + B*g**2*n*x**3/9 
+ B*g**2*x**3*log(e*(a/(c + d*x))**n)/3, Eq(b, 0)), (A*f**2*x + A*f*g*x**2 
 + A*g**2*x**3/3 + B*a**3*g**2*log(e*(a/c + b*x/c)**n)/(3*b**3) - B*a**2*f 
*g*log(e*(a/c + b*x/c)**n)/b**2 - B*a**2*g**2*n*x/(3*b**2) + B*a*f**2*log( 
e*(a/c + b*x/c)**n)/b + B*a*f*g*n*x/b + B*a*g**2*n*x**2/(6*b) - B*f**2*n*x 
 + B*f**2*x*log(e*(a/c + b*x/c)**n) - B*f*g*n*x**2/2 + B*f*g*x**2*log(e*(a 
/c + b*x/c)**n) - B*g**2*n*x**3/9 + B*g**2*x**3*log(e*(a/c + b*x/c)**n)/3, 
 Eq(d, 0)), (A*f**2*x + A*f*g*x**2 + A*g**2*x**3/3 + B*a**3*g**2*n*log(c/d 
 + x)/(3*b**3) + B*a**3*g**2*log(e*(a/(c + d*x) + b*x/(c + d*x))**n)/(3*b* 
*3) - B*a**2*f*g*n*log(c/d + x)/b**2 - B*a**2*f*g*log(e*(a/(c + d*x) + b*x 
/(c + d*x))**n)/b**2 - B*a**2*g**2*n*x/(3*b**2) + B*a*f**2*n*log(c/d + x)/ 
b + B*a*f**2*log(e*(a/(c + d*x) + b*x/(c + d*x))**n)/b + B*a*f*g*n*x/b + B 
*a*g**2*n*x**2/(6*b) - B*c**3*g**2*n*log(c/d + x)/(3*d**3) + B*c**2*f*g*n* 
log(c/d + x)/d**2 + B*c**2*g**2*n*x/(3*d**2) - B*c*f**2*n*log(c/d + x)/d - 
 B*c*f*g*n*x/d - B*c*g**2*n*x**2/(6*d) + B*f**2*x*log(e*(a/(c + d*x) + ...
 

Maxima [A] (verification not implemented)

Time = 0.04 (sec) , antiderivative size = 282, normalized size of antiderivative = 1.80 \[ \int (f+g x)^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \, dx=\frac {1}{3} \, B g^{2} x^{3} \log \left (e {\left (\frac {b x}{d x + c} + \frac {a}{d x + c}\right )}^{n}\right ) + \frac {1}{3} \, A g^{2} x^{3} + B f g x^{2} \log \left (e {\left (\frac {b x}{d x + c} + \frac {a}{d x + c}\right )}^{n}\right ) + A f g x^{2} + \frac {1}{6} \, B g^{2} n {\left (\frac {2 \, a^{3} \log \left (b x + a\right )}{b^{3}} - \frac {2 \, c^{3} \log \left (d x + c\right )}{d^{3}} - \frac {{\left (b^{2} c d - a b d^{2}\right )} x^{2} - 2 \, {\left (b^{2} c^{2} - a^{2} d^{2}\right )} x}{b^{2} d^{2}}\right )} - B f g n {\left (\frac {a^{2} \log \left (b x + a\right )}{b^{2}} - \frac {c^{2} \log \left (d x + c\right )}{d^{2}} + \frac {{\left (b c - a d\right )} x}{b d}\right )} + B f^{2} n {\left (\frac {a \log \left (b x + a\right )}{b} - \frac {c \log \left (d x + c\right )}{d}\right )} + B f^{2} x \log \left (e {\left (\frac {b x}{d x + c} + \frac {a}{d x + c}\right )}^{n}\right ) + A f^{2} x \] Input:

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

Output:

1/3*B*g^2*x^3*log(e*(b*x/(d*x + c) + a/(d*x + c))^n) + 1/3*A*g^2*x^3 + B*f 
*g*x^2*log(e*(b*x/(d*x + c) + a/(d*x + c))^n) + A*f*g*x^2 + 1/6*B*g^2*n*(2 
*a^3*log(b*x + a)/b^3 - 2*c^3*log(d*x + c)/d^3 - ((b^2*c*d - a*b*d^2)*x^2 
- 2*(b^2*c^2 - a^2*d^2)*x)/(b^2*d^2)) - B*f*g*n*(a^2*log(b*x + a)/b^2 - c^ 
2*log(d*x + c)/d^2 + (b*c - a*d)*x/(b*d)) + B*f^2*n*(a*log(b*x + a)/b - c* 
log(d*x + c)/d) + B*f^2*x*log(e*(b*x/(d*x + c) + a/(d*x + c))^n) + A*f^2*x
 

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 3408 vs. \(2 (147) = 294\).

Time = 0.58 (sec) , antiderivative size = 3408, normalized size of antiderivative = 21.71 \[ \int (f+g x)^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \, dx=\text {Too large to display} \] Input:

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

Output:

1/6*(2*(3*B*b^4*c^2*d^2*f^2*n - 6*B*a*b^3*c*d^3*f^2*n - 6*(b*x + a)*B*b^3* 
c^2*d^3*f^2*n/(d*x + c) + 3*B*a^2*b^2*d^4*f^2*n + 12*(b*x + a)*B*a*b^2*c*d 
^4*f^2*n/(d*x + c) + 3*(b*x + a)^2*B*b^2*c^2*d^4*f^2*n/(d*x + c)^2 - 6*(b* 
x + a)*B*a^2*b*d^5*f^2*n/(d*x + c) - 6*(b*x + a)^2*B*a*b*c*d^5*f^2*n/(d*x 
+ c)^2 + 3*(b*x + a)^2*B*a^2*d^6*f^2*n/(d*x + c)^2 - 3*B*b^4*c^3*d*f*g*n + 
 3*B*a*b^3*c^2*d^2*f*g*n + 9*(b*x + a)*B*b^3*c^3*d^2*f*g*n/(d*x + c) + 3*B 
*a^2*b^2*c*d^3*f*g*n - 15*(b*x + a)*B*a*b^2*c^2*d^3*f*g*n/(d*x + c) - 6*(b 
*x + a)^2*B*b^2*c^3*d^3*f*g*n/(d*x + c)^2 - 3*B*a^3*b*d^4*f*g*n + 3*(b*x + 
 a)*B*a^2*b*c*d^4*f*g*n/(d*x + c) + 12*(b*x + a)^2*B*a*b*c^2*d^4*f*g*n/(d* 
x + c)^2 + 3*(b*x + a)*B*a^3*d^5*f*g*n/(d*x + c) - 6*(b*x + a)^2*B*a^2*c*d 
^5*f*g*n/(d*x + c)^2 + B*b^4*c^4*g^2*n - B*a*b^3*c^3*d*g^2*n - 3*(b*x + a) 
*B*b^3*c^4*d*g^2*n/(d*x + c) + 3*(b*x + a)*B*a*b^2*c^3*d^2*g^2*n/(d*x + c) 
 + 3*(b*x + a)^2*B*b^2*c^4*d^2*g^2*n/(d*x + c)^2 - B*a^3*b*c*d^3*g^2*n + 3 
*(b*x + a)*B*a^2*b*c^2*d^3*g^2*n/(d*x + c) - 6*(b*x + a)^2*B*a*b*c^3*d^3*g 
^2*n/(d*x + c)^2 + B*a^4*d^4*g^2*n - 3*(b*x + a)*B*a^3*c*d^4*g^2*n/(d*x + 
c) + 3*(b*x + a)^2*B*a^2*c^2*d^4*g^2*n/(d*x + c)^2)*log((b*x + a)/(d*x + c 
))/(b^3*d^3 - 3*(b*x + a)*b^2*d^4/(d*x + c) + 3*(b*x + a)^2*b*d^5/(d*x + c 
)^2 - (b*x + a)^3*d^6/(d*x + c)^3) - (6*B*b^6*c^3*d*f*g*n - 18*B*a*b^5*c^2 
*d^2*f*g*n - 12*(b*x + a)*B*b^5*c^3*d^2*f*g*n/(d*x + c) + 18*B*a^2*b^4*c*d 
^3*f*g*n + 36*(b*x + a)*B*a*b^4*c^2*d^3*f*g*n/(d*x + c) + 6*(b*x + a)^2...
 

Mupad [B] (verification not implemented)

Time = 26.19 (sec) , antiderivative size = 371, normalized size of antiderivative = 2.36 \[ \int (f+g x)^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \, dx=x^2\,\left (\frac {3\,A\,a\,d\,g^2+3\,A\,b\,c\,g^2+6\,A\,b\,d\,f\,g+B\,a\,d\,g^2\,n-B\,b\,c\,g^2\,n}{6\,b\,d}-\frac {A\,g^2\,\left (3\,a\,d+3\,b\,c\right )}{6\,b\,d}\right )-x\,\left (\frac {\left (3\,a\,d+3\,b\,c\right )\,\left (\frac {3\,A\,a\,d\,g^2+3\,A\,b\,c\,g^2+6\,A\,b\,d\,f\,g+B\,a\,d\,g^2\,n-B\,b\,c\,g^2\,n}{3\,b\,d}-\frac {A\,g^2\,\left (3\,a\,d+3\,b\,c\right )}{3\,b\,d}\right )}{3\,b\,d}-\frac {3\,A\,a\,c\,g^2+3\,A\,b\,d\,f^2+6\,A\,a\,d\,f\,g+6\,A\,b\,c\,f\,g+3\,B\,a\,d\,f\,g\,n-3\,B\,b\,c\,f\,g\,n}{3\,b\,d}+\frac {A\,a\,c\,g^2}{b\,d}\right )+\ln \left (e\,{\left (\frac {a+b\,x}{c+d\,x}\right )}^n\right )\,\left (B\,f^2\,x+B\,f\,g\,x^2+\frac {B\,g^2\,x^3}{3}\right )+\frac {A\,g^2\,x^3}{3}+\frac {\ln \left (a+b\,x\right )\,\left (B\,n\,a^3\,g^2-3\,B\,n\,a^2\,b\,f\,g+3\,B\,n\,a\,b^2\,f^2\right )}{3\,b^3}-\frac {\ln \left (c+d\,x\right )\,\left (B\,n\,c^3\,g^2-3\,B\,n\,c^2\,d\,f\,g+3\,B\,n\,c\,d^2\,f^2\right )}{3\,d^3} \] Input:

int((f + g*x)^2*(A + B*log(e*((a + b*x)/(c + d*x))^n)),x)
 

Output:

x^2*((3*A*a*d*g^2 + 3*A*b*c*g^2 + 6*A*b*d*f*g + B*a*d*g^2*n - B*b*c*g^2*n) 
/(6*b*d) - (A*g^2*(3*a*d + 3*b*c))/(6*b*d)) - x*(((3*a*d + 3*b*c)*((3*A*a* 
d*g^2 + 3*A*b*c*g^2 + 6*A*b*d*f*g + B*a*d*g^2*n - B*b*c*g^2*n)/(3*b*d) - ( 
A*g^2*(3*a*d + 3*b*c))/(3*b*d)))/(3*b*d) - (3*A*a*c*g^2 + 3*A*b*d*f^2 + 6* 
A*a*d*f*g + 6*A*b*c*f*g + 3*B*a*d*f*g*n - 3*B*b*c*f*g*n)/(3*b*d) + (A*a*c* 
g^2)/(b*d)) + log(e*((a + b*x)/(c + d*x))^n)*((B*g^2*x^3)/3 + B*f^2*x + B* 
f*g*x^2) + (A*g^2*x^3)/3 + (log(a + b*x)*(B*a^3*g^2*n + 3*B*a*b^2*f^2*n - 
3*B*a^2*b*f*g*n))/(3*b^3) - (log(c + d*x)*(B*c^3*g^2*n + 3*B*c*d^2*f^2*n - 
 3*B*c^2*d*f*g*n))/(3*d^3)
 

Reduce [B] (verification not implemented)

Time = 0.16 (sec) , antiderivative size = 433, normalized size of antiderivative = 2.76 \[ \int (f+g x)^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \, dx=\frac {2 \,\mathrm {log}\left (d x +c \right ) a^{3} d^{3} g^{2} n -6 \,\mathrm {log}\left (d x +c \right ) a^{2} b \,d^{3} f g n +6 \,\mathrm {log}\left (d x +c \right ) a \,b^{2} d^{3} f^{2} n -2 \,\mathrm {log}\left (d x +c \right ) b^{3} c^{3} g^{2} n +6 \,\mathrm {log}\left (d x +c \right ) b^{3} c^{2} d f g n -6 \,\mathrm {log}\left (d x +c \right ) b^{3} c \,d^{2} f^{2} n +2 \,\mathrm {log}\left (\frac {\left (b x +a \right )^{n} e}{\left (d x +c \right )^{n}}\right ) a^{3} d^{3} g^{2}-6 \,\mathrm {log}\left (\frac {\left (b x +a \right )^{n} e}{\left (d x +c \right )^{n}}\right ) a^{2} b \,d^{3} f g +6 \,\mathrm {log}\left (\frac {\left (b x +a \right )^{n} e}{\left (d x +c \right )^{n}}\right ) a \,b^{2} d^{3} f^{2}+6 \,\mathrm {log}\left (\frac {\left (b x +a \right )^{n} e}{\left (d x +c \right )^{n}}\right ) b^{3} d^{3} f^{2} x +6 \,\mathrm {log}\left (\frac {\left (b x +a \right )^{n} e}{\left (d x +c \right )^{n}}\right ) b^{3} d^{3} f g \,x^{2}+2 \,\mathrm {log}\left (\frac {\left (b x +a \right )^{n} e}{\left (d x +c \right )^{n}}\right ) b^{3} d^{3} g^{2} x^{3}-2 a^{2} b \,d^{3} g^{2} n x +6 a \,b^{2} d^{3} f^{2} x +6 a \,b^{2} d^{3} f g n x +6 a \,b^{2} d^{3} f g \,x^{2}+a \,b^{2} d^{3} g^{2} n \,x^{2}+2 a \,b^{2} d^{3} g^{2} x^{3}+2 b^{3} c^{2} d \,g^{2} n x -6 b^{3} c \,d^{2} f g n x -b^{3} c \,d^{2} g^{2} n \,x^{2}}{6 b^{2} d^{3}} \] Input:

int((g*x+f)^2*(A+B*log(e*((b*x+a)/(d*x+c))^n)),x)
 

Output:

(2*log(c + d*x)*a**3*d**3*g**2*n - 6*log(c + d*x)*a**2*b*d**3*f*g*n + 6*lo 
g(c + d*x)*a*b**2*d**3*f**2*n - 2*log(c + d*x)*b**3*c**3*g**2*n + 6*log(c 
+ d*x)*b**3*c**2*d*f*g*n - 6*log(c + d*x)*b**3*c*d**2*f**2*n + 2*log(((a + 
 b*x)**n*e)/(c + d*x)**n)*a**3*d**3*g**2 - 6*log(((a + b*x)**n*e)/(c + d*x 
)**n)*a**2*b*d**3*f*g + 6*log(((a + b*x)**n*e)/(c + d*x)**n)*a*b**2*d**3*f 
**2 + 6*log(((a + b*x)**n*e)/(c + d*x)**n)*b**3*d**3*f**2*x + 6*log(((a + 
b*x)**n*e)/(c + d*x)**n)*b**3*d**3*f*g*x**2 + 2*log(((a + b*x)**n*e)/(c + 
d*x)**n)*b**3*d**3*g**2*x**3 - 2*a**2*b*d**3*g**2*n*x + 6*a*b**2*d**3*f**2 
*x + 6*a*b**2*d**3*f*g*n*x + 6*a*b**2*d**3*f*g*x**2 + a*b**2*d**3*g**2*n*x 
**2 + 2*a*b**2*d**3*g**2*x**3 + 2*b**3*c**2*d*g**2*n*x - 6*b**3*c*d**2*f*g 
*n*x - b**3*c*d**2*g**2*n*x**2)/(6*b**2*d**3)