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

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

Optimal result

Integrand size = 29, antiderivative size = 281 \[ \int (f+g x) \left (A+B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )\right )^2 \, dx=-\frac {2 B (b c-a d) g (a+b x) \left (A+B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )\right )}{b^2 d}-\frac {(b f-a g)^2 \left (A+B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )\right )^2}{2 b^2 g}+\frac {(f+g x)^2 \left (A+B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )\right )^2}{2 g}+\frac {2 B (b c-a d) (2 b d f-b c g-a d g) \left (A+B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )\right ) \log \left (\frac {b c-a d}{b (c+d x)}\right )}{b^2 d^2}+\frac {4 B^2 (b c-a d)^2 g \log (c+d x)}{b^2 d^2}+\frac {4 B^2 (b c-a d) (2 b d f-b c g-a d g) \operatorname {PolyLog}\left (2,\frac {d (a+b x)}{b (c+d x)}\right )}{b^2 d^2} \] Output:

-2*B*(-a*d+b*c)*g*(b*x+a)*(A+B*ln(e*(b*x+a)^2/(d*x+c)^2))/b^2/d-1/2*(-a*g+ 
b*f)^2*(A+B*ln(e*(b*x+a)^2/(d*x+c)^2))^2/b^2/g+1/2*(g*x+f)^2*(A+B*ln(e*(b* 
x+a)^2/(d*x+c)^2))^2/g+2*B*(-a*d+b*c)*(-a*d*g-b*c*g+2*b*d*f)*(A+B*ln(e*(b* 
x+a)^2/(d*x+c)^2))*ln((-a*d+b*c)/b/(d*x+c))/b^2/d^2+4*B^2*(-a*d+b*c)^2*g*l 
n(d*x+c)/b^2/d^2+4*B^2*(-a*d+b*c)*(-a*d*g-b*c*g+2*b*d*f)*polylog(2,d*(b*x+ 
a)/b/(d*x+c))/b^2/d^2
 

Mathematica [A] (verified)

Time = 0.34 (sec) , antiderivative size = 351, normalized size of antiderivative = 1.25 \[ \int (f+g x) \left (A+B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )\right )^2 \, dx=\frac {(f+g x)^2 \left (A+B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )\right )^2-\frac {4 B \left (A b d (b c-a d) g^2 x+B d (b c-a d) g^2 (a+b x) \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )+d^2 (b f-a g)^2 \log (a+b x) \left (A+B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )\right )-2 B (b c-a d)^2 g^2 \log (c+d x)-b^2 (d f-c g)^2 \left (A+B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )\right ) \log (c+d x)-B d^2 (b f-a g)^2 \left (\log (a+b x) \left (\log (a+b x)-2 \log \left (\frac {b (c+d x)}{b c-a d}\right )\right )-2 \operatorname {PolyLog}\left (2,\frac {d (a+b x)}{-b c+a d}\right )\right )+b^2 B (d f-c g)^2 \left (\left (2 \log \left (\frac {d (a+b x)}{-b c+a d}\right )-\log (c+d x)\right ) \log (c+d x)+2 \operatorname {PolyLog}\left (2,\frac {b (c+d x)}{b c-a d}\right )\right )\right )}{b^2 d^2}}{2 g} \] Input:

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

Output:

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

Rubi [A] (verified)

Time = 0.87 (sec) , antiderivative size = 401, normalized size of antiderivative = 1.43, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.138, Rules used = {2954, 2798, 2804, 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) \left (B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )+A\right )^2 \, dx\)

\(\Big \downarrow \) 2954

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

\(\Big \downarrow \) 2798

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

\(\Big \downarrow \) 2804

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

\(\Big \downarrow \) 2009

\(\displaystyle (b c-a d) \left (\frac {\left (-\frac {(a+b x) (d f-c g)}{c+d x}-a g+b f\right )^2 \left (B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )+A\right )^2}{2 g (b c-a d) \left (b-\frac {d (a+b x)}{c+d x}\right )^2}-\frac {2 B \left (-\frac {g (b c-a d) (-a d g-b c g+2 b d f) \log \left (1-\frac {d (a+b x)}{b (c+d x)}\right ) \left (B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )+A\right )}{b^2 d^2}+\frac {(b f-a g)^2 \left (B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )+A\right )^2}{4 b^2 B}+\frac {g^2 (a+b x) (b c-a d)^2 \left (B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )+A\right )}{b^2 d (c+d x) \left (b-\frac {d (a+b x)}{c+d x}\right )}-\frac {2 B g (b c-a d) (-a d g-b c g+2 b d f) \operatorname {PolyLog}\left (2,\frac {d (a+b x)}{b (c+d x)}\right )}{b^2 d^2}+\frac {2 B g^2 (b c-a d)^2 \log \left (b-\frac {d (a+b x)}{c+d x}\right )}{b^2 d^2}\right )}{g (b c-a d)}\right )\)

Input:

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

Output:

