\(\int \log ^2(d (a+b x+c x^2)^n) \, dx\) [97]

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

Optimal result

Integrand size = 17, antiderivative size = 587 \[ \int \log ^2\left (d \left (a+b x+c x^2\right )^n\right ) \, dx=8 n^2 x-\frac {4 \sqrt {b^2-4 a c} n^2 \text {arctanh}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right )}{c}-\frac {\left (b-\sqrt {b^2-4 a c}\right ) n^2 \log ^2\left (b-\sqrt {b^2-4 a c}+2 c x\right )}{2 c}-\frac {\left (b+\sqrt {b^2-4 a c}\right ) n^2 \log \left (-\frac {b-\sqrt {b^2-4 a c}+2 c x}{2 \sqrt {b^2-4 a c}}\right ) \log \left (b+\sqrt {b^2-4 a c}+2 c x\right )}{c}-\frac {\left (b+\sqrt {b^2-4 a c}\right ) n^2 \log ^2\left (b+\sqrt {b^2-4 a c}+2 c x\right )}{2 c}-\frac {\left (b-\sqrt {b^2-4 a c}\right ) n^2 \log \left (b-\sqrt {b^2-4 a c}+2 c x\right ) \log \left (\frac {b+\sqrt {b^2-4 a c}+2 c x}{2 \sqrt {b^2-4 a c}}\right )}{c}-\frac {2 b n^2 \log \left (a+b x+c x^2\right )}{c}-4 n x \log \left (d \left (a+b x+c x^2\right )^n\right )+\frac {\left (b-\sqrt {b^2-4 a c}\right ) n \log \left (b-\sqrt {b^2-4 a c}+2 c x\right ) \log \left (d \left (a+b x+c x^2\right )^n\right )}{c}+\frac {\left (b+\sqrt {b^2-4 a c}\right ) n \log \left (b+\sqrt {b^2-4 a c}+2 c x\right ) \log \left (d \left (a+b x+c x^2\right )^n\right )}{c}+x \log ^2\left (d \left (a+b x+c x^2\right )^n\right )-\frac {\left (b-\sqrt {b^2-4 a c}\right ) n^2 \operatorname {PolyLog}\left (2,-\frac {b-\sqrt {b^2-4 a c}+2 c x}{2 \sqrt {b^2-4 a c}}\right )}{c}-\frac {\left (b+\sqrt {b^2-4 a c}\right ) n^2 \operatorname {PolyLog}\left (2,\frac {b+\sqrt {b^2-4 a c}+2 c x}{2 \sqrt {b^2-4 a c}}\right )}{c} \] Output:

8*n^2*x-4*(-4*a*c+b^2)^(1/2)*n^2*arctanh((2*c*x+b)/(-4*a*c+b^2)^(1/2))/c-1 
/2*(b-(-4*a*c+b^2)^(1/2))*n^2*ln(b-(-4*a*c+b^2)^(1/2)+2*c*x)^2/c-(b+(-4*a* 
c+b^2)^(1/2))*n^2*ln(-1/2*(b-(-4*a*c+b^2)^(1/2)+2*c*x)/(-4*a*c+b^2)^(1/2)) 
*ln(b+(-4*a*c+b^2)^(1/2)+2*c*x)/c-1/2*(b+(-4*a*c+b^2)^(1/2))*n^2*ln(b+(-4* 
a*c+b^2)^(1/2)+2*c*x)^2/c-(b-(-4*a*c+b^2)^(1/2))*n^2*ln(b-(-4*a*c+b^2)^(1/ 
2)+2*c*x)*ln(1/2*(b+(-4*a*c+b^2)^(1/2)+2*c*x)/(-4*a*c+b^2)^(1/2))/c-2*b*n^ 
2*ln(c*x^2+b*x+a)/c-4*n*x*ln(d*(c*x^2+b*x+a)^n)+(b-(-4*a*c+b^2)^(1/2))*n*l 
n(b-(-4*a*c+b^2)^(1/2)+2*c*x)*ln(d*(c*x^2+b*x+a)^n)/c+(b+(-4*a*c+b^2)^(1/2 
))*n*ln(b+(-4*a*c+b^2)^(1/2)+2*c*x)*ln(d*(c*x^2+b*x+a)^n)/c+x*ln(d*(c*x^2+ 
b*x+a)^n)^2-(b-(-4*a*c+b^2)^(1/2))*n^2*polylog(2,-1/2*(b-(-4*a*c+b^2)^(1/2 
)+2*c*x)/(-4*a*c+b^2)^(1/2))/c-(b+(-4*a*c+b^2)^(1/2))*n^2*polylog(2,1/2*(b 
+(-4*a*c+b^2)^(1/2)+2*c*x)/(-4*a*c+b^2)^(1/2))/c
 

