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

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [A] (verified)
Fricas [A] (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 = 27, antiderivative size = 150 \[ \int (f+g x)^2 \left (A+B \log \left (\frac {e (a+b x)}{c+d x}\right )\right ) \, dx=-\frac {B (b c-a d) g (3 b d f-b c g-a d g) x}{3 b^2 d^2}-\frac {B (b c-a d) g^2 x^2}{6 b d}-\frac {B (b f-a g)^3 \log (a+b x)}{3 b^3 g}+\frac {(f+g x)^3 \left (A+B \log \left (\frac {e (a+b x)}{c+d x}\right )\right )}{3 g}+\frac {B (d f-c g)^3 \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)*x/b^2/d^2-1/6*B*(-a*d+b*c)*g^2* 
x^2/b/d-1/3*B*(-a*g+b*f)^3*ln(b*x+a)/b^3/g+1/3*(g*x+f)^3*(A+B*ln(e*(b*x+a) 
/(d*x+c)))/g+1/3*B*(-c*g+d*f)^3*ln(d*x+c)/d^3/g
 

Mathematica [A] (verified)

Time = 0.15 (sec) , antiderivative size = 142, normalized size of antiderivative = 0.95 \[ \int (f+g x)^2 \left (A+B \log \left (\frac {e (a+b x)}{c+d x}\right )\right ) \, dx=\frac {(f+g x)^3 \left (A+B \log \left (\frac {e (a+b x)}{c+d x}\right )\right )-\frac {B \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)]),x]
 

Output:

((f + g*x)^3*(A + B*Log[(e*(a + b*x))/(c + d*x)]) - (B*(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 = 155, normalized size of antiderivative = 1.03, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.111, Rules used = {2948, 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 (\frac {e (a+b x)}{c+d x}\right )+A\right ) \, dx\)

\(\Big \downarrow \) 2948

\(\displaystyle \frac {(f+g x)^3 \left (B \log \left (\frac {e (a+b x)}{c+d x}\right )+A\right )}{3 g}-\frac {B (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 (\frac {e (a+b x)}{c+d x}\right )+A\right )}{3 g}-\frac {B (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 (\frac {e (a+b x)}{c+d x}\right )+A\right )}{3 g}-\frac {B (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)]),x]
 

Output:

((f + g*x)^3*(A + B*Log[(e*(a + b*x))/(c + d*x)]))/(3*g) - (B*(b*c - a*d)* 
((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 2948
Int[((A_.) + Log[(e_.)*((a_.) + (b_.)*(x_))^(n_.)*((c_.) + (d_.)*(x_))^(mn_ 
)]*(B_.))*((f_.) + (g_.)*(x_))^(m_.), x_Symbol] :> Simp[(f + g*x)^(m + 1)*( 
(A + B*Log[e*((a + b*x)^n/(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] / 
; FreeQ[{a, b, c, d, e, f, g, A, B, m, n}, x] && EqQ[n + mn, 0] && NeQ[b*c 
- a*d, 0] && NeQ[m, -1] &&  !(EqQ[m, -2] && IntegerQ[n])
 
Maple [A] (verified)

Time = 1.02 (sec) , antiderivative size = 265, normalized size of antiderivative = 1.77

method result size
risch \(\frac {\left (g x +f \right )^{3} B \ln \left (\frac {e \left (b x +a \right )}{d x +c}\right )}{3 g}+\frac {g^{2} A \,x^{3}}{3}+g A f \,x^{2}+\frac {g^{2} B a \,x^{2}}{6 b}-\frac {g^{2} B c \,x^{2}}{6 d}+A \,f^{2} x -\frac {g^{2} B \ln \left (d x +c \right ) c^{3}}{3 d^{3}}+\frac {g B \ln \left (d x +c \right ) c^{2} f}{d^{2}}-\frac {B \ln \left (d x +c \right ) c \,f^{2}}{d}+\frac {B \ln \left (d x +c \right ) f^{3}}{3 g}+\frac {g^{2} B \ln \left (-b x -a \right ) a^{3}}{3 b^{3}}-\frac {g B \ln \left (-b x -a \right ) a^{2} f}{b^{2}}+\frac {B \ln \left (-b x -a \right ) a \,f^{2}}{b}-\frac {B \ln \left (-b x -a \right ) f^{3}}{3 g}-\frac {g^{2} B \,a^{2} x}{3 b^{2}}+\frac {g B a f x}{b}+\frac {g^{2} B \,c^{2} x}{3 d^{2}}-\frac {g B c f x}{d}\) \(265\)
parallelrisch \(\frac {6 B \,b^{3} c^{2} d f g +2 B \,a^{3} d^{3} g^{2}-2 B \,b^{3} c^{3} g^{2}-6 A a \,b^{2} c \,d^{2} f g +B \,a^{2} b c \,d^{2} g^{2}-B a \,b^{2} c^{2} d \,g^{2}-6 B \,a^{2} b \,d^{3} f g +2 A \,x^{3} b^{3} d^{3} g^{2}+6 B \ln \left (b x +a \right ) a \,b^{2} d^{3} f^{2}-6 B \ln \left (b x +a \right ) b^{3} c \,d^{2} f^{2}-6 B x \,b^{3} c \,d^{2} f g -6 B \ln \left (\frac {e \left (b x +a \right )}{d x +c}\right ) b^{3} c^{2} d f g -6 B \ln \left (b x +a \right ) a^{2} b \,d^{3} f g +6 B \ln \left (b x +a \right ) b^{3} c^{2} d f g -2 B x \,a^{2} b \,d^{3} g^{2}+2 B x \,b^{3} c^{2} d \,g^{2}+B \,x^{2} a \,b^{2} d^{3} g^{2}-B \,x^{2} b^{3} c \,d^{2} g^{2}+6 A x \,b^{3} d^{3} f^{2}+2 B \ln \left (\frac {e \left (b x +a \right )}{d x +c}\right ) b^{3} c^{3} g^{2}+6 B \,x^{2} \ln \left (\frac {e \left (b x +a \right )}{d x +c}\right ) b^{3} d^{3} f g +6 B x a \,b^{2} d^{3} f g +6 B x \ln \left (\frac {e \left (b x +a \right )}{d x +c}\right ) b^{3} d^{3} f^{2}+6 B \ln \left (\frac {e \left (b x +a \right )}{d x +c}\right ) b^{3} c \,d^{2} f^{2}+2 B \,x^{3} \ln \left (\frac {e \left (b x +a \right )}{d x +c}\right ) b^{3} d^{3} g^{2}+6 A \,x^{2} b^{3} d^{3} f g -6 A a \,b^{2} d^{3} f^{2}-6 A \,b^{3} c \,d^{2} f^{2}+2 B \ln \left (b x +a \right ) a^{3} d^{3} g^{2}-2 B \ln \left (b x +a \right ) b^{3} c^{3} g^{2}}{6 b^{3} d^{3}}\) \(530\)
parts \(\frac {A \left (g x +f \right )^{3}}{3 g}-\frac {B \left (d a -b c \right ) e \left (\left (\frac {\ln \left (\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d -b e \right )}{b e d}-\frac {\ln \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right )}{b e \left (\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d -b e \right )}\right ) \left (c^{2} g^{2}-2 c d f g +d^{2} f^{2}\right )-2 \left (-\frac {1}{2 b e d \left (\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d -b e \right )}-\frac {\ln \left (\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d -b e \right )}{2 b^{2} e^{2} d}+\frac {\ln \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) \left (\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d -2 b e \right )}{2 b^{2} e^{2} \left (\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d -b e \right )^{2}}\right ) e g \left (a c d g -a \,d^{2} f -b \,c^{2} g +b c d f \right )+\left (\frac {1}{3 b^{2} e^{2} d \left (\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d -b e \right )}-\frac {1}{6 b e d \left (\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d -b e \right )^{2}}+\frac {\ln \left (\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d -b e \right )}{3 b^{3} e^{3} d}-\frac {\ln \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) \left (3 b^{2} e^{2}-3 \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d b e +d^{2} \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right )^{2}\right )}{3 b^{3} e^{3} \left (\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d -b e \right )^{3}}\right ) e^{2} g^{2} \left (a^{2} d^{2}-2 a c d b +c^{2} b^{2}\right )\right )}{d^{2}}\) \(796\)
derivativedivides \(-\frac {e \left (d a -b c \right ) \left (A \,d^{2} \left (\frac {e g \left (a c d g -a \,d^{2} f -b \,c^{2} g +b c d f \right )}{d^{3} \left (b e -\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d \right )^{2}}+\frac {e^{2} g^{2} \left (a^{2} d^{2}-2 a c d b +c^{2} b^{2}\right )}{3 d^{3} \left (b e -\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d \right )^{3}}+\frac {c^{2} g^{2}-2 c d f g +d^{2} f^{2}}{d^{3} \left (b e -\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d \right )}\right )+B \,d^{2} \left (-\frac {2 \left (\frac {1}{2 b e d \left (b e -\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d \right )}-\frac {\ln \left (b e -\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d \right )}{2 b^{2} e^{2} d}-\frac {\ln \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) \left (2 b e -\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d \right )}{2 b^{2} e^{2} \left (b e -\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d \right )^{2}}\right ) e g \left (a c d g -a \,d^{2} f -b \,c^{2} g +b c d f \right )}{d^{2}}+\frac {\left (-\frac {1}{6 b e d \left (b e -\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d \right )^{2}}-\frac {1}{3 b^{2} e^{2} d \left (b e -\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d \right )}+\frac {\ln \left (b e -\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d \right )}{3 b^{3} e^{3} d}+\frac {\ln \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) \left (3 b^{2} e^{2}-3 \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d b e +d^{2} \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right )^{2}\right )}{3 b^{3} e^{3} \left (b e -\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d \right )^{3}}\right ) e^{2} g^{2} \left (a^{2} d^{2}-2 a c d b +c^{2} b^{2}\right )}{d^{2}}+\frac {\left (\frac {\ln \left (b e -\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d \right )}{b e d}+\frac {\ln \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right )}{b e \left (b e -\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d \right )}\right ) \left (c^{2} g^{2}-2 c d f g +d^{2} f^{2}\right )}{d^{2}}\right )\right )}{d^{2}}\) \(998\)
default \(-\frac {e \left (d a -b c \right ) \left (A \,d^{2} \left (\frac {e g \left (a c d g -a \,d^{2} f -b \,c^{2} g +b c d f \right )}{d^{3} \left (b e -\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d \right )^{2}}+\frac {e^{2} g^{2} \left (a^{2} d^{2}-2 a c d b +c^{2} b^{2}\right )}{3 d^{3} \left (b e -\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d \right )^{3}}+\frac {c^{2} g^{2}-2 c d f g +d^{2} f^{2}}{d^{3} \left (b e -\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d \right )}\right )+B \,d^{2} \left (-\frac {2 \left (\frac {1}{2 b e d \left (b e -\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d \right )}-\frac {\ln \left (b e -\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d \right )}{2 b^{2} e^{2} d}-\frac {\ln \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) \left (2 b e -\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d \right )}{2 b^{2} e^{2} \left (b e -\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d \right )^{2}}\right ) e g \left (a c d g -a \,d^{2} f -b \,c^{2} g +b c d f \right )}{d^{2}}+\frac {\left (-\frac {1}{6 b e d \left (b e -\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d \right )^{2}}-\frac {1}{3 b^{2} e^{2} d \left (b e -\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d \right )}+\frac {\ln \left (b e -\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d \right )}{3 b^{3} e^{3} d}+\frac {\ln \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) \left (3 b^{2} e^{2}-3 \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d b e +d^{2} \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right )^{2}\right )}{3 b^{3} e^{3} \left (b e -\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d \right )^{3}}\right ) e^{2} g^{2} \left (a^{2} d^{2}-2 a c d b +c^{2} b^{2}\right )}{d^{2}}+\frac {\left (\frac {\ln \left (b e -\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d \right )}{b e d}+\frac {\ln \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right )}{b e \left (b e -\left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) d \right )}\right ) \left (c^{2} g^{2}-2 c d f g +d^{2} f^{2}\right )}{d^{2}}\right )\right )}{d^{2}}\) \(998\)