(b*c - a*d)*(((b*f - a*g - ((d*f - c*g)*(a + b*x))/(c + d*x))^2*(A + B*Log 
[(e*(a + b*x)^2)/(c + d*x)^2])^2)/(2*(b*c - a*d)*g*(b - (d*(a + b*x))/(c + 
 d*x))^2) - (2*B*(((b*c - a*d)^2*g^2*(a + b*x)*(A + B*Log[(e*(a + b*x)^2)/ 
(c + d*x)^2]))/(b^2*d*(c + d*x)*(b - (d*(a + b*x))/(c + d*x))) + ((b*f - a 
*g)^2*(A + B*Log[(e*(a + b*x)^2)/(c + d*x)^2])^2)/(4*b^2*B) + (2*B*(b*c - 
a*d)^2*g^2*Log[b - (d*(a + b*x))/(c + d*x)])/(b^2*d^2) - ((b*c - a*d)*g*(2 
*b*d*f - b*c*g - a*d*g)*(A + B*Log[(e*(a + b*x)^2)/(c + d*x)^2])*Log[1 - ( 
d*(a + b*x))/(b*(c + d*x))])/(b^2*d^2) - (2*B*(b*c - a*d)*g*(2*b*d*f - b*c 
*g - a*d*g)*PolyLog[2, (d*(a + b*x))/(b*(c + d*x))])/(b^2*d^2)))/((b*c - a 
*d)*g))
 

Defintions of rubi rules used

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

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

rule 2804
Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*(RFx_), x_Symbol] :> With[{ 
u = ExpandIntegrand[(a + b*Log[c*x^n])^p, RFx, x]}, Int[u, x] /; SumQ[u]] / 
; FreeQ[{a, b, c, n}, x] && RationalFunctionQ[RFx, x] && IGtQ[p, 0]
 

rule 2954
Int[((A_.) + Log[(e_.)*((a_.) + (b_.)*(x_))^(n_.)*((c_.) + (d_.)*(x_))^(mn_ 
)]*(B_.))^(p_.)*((f_.) + (g_.)*(x_))^(m_.), x_Symbol] :> Simp[(b*c - a*d) 
 Subst[Int[(b*f - a*g - (d*f - c*g)*x)^m*((A + B*Log[e*x^n])^p/(b - d*x)^(m 
 + 2)), x], x, (a + b*x)/(c + d*x)], x] /; FreeQ[{a, b, c, d, e, f, g, A, B 
, n}, x] && EqQ[n + mn, 0] && IGtQ[n, 0] && NeQ[b*c - a*d, 0] && IntegerQ[m 
] && IGtQ[p, 0]
 
Maple [F]

\[\int \left (g x +f \right ) {\left (A +B \ln \left (\frac {e \left (b x +a \right )^{2}}{\left (d x +c \right )^{2}}\right )\right )}^{2}d x\]

Input:

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

Output:

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

Fricas [F]

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

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

Output:

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

Sympy [F(-1)]

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

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

Output:

Timed out
 

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 786 vs. \(2 (276) = 552\).

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

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

Output:

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

Giac [F]

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

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

Output:

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

Mupad [F(-1)]

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

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

Output:

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

Reduce [F]

\[ \int (f+g x) \left (A+B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )\right )^2 \, dx =\text {Too large to display} \] Input:

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

Output:

( - 4*int((log((a**2*e + 2*a*b*e*x + b**2*e*x**2)/(c**2 + 2*c*d*x + d**2*x 
**2))*x)/(a*c + a*d*x + b*c*x + b*d*x**2),x)*a**2*b**2*d**3*g + 8*int((log 
((a**2*e + 2*a*b*e*x + b**2*e*x**2)/(c**2 + 2*c*d*x + d**2*x**2))*x)/(a*c 
+ a*d*x + b*c*x + b*d*x**2),x)*a*b**3*d**3*f + 4*int((log((a**2*e + 2*a*b* 
e*x + b**2*e*x**2)/(c**2 + 2*c*d*x + d**2*x**2))*x)/(a*c + a*d*x + b*c*x + 
 b*d*x**2),x)*b**4*c**2*d*g - 8*int((log((a**2*e + 2*a*b*e*x + b**2*e*x**2 
)/(c**2 + 2*c*d*x + d**2*x**2))*x)/(a*c + a*d*x + b*c*x + b*d*x**2),x)*b** 
4*c*d**2*f - 4*log(c + d*x)*a**3*d**2*g + 8*log(c + d*x)*a**2*b*d**2*f + 8 
*log(c + d*x)*a**2*b*d**2*g + 4*log(c + d*x)*a*b**2*c**2*g - 8*log(c + d*x 
)*a*b**2*c*d*f - 16*log(c + d*x)*a*b**2*c*d*g + 8*log(c + d*x)*b**3*c**2*g 
 + log((a**2*e + 2*a*b*e*x + b**2*e*x**2)/(c**2 + 2*c*d*x + d**2*x**2))**2 
*a*b**2*c*d*g + 2*log((a**2*e + 2*a*b*e*x + b**2*e*x**2)/(c**2 + 2*c*d*x + 
 d**2*x**2))**2*b**3*d**2*f*x + log((a**2*e + 2*a*b*e*x + b**2*e*x**2)/(c* 
*2 + 2*c*d*x + d**2*x**2))**2*b**3*d**2*g*x**2 - 2*log((a**2*e + 2*a*b*e*x 
 + b**2*e*x**2)/(c**2 + 2*c*d*x + d**2*x**2))*a**3*d**2*g + 4*log((a**2*e 
+ 2*a*b*e*x + b**2*e*x**2)/(c**2 + 2*c*d*x + d**2*x**2))*a**2*b*d**2*f + 4 
*log((a**2*e + 2*a*b*e*x + b**2*e*x**2)/(c**2 + 2*c*d*x + d**2*x**2))*a**2 
*b*d**2*g - 4*log((a**2*e + 2*a*b*e*x + b**2*e*x**2)/(c**2 + 2*c*d*x + d** 
2*x**2))*a*b**2*c*d*g + 4*log((a**2*e + 2*a*b*e*x + b**2*e*x**2)/(c**2 + 2 
*c*d*x + d**2*x**2))*a*b**2*d**2*f*x + 2*log((a**2*e + 2*a*b*e*x + b**2...