Mathematica [A] (verified)

Time = 1.00 (sec) , antiderivative size = 478, normalized size of antiderivative = 0.81 \[ \int \log ^2\left (d \left (a+b x+c x^2\right )^n\right ) \, dx=x \log ^2\left (d (a+x (b+c x))^n\right )+\frac {n \left (4 n \left (4 c x-2 \sqrt {b^2-4 a c} \text {arctanh}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right )-b \log (a+x (b+c x))\right )-8 c x \log \left (d (a+x (b+c x))^n\right )+2 \left (b-\sqrt {b^2-4 a c}\right ) \log \left (b-\sqrt {b^2-4 a c}+2 c x\right ) \log \left (d (a+x (b+c x))^n\right )+2 \left (b+\sqrt {b^2-4 a c}\right ) \log \left (b+\sqrt {b^2-4 a c}+2 c x\right ) \log \left (d (a+x (b+c x))^n\right )+\left (-b+\sqrt {b^2-4 a c}\right ) n \left (\log \left (b-\sqrt {b^2-4 a c}+2 c x\right ) \left (\log \left (b-\sqrt {b^2-4 a c}+2 c x\right )+2 \log \left (\frac {b+\sqrt {b^2-4 a c}+2 c x}{2 \sqrt {b^2-4 a c}}\right )\right )+2 \operatorname {PolyLog}\left (2,\frac {-b+\sqrt {b^2-4 a c}-2 c x}{2 \sqrt {b^2-4 a c}}\right )\right )-\left (b+\sqrt {b^2-4 a c}\right ) n \left (\log \left (b+\sqrt {b^2-4 a c}+2 c x\right ) \left (2 \log \left (\frac {-b+\sqrt {b^2-4 a c}-2 c x}{2 \sqrt {b^2-4 a c}}\right )+\log \left (b+\sqrt {b^2-4 a c}+2 c x\right )\right )+2 \operatorname {PolyLog}\left (2,\frac {b+\sqrt {b^2-4 a c}+2 c x}{2 \sqrt {b^2-4 a c}}\right )\right )\right )}{2 c} \] Input:

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

Output:

x*Log[d*(a + x*(b + c*x))^n]^2 + (n*(4*n*(4*c*x - 2*Sqrt[b^2 - 4*a*c]*ArcT 
anh[(b + 2*c*x)/Sqrt[b^2 - 4*a*c]] - b*Log[a + x*(b + c*x)]) - 8*c*x*Log[d 
*(a + x*(b + c*x))^n] + 2*(b - Sqrt[b^2 - 4*a*c])*Log[b - Sqrt[b^2 - 4*a*c 
] + 2*c*x]*Log[d*(a + x*(b + c*x))^n] + 2*(b + Sqrt[b^2 - 4*a*c])*Log[b + 
Sqrt[b^2 - 4*a*c] + 2*c*x]*Log[d*(a + x*(b + c*x))^n] + (-b + Sqrt[b^2 - 4 
*a*c])*n*(Log[b - Sqrt[b^2 - 4*a*c] + 2*c*x]*(Log[b - Sqrt[b^2 - 4*a*c] + 
2*c*x] + 2*Log[(b + Sqrt[b^2 - 4*a*c] + 2*c*x)/(2*Sqrt[b^2 - 4*a*c])]) + 2 
*PolyLog[2, (-b + Sqrt[b^2 - 4*a*c] - 2*c*x)/(2*Sqrt[b^2 - 4*a*c])]) - (b 
+ Sqrt[b^2 - 4*a*c])*n*(Log[b + Sqrt[b^2 - 4*a*c] + 2*c*x]*(2*Log[(-b + Sq 
rt[b^2 - 4*a*c] - 2*c*x)/(2*Sqrt[b^2 - 4*a*c])] + Log[b + Sqrt[b^2 - 4*a*c 
] + 2*c*x]) + 2*PolyLog[2, (b + Sqrt[b^2 - 4*a*c] + 2*c*x)/(2*Sqrt[b^2 - 4 
*a*c])])))/(2*c)
 

Rubi [A] (verified)