Input:

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

Output:

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

Fricas [A] (verification not implemented)

Time = 0.11 (sec) , antiderivative size = 280, normalized size of antiderivative = 1.87 \[ \int (f+g x)^2 \left (A+B \log \left (\frac {e (a+b x)}{c+d x}\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}\right )} x^{2} + 2 \, {\left (3 \, A b^{3} d^{3} f^{2} - 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 )} x + 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 )} \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 )} \log \left (d x + c\right ) + 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 (\frac {b e x + a e}{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))),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)*x^2 + 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)*x + 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)*log(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)*log(d*x + c) + 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((b*e*x + a*e)/(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. 658 vs. \(2 (131) = 262\).

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

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

Output:

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

Maxima [A] (verification not implemented)

Time = 0.04 (sec) , antiderivative size = 262, normalized size of antiderivative = 1.75 \[ \int (f+g x)^2 \left (A+B \log \left (\frac {e (a+b x)}{c+d x}\right )\right ) \, dx=\frac {1}{3} \, A g^{2} x^{3} + A f g x^{2} + {\left (x \log \left (\frac {b e x}{d x + c} + \frac {a e}{d x + c}\right ) + \frac {a \log \left (b x + a\right )}{b} - \frac {c \log \left (d x + c\right )}{d}\right )} B f^{2} + {\left (x^{2} \log \left (\frac {b e x}{d x + c} + \frac {a e}{d x + c}\right ) - \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 g + \frac {1}{6} \, {\left (2 \, x^{3} \log \left (\frac {b e x}{d x + c} + \frac {a e}{d x + c}\right ) + \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 g^{2} + A f^{2} x \] Input:

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

Output:

1/3*A*g^2*x^3 + A*f*g*x^2 + (x*log(b*e*x/(d*x + c) + a*e/(d*x + c)) + a*lo 
g(b*x + a)/b - c*log(d*x + c)/d)*B*f^2 + (x^2*log(b*e*x/(d*x + c) + a*e/(d 
*x + c)) - 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*g + 1/6*(2*x^3*log(b*e*x/(d*x + c) + a*e/(d*x + c)) + 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*g^2 + A*f^2*x
 

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 3076 vs. \(2 (140) = 280\).

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

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

Output:

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

Mupad [B] (verification not implemented)

Time = 25.70 (sec) , antiderivative size = 356, normalized size of antiderivative = 2.37 \[ \int (f+g x)^2 \left (A+B \log \left (\frac {e (a+b x)}{c+d x}\right )\right ) \, dx=x^2\,\left (\frac {3\,A\,a\,d\,g^2+3\,A\,b\,c\,g^2+B\,a\,d\,g^2-B\,b\,c\,g^2+6\,A\,b\,d\,f\,g}{6\,b\,d}-\frac {A\,g^2\,\left (3\,a\,d+3\,b\,c\right )}{6\,b\,d}\right )+\ln \left (\frac {e\,\left (a+b\,x\right )}{c+d\,x}\right )\,\left (B\,f^2\,x+B\,f\,g\,x^2+\frac {B\,g^2\,x^3}{3}\right )-x\,\left (\frac {\left (\frac {3\,A\,a\,d\,g^2+3\,A\,b\,c\,g^2+B\,a\,d\,g^2-B\,b\,c\,g^2+6\,A\,b\,d\,f\,g}{3\,b\,d}-\frac {A\,g^2\,\left (3\,a\,d+3\,b\,c\right )}{3\,b\,d}\right )\,\left (3\,a\,d+3\,b\,c\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-3\,B\,b\,c\,f\,g}{3\,b\,d}+\frac {A\,a\,c\,g^2}{b\,d}\right )+\frac {\ln \left (a+b\,x\right )\,\left (B\,a^3\,g^2-3\,B\,a^2\,b\,f\,g+3\,B\,a\,b^2\,f^2\right )}{3\,b^3}-\frac {\ln \left (c+d\,x\right )\,\left (B\,c^3\,g^2-3\,B\,c^2\,d\,f\,g+3\,B\,c\,d^2\,f^2\right )}{3\,d^3}+\frac {A\,g^2\,x^3}{3} \] Input:

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

Output:

x^2*((3*A*a*d*g^2 + 3*A*b*c*g^2 + B*a*d*g^2 - B*b*c*g^2 + 6*A*b*d*f*g)/(6* 
b*d) - (A*g^2*(3*a*d + 3*b*c))/(6*b*d)) + log((e*(a + b*x))/(c + d*x))*((B 
*g^2*x^3)/3 + B*f^2*x + B*f*g*x^2) - x*((((3*A*a*d*g^2 + 3*A*b*c*g^2 + B*a 
*d*g^2 - B*b*c*g^2 + 6*A*b*d*f*g)/(3*b*d) - (A*g^2*(3*a*d + 3*b*c))/(3*b*d 
))*(3*a*d + 3*b*c))/(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 - 3*B*b*c*f*g)/(3*b*d) + (A*a*c*g^2)/(b*d)) + (lo 
g(a + b*x)*(B*a^3*g^2 + 3*B*a*b^2*f^2 - 3*B*a^2*b*f*g))/(3*b^3) - (log(c + 
 d*x)*(B*c^3*g^2 + 3*B*c*d^2*f^2 - 3*B*c^2*d*f*g))/(3*d^3) + (A*g^2*x^3)/3
 

Reduce [B] (verification not implemented)

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

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

Output:

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