\(\int (a+b x)^2 (A+B \log (e (a+b x)^n (c+d x)^{-n}))^2 \, dx\) [157]

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

Optimal result

Integrand size = 33, antiderivative size = 263 \[ \int (a+b x)^2 \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2 \, dx=-\frac {B (b c-a d) n (a+b x)^2 \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )}{3 b d}+\frac {(a+b x)^3 \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2}{3 b}+\frac {B (b c-a d)^2 n (a+b x) \left (2 A+B n+2 B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )}{3 b d^2}+\frac {B (b c-a d)^3 n \log \left (\frac {b c-a d}{b (c+d x)}\right ) \left (2 A+3 B n+2 B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )}{3 b d^3}+\frac {2 B^2 (b c-a d)^3 n^2 \operatorname {PolyLog}\left (2,\frac {d (a+b x)}{b (c+d x)}\right )}{3 b d^3} \] Output:

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

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(1149\) vs. \(2(263)=526\).

Time = 1.07 (sec) , antiderivative size = 1149, normalized size of antiderivative = 4.37 \[ \int (a+b x)^2 \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2 \, dx =\text {Too large to display} \] Input:

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

Output:

(-6*a^3*A*B*d^3*n - 2*a*b^2*B^2*c^2*d*n^2 + 6*a^2*b*B^2*c*d^2*n^2 - 6*a^3* 
B^2*d^3*n^2 + 3*a^2*A^2*b*d^3*x + 2*A*b^3*B*c^2*d*n*x - 6*a*A*b^2*B*c*d^2* 
n*x + 4*a^2*A*b*B*d^3*n*x + b^3*B^2*c^2*d*n^2*x - 2*a*b^2*B^2*c*d^2*n^2*x 
+ a^2*b*B^2*d^3*n^2*x + 3*a*A^2*b^2*d^3*x^2 - A*b^3*B*c*d^2*n*x^2 + a*A*b^ 
2*B*d^3*n*x^2 + A^2*b^3*d^3*x^3 - a^3*B^2*d^3*n^2*Log[a + b*x]^2 - 2*A*b^3 
*B*c^3*n*Log[c + d*x] + 6*a*A*b^2*B*c^2*d*n*Log[c + d*x] - 6*a^2*A*b*B*c*d 
^2*n*Log[c + d*x] - 3*b^3*B^2*c^3*n^2*Log[c + d*x] + 7*a*b^2*B^2*c^2*d*n^2 
*Log[c + d*x] - 4*a^2*b*B^2*c*d^2*n^2*Log[c + d*x] - 6*a^3*B^2*d^3*n^2*Log 
[c + d*x] - b^3*B^2*c^3*n^2*Log[c + d*x]^2 + 3*a*b^2*B^2*c^2*d*n^2*Log[c + 
 d*x]^2 - 3*a^2*b*B^2*c*d^2*n^2*Log[c + d*x]^2 - 6*a^3*B^2*d^3*n*Log[(e*(a 
 + b*x)^n)/(c + d*x)^n] + 6*a^2*A*b*B*d^3*x*Log[(e*(a + b*x)^n)/(c + d*x)^ 
n] + 2*b^3*B^2*c^2*d*n*x*Log[(e*(a + b*x)^n)/(c + d*x)^n] - 6*a*b^2*B^2*c* 
d^2*n*x*Log[(e*(a + b*x)^n)/(c + d*x)^n] + 4*a^2*b*B^2*d^3*n*x*Log[(e*(a + 
 b*x)^n)/(c + d*x)^n] + 6*a*A*b^2*B*d^3*x^2*Log[(e*(a + b*x)^n)/(c + d*x)^ 
n] - b^3*B^2*c*d^2*n*x^2*Log[(e*(a + b*x)^n)/(c + d*x)^n] + a*b^2*B^2*d^3* 
n*x^2*Log[(e*(a + b*x)^n)/(c + d*x)^n] + 2*A*b^3*B*d^3*x^3*Log[(e*(a + b*x 
)^n)/(c + d*x)^n] - 2*b^3*B^2*c^3*n*Log[c + d*x]*Log[(e*(a + b*x)^n)/(c + 
d*x)^n] + 6*a*b^2*B^2*c^2*d*n*Log[c + d*x]*Log[(e*(a + b*x)^n)/(c + d*x)^n 
] - 6*a^2*b*B^2*c*d^2*n*Log[c + d*x]*Log[(e*(a + b*x)^n)/(c + d*x)^n] + 3* 
a^2*b*B^2*d^3*x*Log[(e*(a + b*x)^n)/(c + d*x)^n]^2 + 3*a*b^2*B^2*d^3*x^...
 

Rubi [A] (warning: unable to verify)

Time = 0.82 (sec) , antiderivative size = 306, normalized size of antiderivative = 1.16, number of steps used = 8, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.212, Rules used = {2973, 2949, 2781, 2784, 2784, 2754, 2838}

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 (a+b x)^2 \left (B \log \left (e (a+b x)^n (c+d x)^{-n}\right )+A\right )^2 \, dx\)