Time = 1.29 (sec) , antiderivative size = 583, normalized size of antiderivative = 0.99, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.176, Rules used = {3003, 3008, 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 \log ^2\left (d \left (a+b x+c x^2\right )^n\right ) \, dx\)

\(\Big \downarrow \) 3003

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

\(\Big \downarrow \) 3008

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

\(\Big \downarrow \) 2009

\(\displaystyle x \log ^2\left (d \left (a+b x+c x^2\right )^n\right )-2 n \left (\frac {2 n \sqrt {b^2-4 a c} \text {arctanh}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right )}{c}-\frac {\left (b-\sqrt {b^2-4 a c}\right ) \log \left (-\sqrt {b^2-4 a c}+b+2 c x\right ) \log \left (d \left (a+b x+c x^2\right )^n\right )}{2 c}-\frac {\left (\sqrt {b^2-4 a c}+b\right ) \log \left (\sqrt {b^2-4 a c}+b+2 c x\right ) \log \left (d \left (a+b x+c x^2\right )^n\right )}{2 c}+\frac {n \left (b-\sqrt {b^2-4 a c}\right ) \operatorname {PolyLog}\left (2,-\frac {b+2 c x-\sqrt {b^2-4 a c}}{2 \sqrt {b^2-4 a c}}\right )}{2 c}+\frac {n \left (\sqrt {b^2-4 a c}+b\right ) \operatorname {PolyLog}\left (2,\frac {b+2 c x+\sqrt {b^2-4 a c}}{2 \sqrt {b^2-4 a c}}\right )}{2 c}+\frac {n \left (b-\sqrt {b^2-4 a c}\right ) \log ^2\left (-\sqrt {b^2-4 a c}+b+2 c x\right )}{4 c}+\frac {n \left (\sqrt {b^2-4 a c}+b\right ) \log ^2\left (\sqrt {b^2-4 a c}+b+2 c x\right )}{4 c}+\frac {n \left (b-\sqrt {b^2-4 a c}\right ) \log \left (\frac {\sqrt {b^2-4 a c}+b+2 c x}{2 \sqrt {b^2-4 a c}}\right ) \log \left (-\sqrt {b^2-4 a c}+b+2 c x\right )}{2 c}+\frac {n \left (\sqrt {b^2-4 a c}+b\right ) \log \left (-\frac {-\sqrt {b^2-4 a c}+b+2 c x}{2 \sqrt {b^2-4 a c}}\right ) \log \left (\sqrt {b^2-4 a c}+b+2 c x\right )}{2 c}+2 x \log \left (d \left (a+b x+c x^2\right )^n\right )+\frac {b n \log \left (a+b x+c x^2\right )}{c}-4 n x\right )\)

Input:

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

Output:

x*Log[d*(a + b*x + c*x^2)^n]^2 - 2*n*(-4*n*x + (2*Sqrt[b^2 - 4*a*c]*n*ArcT 
anh[(b + 2*c*x)/Sqrt[b^2 - 4*a*c]])/c + ((b - Sqrt[b^2 - 4*a*c])*n*Log[b - 
 Sqrt[b^2 - 4*a*c] + 2*c*x]^2)/(4*c) + ((b + Sqrt[b^2 - 4*a*c])*n*Log[-1/2 
*(b - Sqrt[b^2 - 4*a*c] + 2*c*x)/Sqrt[b^2 - 4*a*c]]*Log[b + Sqrt[b^2 - 4*a 
*c] + 2*c*x])/(2*c) + ((b + Sqrt[b^2 - 4*a*c])*n*Log[b + Sqrt[b^2 - 4*a*c] 
 + 2*c*x]^2)/(4*c) + ((b - Sqrt[b^2 - 4*a*c])*n*Log[b - Sqrt[b^2 - 4*a*c] 
+ 2*c*x]*Log[(b + Sqrt[b^2 - 4*a*c] + 2*c*x)/(2*Sqrt[b^2 - 4*a*c])])/(2*c) 
 + (b*n*Log[a + b*x + c*x^2])/c + 2*x*Log[d*(a + b*x + c*x^2)^n] - ((b - S 
qrt[b^2 - 4*a*c])*Log[b - Sqrt[b^2 - 4*a*c] + 2*c*x]*Log[d*(a + b*x + c*x^ 
2)^n])/(2*c) - ((b + Sqrt[b^2 - 4*a*c])*Log[b + Sqrt[b^2 - 4*a*c] + 2*c*x] 
*Log[d*(a + b*x + c*x^2)^n])/(2*c) + ((b - Sqrt[b^2 - 4*a*c])*n*PolyLog[2, 
 -1/2*(b - Sqrt[b^2 - 4*a*c] + 2*c*x)/Sqrt[b^2 - 4*a*c]])/(2*c) + ((b + Sq 
rt[b^2 - 4*a*c])*n*PolyLog[2, (b + Sqrt[b^2 - 4*a*c] + 2*c*x)/(2*Sqrt[b^2 
- 4*a*c])])/(2*c))
 

