Optimal. Leaf size=86 \[ \frac {\sqrt {b^2-4 a c} n \tanh ^{-1}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right )}{a}+\frac {b n \log (x)}{a}-\frac {b n \log \left (a+b x+c x^2\right )}{2 a}-\frac {\log \left (d \left (a+b x+c x^2\right )^n\right )}{x} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.08, antiderivative size = 86, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 6, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.316, Rules used = {2605, 814, 648,
632, 212, 642} \begin {gather*} \frac {n \sqrt {b^2-4 a c} \tanh ^{-1}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right )}{a}-\frac {\log \left (d \left (a+b x+c x^2\right )^n\right )}{x}-\frac {b n \log \left (a+b x+c x^2\right )}{2 a}+\frac {b n \log (x)}{a} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 212
Rule 632
Rule 642
Rule 648
Rule 814
Rule 2605
Rubi steps
\begin {align*} \int \frac {\log \left (d \left (a+b x+c x^2\right )^n\right )}{x^2} \, dx &=-\frac {\log \left (d \left (a+b x+c x^2\right )^n\right )}{x}+n \int \frac {b+2 c x}{x \left (a+b x+c x^2\right )} \, dx\\ &=-\frac {\log \left (d \left (a+b x+c x^2\right )^n\right )}{x}+n \int \left (\frac {b}{a x}+\frac {-b^2+2 a c-b c x}{a \left (a+b x+c x^2\right )}\right ) \, dx\\ &=\frac {b n \log (x)}{a}-\frac {\log \left (d \left (a+b x+c x^2\right )^n\right )}{x}+\frac {n \int \frac {-b^2+2 a c-b c x}{a+b x+c x^2} \, dx}{a}\\ &=\frac {b n \log (x)}{a}-\frac {\log \left (d \left (a+b x+c x^2\right )^n\right )}{x}-\frac {(b n) \int \frac {b+2 c x}{a+b x+c x^2} \, dx}{2 a}-\frac {\left (\left (b^2-4 a c\right ) n\right ) \int \frac {1}{a+b x+c x^2} \, dx}{2 a}\\ &=\frac {b n \log (x)}{a}-\frac {b n \log \left (a+b x+c x^2\right )}{2 a}-\frac {\log \left (d \left (a+b x+c x^2\right )^n\right )}{x}+\frac {\left (\left (b^2-4 a c\right ) n\right ) \text {Subst}\left (\int \frac {1}{b^2-4 a c-x^2} \, dx,x,b+2 c x\right )}{a}\\ &=\frac {\sqrt {b^2-4 a c} n \tanh ^{-1}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right )}{a}+\frac {b n \log (x)}{a}-\frac {b n \log \left (a+b x+c x^2\right )}{2 a}-\frac {\log \left (d \left (a+b x+c x^2\right )^n\right )}{x}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.08, size = 87, normalized size = 1.01 \begin {gather*} \frac {2 \sqrt {-b^2+4 a c} n \tan ^{-1}\left (\frac {b+2 c x}{\sqrt {-b^2+4 a c}}\right )+2 b n \log (x)-b n \log (a+x (b+c x))-\frac {2 a \log \left (d (a+x (b+c x))^n\right )}{x}}{2 a} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [C] Result contains higher order function than in optimal. Order 9 vs. order
3.
time = 0.05, size = 261, normalized size = 3.03
method | result | size |
risch | \(-\frac {\ln \left (\left (c \,x^{2}+b x +a \right )^{n}\right )}{x}+\frac {i \pi a \,\mathrm {csgn}\left (i d \right ) \mathrm {csgn}\left (i \left (c \,x^{2}+b x +a \right )^{n}\right ) \mathrm {csgn}\left (i d \left (c \,x^{2}+b x +a \right )^{n}\right )-i \pi a \,\mathrm {csgn}\left (i d \right ) \mathrm {csgn}\left (i d \left (c \,x^{2}+b x +a \right )^{n}\right )^{2}-i \pi a \,\mathrm {csgn}\left (i \left (c \,x^{2}+b x +a \right )^{n}\right ) \mathrm {csgn}\left (i d \left (c \,x^{2}+b x +a \right )^{n}\right )^{2}+i \pi a \mathrm {csgn}\left (i d \left (c \,x^{2}+b x +a \right )^{n}\right )^{3}+2 b n \ln \left (x \right ) x +2 \left (\munderset {\textit {\_R} =\RootOf \left (a \,\textit {\_Z}^{2}+b n \textit {\_Z} +c \,n^{2}\right )}{\sum }\textit {\_R} \ln \left (\left (\left (6 a c -2 b^{2}\right ) \textit {\_R}^{2}+\textit {\_R} b c n +4 c^{2} n^{2}\right ) x -a b \,\textit {\_R}^{2}+\left (-2 a c n +b^{2} n \right ) \textit {\_R} +2 b c \,n^{2}\right )\right ) a x -2 \ln \left (d \right ) a}{2 a x}\) | \(261\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.38, size = 199, normalized size = 2.31 \begin {gather*} \left [\frac {2 \, b n x \log \left (x\right ) + \sqrt {b^{2} - 4 \, a c} n x \log \left (\frac {2 \, c^{2} x^{2} + 2 \, b c x + b^{2} - 2 \, a c + \sqrt {b^{2} - 4 \, a c} {\left (2 \, c x + b\right )}}{c x^{2} + b x + a}\right ) - {\left (b n x + 2 \, a n\right )} \log \left (c x^{2} + b x + a\right ) - 2 \, a \log \left (d\right )}{2 \, a x}, \frac {2 \, b n x \log \left (x\right ) + 2 \, \sqrt {-b^{2} + 4 \, a c} n x \arctan \left (-\frac {\sqrt {-b^{2} + 4 \, a c} {\left (2 \, c x + b\right )}}{b^{2} - 4 \, a c}\right ) - {\left (b n x + 2 \, a n\right )} \log \left (c x^{2} + b x + a\right ) - 2 \, a \log \left (d\right )}{2 \, a x}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 211 vs.
\(2 (78) = 156\).
time = 198.61, size = 211, normalized size = 2.45 \begin {gather*} \begin {cases} - \frac {n}{x} - \frac {\log {\left (d \left (b x\right )^{n} \right )}}{x} & \text {for}\: a = 0 \wedge c = 0 \\- \frac {n}{x} - \frac {\log {\left (d \left (b x + c x^{2}\right )^{n} \right )}}{x} - \frac {2 c n \log {\left (b + c x \right )}}{b} + \frac {c \log {\left (d \left (b x + c x^{2}\right )^{n} \right )}}{b} & \text {for}\: a = 0 \\- \frac {\log {\left (d \left (a + b x\right )^{n} \right )}}{x} + \frac {b n \log {\left (x \right )}}{a} - \frac {b \log {\left (d \left (a + b x\right )^{n} \right )}}{a} & \text {for}\: c = 0 \\- \frac {\log {\left (d \left (a + b x + c x^{2}\right )^{n} \right )}}{x} + \frac {b n \log {\left (x \right )}}{a} - \frac {b \log {\left (d \left (a + b x + c x^{2}\right )^{n} \right )}}{2 a} + \frac {n \sqrt {- 4 a c + b^{2}} \log {\left (\frac {b}{2 c} + x + \frac {\sqrt {- 4 a c + b^{2}}}{2 c} \right )}}{a} - \frac {\sqrt {- 4 a c + b^{2}} \log {\left (d \left (a + b x + c x^{2}\right )^{n} \right )}}{2 a} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 3.14, size = 99, normalized size = 1.15 \begin {gather*} -\frac {b n \log \left (c x^{2} + b x + a\right )}{2 \, a} + \frac {b n \log \left (x\right )}{a} - \frac {n \log \left (c x^{2} + b x + a\right )}{x} - \frac {{\left (b^{2} n - 4 \, a c n\right )} \arctan \left (\frac {2 \, c x + b}{\sqrt {-b^{2} + 4 \, a c}}\right )}{\sqrt {-b^{2} + 4 \, a c} a} - \frac {\log \left (d\right )}{x} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.93, size = 262, normalized size = 3.05 \begin {gather*} \frac {b\,n\,\ln \left (x\right )}{a}-\frac {\ln \left (2\,b\,c^2\,n^2+4\,c^3\,n^2\,x-\frac {n\,\left (b-\sqrt {b^2-4\,a\,c}\right )\,\left (b^2\,c\,n-2\,a\,c^2\,n+b\,c^2\,n\,x+\frac {c\,n\,\left (b-\sqrt {b^2-4\,a\,c}\right )\,\left (2\,x\,b^2+a\,b-6\,a\,c\,x\right )}{2\,a}\right )}{2\,a}\right )\,\left (b\,n-n\,\sqrt {b^2-4\,a\,c}\right )}{2\,a}-\frac {\ln \left (2\,b\,c^2\,n^2+4\,c^3\,n^2\,x-\frac {n\,\left (b+\sqrt {b^2-4\,a\,c}\right )\,\left (b^2\,c\,n-2\,a\,c^2\,n+b\,c^2\,n\,x+\frac {c\,n\,\left (b+\sqrt {b^2-4\,a\,c}\right )\,\left (2\,x\,b^2+a\,b-6\,a\,c\,x\right )}{2\,a}\right )}{2\,a}\right )\,\left (b\,n+n\,\sqrt {b^2-4\,a\,c}\right )}{2\,a}-\frac {\ln \left (d\,{\left (c\,x^2+b\,x+a\right )}^n\right )}{x} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________