\(\Big \downarrow \) 2973

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

\(\Big \downarrow \) 2949

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

\(\Big \downarrow \) 2781

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

\(\Big \downarrow \) 2784

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

\(\Big \downarrow \) 2784

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

\(\Big \downarrow \) 2754

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

\(\Big \downarrow \) 2838

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

Input:

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

Output:

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

Defintions of rubi rules used

rule 2754
Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)/((d_) + (e_.)*(x_)), x_Symb 
ol] :> Simp[Log[1 + e*(x/d)]*((a + b*Log[c*x^n])^p/e), x] - Simp[b*n*(p/e) 
  Int[Log[1 + e*(x/d)]*((a + b*Log[c*x^n])^(p - 1)/x), x], x] /; FreeQ[{a, 
b, c, d, e, n}, x] && IGtQ[p, 0]
 

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

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

rule 2838
Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> Simp[-PolyLog[2 
, (-c)*e*x^n]/n, x] /; FreeQ[{c, d, e, n}, x] && EqQ[c*d, 1]
 

rule 2949
Int[((A_.) + Log[(e_.)*(((a_.) + (b_.)*(x_))/((c_.) + (d_.)*(x_)))^(n_.)]*( 
B_.))^(p_.)*((f_.) + (g_.)*(x_))^(m_.), x_Symbol] :> Simp[(b*c - a*d)^(m + 
1)*(g/b)^m   Subst[Int[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] && Ne 
Q[b*c - a*d, 0] && IntegersQ[m, p] && EqQ[b*f - a*g, 0] && (GtQ[p, 0] || Lt 
Q[m, -1])
 

rule 2973
Int[((A_.) + Log[(e_.)*(u_)^(n_.)*(v_)^(mn_)]*(B_.))^(p_.)*(w_.), x_Symbol] 
 :> Subst[Int[w*(A + B*Log[e*(u/v)^n])^p, x], e*(u/v)^n, e*(u^n/v^n)] /; Fr 
eeQ[{e, A, B, n, p}, x] && EqQ[n + mn, 0] && LinearQ[{u, v}, x] &&  !Intege 
rQ[n]
 
Maple [C] (warning: unable to verify)

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

Time = 74.42 (sec) , antiderivative size = 4963, normalized size of antiderivative = 18.87

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

Input:

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

Output:

2/3*n^2*b*B^2/d^2*a*ln(b*x+a)*c^2+1/3*I*n*B^2*x*Pi*a^2*csgn(I/((d*x+c)^n)* 
(b*x+a)^n)^3+1/3*I*n*B^2*x*Pi*a^2*csgn(I*e*(b*x+a)^n/((d*x+c)^n))^3+1/9*I* 
n*b^2*B^2*Pi*x^3*csgn(I/((d*x+c)^n)*(b*x+a)^n)^3+1/9*I*n*b^2*B^2*Pi*x^3*cs 
gn(I*e*(b*x+a)^n/((d*x+c)^n))^3+2/d*a^2*c*B^2*n^2-2/3*B^2*n^2*dilog((d*a-b 
*c+b*(d*x+c))/(a*d-b*c))/b*a^3-2/9*A*B*x^3*b^2*n-2/3*A*B*x*a^2*n+85/54/d^3 
*B^2*b^2*c^3*n^2-1/3*B^2*b*n*ln((d*x+c)^n)*x^2*a-2/3*B^2/b*n*ln((d*x+c)^n) 
*ln(d*x+c)*a^3-2/9*B^2*ln(e)*x^3*b^2*n-2/3*B^2*ln(e)*x*a^2*n+n^2/b*B^2*a^3 
*ln(b*x+a)-2/9*n^2/b*B^2*ln(d*x+c)*a^3+2/9*n/b*B^2*ln((d*x+c)^n)*a^3-4/3*B 
^2*n*ln((d*x+c)^n)*x*a^2+1/3*B^2/b*n^2*a^3*ln(d*x+c)^2+B^2*ln((d*x+c)^n)^2 
*b*x^2*a+(-2/3*(b*x+a)^3*B^2/b*ln((d*x+c)^n)+1/3*B*(6*A*a^2*b*d^3*x+6*A*a* 
b^2*d^3*x^2+2*B*ln(e)*b^3*d^3*x^3+6*B*ln(e)*a^2*b*d^3*x+6*B*ln(e)*a*b^2*d^ 
3*x^2+2*A*b^3*d^3*x^3+2*B*ln(d*x+c)*a^3*d^3*n-2*B*ln(d*x+c)*b^3*c^3*n+B*a* 
b^2*d^3*n*x^2-B*b^3*c*d^2*n*x^2+4*B*a^2*b*d^3*n*x+2*B*b^3*c^2*d*n*x-6*B*a* 
b^2*c*d^2*n*x+I*B*Pi*b^3*d^3*x^3*csgn(I*(b*x+a)^n)*csgn(I/((d*x+c)^n)*(b*x 
+a)^n)^2+I*B*Pi*b^3*d^3*x^3*csgn(I/((d*x+c)^n)*(b*x+a)^n)*csgn(I*e*(b*x+a) 
^n/((d*x+c)^n))^2+I*B*Pi*b^3*d^3*x^3*csgn(I*e*(b*x+a)^n/((d*x+c)^n))^2*csg 
n(I*e)+3*I*B*Pi*a*b^2*d^3*x^2*csgn(I*e*(b*x+a)^n/((d*x+c)^n))^2*csgn(I*e)+ 
3*I*B*Pi*a^2*b*d^3*x*csgn(I/((d*x+c)^n))*csgn(I/((d*x+c)^n)*(b*x+a)^n)^2+3 
*I*B*Pi*a^2*b*d^3*x*csgn(I*(b*x+a)^n)*csgn(I/((d*x+c)^n)*(b*x+a)^n)^2+3*I* 
B*Pi*a^2*b*d^3*x*csgn(I/((d*x+c)^n)*(b*x+a)^n)*csgn(I*e*(b*x+a)^n/((d*x...
 

Fricas [F]

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

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

Output:

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

Sympy [F(-2)]

Exception generated. \[ \int (a+b x)^2 \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2 \, dx=\text {Exception raised: HeuristicGCDFailed} \] Input:

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

Output:

Exception raised: HeuristicGCDFailed >> no luck
 

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 1284 vs. \(2 (252) = 504\).

Time = 0.59 (sec) , antiderivative size = 1284, normalized size of antiderivative = 4.88 \[ \int (a+b x)^2 \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2 \, dx=\text {Too large to display} \] Input:

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

Output:

2/3*A*B*b^2*x^3*log((b*x + a)^n*e/(d*x + c)^n) + 1/3*A^2*b^2*x^3 + 2*A*B*a 
*b*x^2*log((b*x + a)^n*e/(d*x + c)^n) + A^2*a*b*x^2 + 2*A*B*a^2*x*log((b*x 
 + a)^n*e/(d*x + c)^n) + A^2*a^2*x + 2*(a*e*n*log(b*x + a)/b - c*e*n*log(d 
*x + c)/d)*A*B*a^2/e - 2*(a^2*e*n*log(b*x + a)/b^2 - c^2*e*n*log(d*x + c)/ 
d^2 + (b*c*e*n - a*d*e*n)*x/(b*d))*A*B*a*b/e + 1/3*(2*a^3*e*n*log(b*x + a) 
/b^3 - 2*c^3*e*n*log(d*x + c)/d^3 - ((b^2*c*d*e*n - a*b*d^2*e*n)*x^2 - 2*( 
b^2*c^2*e*n - a^2*d^2*e*n)*x)/(b^2*d^2))*A*B*b^2/e - 1/3*((3*n^2 + 2*n*log 
(e))*b^2*c^3 - (7*n^2 + 6*n*log(e))*a*b*c^2*d + 2*(2*n^2 + 3*n*log(e))*a^2 
*c*d^2)*B^2*log(d*x + c)/d^3 - 2/3*(b^3*c^3*n^2 - 3*a*b^2*c^2*d*n^2 + 3*a^ 
2*b*c*d^2*n^2 - a^3*d^3*n^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*d^3) + 1/3*(B^2*b^3*d^3*x^ 
3*log(e)^2 - B^2*a^3*d^3*n^2*log(b*x + a)^2 - (b^3*c*d^2*n*log(e) - (n*log 
(e) + 3*log(e)^2)*a*b^2*d^3)*B^2*x^2 + 2*(b^3*c^3*n^2 - 3*a*b^2*c^2*d*n^2 
+ 3*a^2*b*c*d^2*n^2)*B^2*log(b*x + a)*log(d*x + c) - (b^3*c^3*n^2 - 3*a*b^ 
2*c^2*d*n^2 + 3*a^2*b*c*d^2*n^2)*B^2*log(d*x + c)^2 + ((n^2 + 2*n*log(e))* 
b^3*c^2*d - 2*(n^2 + 3*n*log(e))*a*b^2*c*d^2 + (n^2 + 4*n*log(e) + 3*log(e 
)^2)*a^2*b*d^3)*B^2*x + (2*a*b^2*c^2*d*n^2 - 5*a^2*b*c*d^2*n^2 + (3*n^2 + 
2*n*log(e))*a^3*d^3)*B^2*log(b*x + a) + (B^2*b^3*d^3*x^3 + 3*B^2*a*b^2*d^3 
*x^2 + 3*B^2*a^2*b*d^3*x)*log((b*x + a)^n)^2 + (B^2*b^3*d^3*x^3 + 3*B^2*a* 
b^2*d^3*x^2 + 3*B^2*a^2*b*d^3*x)*log((d*x + c)^n)^2 + (2*B^2*b^3*d^3*x^...
 

Giac [F]

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

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

Output:

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

Mupad [F(-1)]

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

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

Output:

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

Reduce [F]

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

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

Output:

(2*int((log(((a + b*x)**n*e)/(c + d*x)**n)*x)/(a*c + a*d*x + b*c*x + b*d*x 
**2),x)*a**3*b**2*d**4*n - 6*int((log(((a + b*x)**n*e)/(c + d*x)**n)*x)/(a 
*c + a*d*x + b*c*x + b*d*x**2),x)*a**2*b**3*c*d**3*n + 6*int((log(((a + b* 
x)**n*e)/(c + d*x)**n)*x)/(a*c + a*d*x + b*c*x + b*d*x**2),x)*a*b**4*c**2* 
d**2*n - 2*int((log(((a + b*x)**n*e)/(c + d*x)**n)*x)/(a*c + a*d*x + b*c*x 
 + b*d*x**2),x)*b**5*c**3*d*n + 2*log(c + d*x)*a**4*d**3*n - 6*log(c + d*x 
)*a**3*b*c*d**2*n + 3*log(c + d*x)*a**3*b*d**3*n**2 + 6*log(c + d*x)*a**2* 
b**2*c**2*d*n - 9*log(c + d*x)*a**2*b**2*c*d**2*n**2 - 2*log(c + d*x)*a*b* 
*3*c**3*n + 9*log(c + d*x)*a*b**3*c**2*d*n**2 - 3*log(c + d*x)*b**4*c**3*n 
**2 + 2*log(((a + b*x)**n*e)/(c + d*x)**n)**2*a**2*b**2*c*d**2 + 3*log(((a 
 + b*x)**n*e)/(c + d*x)**n)**2*a**2*b**2*d**3*x - log(((a + b*x)**n*e)/(c 
+ d*x)**n)**2*a*b**3*c**2*d + 3*log(((a + b*x)**n*e)/(c + d*x)**n)**2*a*b* 
*3*d**3*x**2 + log(((a + b*x)**n*e)/(c + d*x)**n)**2*b**4*d**3*x**3 + 2*lo 
g(((a + b*x)**n*e)/(c + d*x)**n)*a**4*d**3 + 3*log(((a + b*x)**n*e)/(c + d 
*x)**n)*a**3*b*d**3*n + 6*log(((a + b*x)**n*e)/(c + d*x)**n)*a**3*b*d**3*x 
 - 5*log(((a + b*x)**n*e)/(c + d*x)**n)*a**2*b**2*c*d**2*n + 4*log(((a + b 
*x)**n*e)/(c + d*x)**n)*a**2*b**2*d**3*n*x + 6*log(((a + b*x)**n*e)/(c + d 
*x)**n)*a**2*b**2*d**3*x**2 + 2*log(((a + b*x)**n*e)/(c + d*x)**n)*a*b**3* 
c**2*d*n - 6*log(((a + b*x)**n*e)/(c + d*x)**n)*a*b**3*c*d**2*n*x + log((( 
a + b*x)**n*e)/(c + d*x)**n)*a*b**3*d**3*n*x**2 + 2*log(((a + b*x)**n*e...