Defintions of rubi rules used

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

rule 3003
Int[((a_.) + Log[(c_.)*(RFx_)^(p_.)]*(b_.))^(n_.), x_Symbol] :> Simp[x*(a + 
 b*Log[c*RFx^p])^n, x] - Simp[b*n*p   Int[SimplifyIntegrand[x*(a + b*Log[c* 
RFx^p])^(n - 1)*(D[RFx, x]/RFx), x], x], x] /; FreeQ[{a, b, c, p}, x] && Ra 
tionalFunctionQ[RFx, x] && IGtQ[n, 0]
 

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

\[\int {\ln \left (d \left (c \,x^{2}+b x +a \right )^{n}\right )}^{2}d x\]

Input:

int(ln(d*(c*x^2+b*x+a)^n)^2,x)
 

Output:

int(ln(d*(c*x^2+b*x+a)^n)^2,x)
 

Fricas [F]

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

integrate(log(d*(c*x^2+b*x+a)^n)^2,x, algorithm="fricas")
 

Output:

integral(log((c*x^2 + b*x + a)^n*d)^2, x)
 

Sympy [F]

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

integrate(ln(d*(c*x**2+b*x+a)**n)**2,x)
 

Output:

Integral(log(d*(a + b*x + c*x**2)**n)**2, x)
 

Maxima [F(-2)]

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

integrate(log(d*(c*x^2+b*x+a)^n)^2,x, algorithm="maxima")
 

Output:

Exception raised: ValueError >> Computation failed since Maxima requested 
additional constraints; using the 'assume' command before evaluation *may* 
 help (example of legal syntax is 'assume(4*a*c-b^2>0)', see `assume?` for 
 more deta
 

Giac [F]

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

integrate(log(d*(c*x^2+b*x+a)^n)^2,x, algorithm="giac")
 

Output:

integrate(log((c*x^2 + b*x + a)^n*d)^2, x)
 

Mupad [F(-1)]

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

int(log(d*(a + b*x + c*x^2)^n)^2,x)
 

Output:

int(log(d*(a + b*x + c*x^2)^n)^2, x)
 

Reduce [F]

\[ \int \log ^2\left (d \left (a+b x+c x^2\right )^n\right ) \, dx=\frac {-8 \sqrt {4 a c -b^{2}}\, \mathit {atan} \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right ) n^{2}+8 \left (\int \frac {\mathrm {log}\left (\left (c \,x^{2}+b x +a \right )^{n} d \right )}{c \,x^{2}+b x +a}d x \right ) a c n -2 \left (\int \frac {\mathrm {log}\left (\left (c \,x^{2}+b x +a \right )^{n} d \right )}{c \,x^{2}+b x +a}d x \right ) b^{2} n +{\mathrm {log}\left (\left (c \,x^{2}+b x +a \right )^{n} d \right )}^{2} b +2 {\mathrm {log}\left (\left (c \,x^{2}+b x +a \right )^{n} d \right )}^{2} c x -4 \,\mathrm {log}\left (\left (c \,x^{2}+b x +a \right )^{n} d \right ) b n -8 \,\mathrm {log}\left (\left (c \,x^{2}+b x +a \right )^{n} d \right ) c n x +16 c \,n^{2} x}{2 c} \] Input:

int(log(d*(c*x^2+b*x+a)^n)^2,x)
 

Output:

( - 8*sqrt(4*a*c - b**2)*atan((b + 2*c*x)/sqrt(4*a*c - b**2))*n**2 + 8*int 
(log((a + b*x + c*x**2)**n*d)/(a + b*x + c*x**2),x)*a*c*n - 2*int(log((a + 
 b*x + c*x**2)**n*d)/(a + b*x + c*x**2),x)*b**2*n + log((a + b*x + c*x**2) 
**n*d)**2*b + 2*log((a + b*x + c*x**2)**n*d)**2*c*x - 4*log((a + b*x + c*x 
**2)**n*d)*b*n - 8*log((a + b*x + c*x**2)**n*d)*c*n*x + 16*c*n**2*x)/(2*c)