\(\int \frac {3 a b x-2 (a+b) x^2+x^3}{\sqrt {x (-a+x) (-b+x)} (-a b+(a+b) x-x^2+d x^3)} \, dx\) [519]

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

Optimal result

Integrand size = 56, antiderivative size = 40 \[ \int \frac {3 a b x-2 (a+b) x^2+x^3}{\sqrt {x (-a+x) (-b+x)} \left (-a b+(a+b) x-x^2+d x^3\right )} \, dx=-\frac {2 \text {arctanh}\left (\frac {\sqrt {a b x+(-a-b) x^2+x^3}}{\sqrt {d} x^2}\right )}{\sqrt {d}} \]

[Out]

-2*arctanh((a*b*x+(-a-b)*x^2+x^3)^(1/2)/d^(1/2)/x^2)/d^(1/2)

Rubi [F]

\[ \int \frac {3 a b x-2 (a+b) x^2+x^3}{\sqrt {x (-a+x) (-b+x)} \left (-a b+(a+b) x-x^2+d x^3\right )} \, dx=\int \frac {3 a b x-2 (a+b) x^2+x^3}{\sqrt {x (-a+x) (-b+x)} \left (-a b+(a+b) x-x^2+d x^3\right )} \, dx \]

[In]

Int[(3*a*b*x - 2*(a + b)*x^2 + x^3)/(Sqrt[x*(-a + x)*(-b + x)]*(-(a*b) + (a + b)*x - x^2 + d*x^3)),x]

[Out]

(2*Sqrt[b]*Sqrt[x]*Sqrt[1 - x/a]*Sqrt[1 - x/b]*EllipticF[ArcSin[Sqrt[x]/Sqrt[b]], b/a])/(d*Sqrt[(a - x)*(b - x
)*x]) + (2*(a + b - 3*a*b*d)*Sqrt[x]*Sqrt[-a + x]*Sqrt[-b + x]*Defer[Subst][Defer[Int][x^2/(Sqrt[-a + x^2]*Sqr
t[-b + x^2]*(a*b - a*(1 + b/a)*x^2 + x^4 - d*x^6)), x], x, Sqrt[x]])/(d*Sqrt[(a - x)*(b - x)*x]) - (2*(1 - 2*a
*d - 2*b*d)*Sqrt[x]*Sqrt[-a + x]*Sqrt[-b + x]*Defer[Subst][Defer[Int][x^4/(Sqrt[-a + x^2]*Sqrt[-b + x^2]*(a*b
- a*(1 + b/a)*x^2 + x^4 - d*x^6)), x], x, Sqrt[x]])/(d*Sqrt[(a - x)*(b - x)*x]) + (2*a*b*Sqrt[x]*Sqrt[-a + x]*
Sqrt[-b + x]*Defer[Subst][Defer[Int][1/(Sqrt[-a + x^2]*Sqrt[-b + x^2]*(-(a*b) + a*(1 + b/a)*x^2 - x^4 + d*x^6)
), x], x, Sqrt[x]])/(d*Sqrt[(a - x)*(b - x)*x])

Rubi steps \begin{align*} \text {integral}& = \int \frac {x \left (3 a b-2 (a+b) x+x^2\right )}{\sqrt {x (-a+x) (-b+x)} \left (-a b+(a+b) x-x^2+d x^3\right )} \, dx \\ & = \frac {\left (\sqrt {x} \sqrt {-a+x} \sqrt {-b+x}\right ) \int \frac {\sqrt {x} \left (3 a b-2 (a+b) x+x^2\right )}{\sqrt {-a+x} \sqrt {-b+x} \left (-a b+(a+b) x-x^2+d x^3\right )} \, dx}{\sqrt {x (-a+x) (-b+x)}} \\ & = \frac {\left (2 \sqrt {x} \sqrt {-a+x} \sqrt {-b+x}\right ) \text {Subst}\left (\int \frac {x^2 \left (3 a b-2 (a+b) x^2+x^4\right )}{\sqrt {-a+x^2} \sqrt {-b+x^2} \left (-a b+(a+b) x^2-x^4+d x^6\right )} \, dx,x,\sqrt {x}\right )}{\sqrt {x (-a+x) (-b+x)}} \\ & = \frac {\left (2 \sqrt {x} \sqrt {-a+x} \sqrt {-b+x}\right ) \text {Subst}\left (\int \left (\frac {1}{d \sqrt {-a+x^2} \sqrt {-b+x^2}}+\frac {a b-(b+a (1-3 b d)) x^2+(1-2 a d-2 b d) x^4}{d \sqrt {-a+x^2} \sqrt {-b+x^2} \left (-a b+(a+b) x^2-x^4+d x^6\right )}\right ) \, dx,x,\sqrt {x}\right )}{\sqrt {x (-a+x) (-b+x)}} \\ & = \frac {\left (2 \sqrt {x} \sqrt {-a+x} \sqrt {-b+x}\right ) \text {Subst}\left (\int \frac {1}{\sqrt {-a+x^2} \sqrt {-b+x^2}} \, dx,x,\sqrt {x}\right )}{d \sqrt {x (-a+x) (-b+x)}}+\frac {\left (2 \sqrt {x} \sqrt {-a+x} \sqrt {-b+x}\right ) \text {Subst}\left (\int \frac {a b-(b+a (1-3 b d)) x^2+(1-2 a d-2 b d) x^4}{\sqrt {-a+x^2} \sqrt {-b+x^2} \left (-a b+(a+b) x^2-x^4+d x^6\right )} \, dx,x,\sqrt {x}\right )}{d \sqrt {x (-a+x) (-b+x)}} \\ & = \frac {\left (2 \sqrt {x} \sqrt {-a+x} \sqrt {-b+x}\right ) \text {Subst}\left (\int \left (\frac {(b+a (1-3 b d)) x^2}{\sqrt {-a+x^2} \sqrt {-b+x^2} \left (a b-a \left (1+\frac {b}{a}\right ) x^2+x^4-d x^6\right )}+\frac {(-1+2 a d+2 b d) x^4}{\sqrt {-a+x^2} \sqrt {-b+x^2} \left (a b-a \left (1+\frac {b}{a}\right ) x^2+x^4-d x^6\right )}+\frac {a b}{\sqrt {-a+x^2} \sqrt {-b+x^2} \left (-a b+a \left (1+\frac {b}{a}\right ) x^2-x^4+d x^6\right )}\right ) \, dx,x,\sqrt {x}\right )}{d \sqrt {x (-a+x) (-b+x)}}+\frac {\left (2 \sqrt {x} \sqrt {-a+x} \sqrt {1-\frac {x}{b}}\right ) \text {Subst}\left (\int \frac {1}{\sqrt {-a+x^2} \sqrt {1-\frac {x^2}{b}}} \, dx,x,\sqrt {x}\right )}{d \sqrt {x (-a+x) (-b+x)}} \\ & = \frac {\left (2 a b \sqrt {x} \sqrt {-a+x} \sqrt {-b+x}\right ) \text {Subst}\left (\int \frac {1}{\sqrt {-a+x^2} \sqrt {-b+x^2} \left (-a b+a \left (1+\frac {b}{a}\right ) x^2-x^4+d x^6\right )} \, dx,x,\sqrt {x}\right )}{d \sqrt {x (-a+x) (-b+x)}}+\frac {\left (2 (-1+2 a d+2 b d) \sqrt {x} \sqrt {-a+x} \sqrt {-b+x}\right ) \text {Subst}\left (\int \frac {x^4}{\sqrt {-a+x^2} \sqrt {-b+x^2} \left (a b-a \left (1+\frac {b}{a}\right ) x^2+x^4-d x^6\right )} \, dx,x,\sqrt {x}\right )}{d \sqrt {x (-a+x) (-b+x)}}+\frac {\left (2 (a+b-3 a b d) \sqrt {x} \sqrt {-a+x} \sqrt {-b+x}\right ) \text {Subst}\left (\int \frac {x^2}{\sqrt {-a+x^2} \sqrt {-b+x^2} \left (a b-a \left (1+\frac {b}{a}\right ) x^2+x^4-d x^6\right )} \, dx,x,\sqrt {x}\right )}{d \sqrt {x (-a+x) (-b+x)}}+\frac {\left (2 \sqrt {x} \sqrt {1-\frac {x}{a}} \sqrt {1-\frac {x}{b}}\right ) \text {Subst}\left (\int \frac {1}{\sqrt {1-\frac {x^2}{a}} \sqrt {1-\frac {x^2}{b}}} \, dx,x,\sqrt {x}\right )}{d \sqrt {x (-a+x) (-b+x)}} \\ & = \frac {2 \sqrt {b} \sqrt {x} \sqrt {1-\frac {x}{a}} \sqrt {1-\frac {x}{b}} \operatorname {EllipticF}\left (\arcsin \left (\frac {\sqrt {x}}{\sqrt {b}}\right ),\frac {b}{a}\right )}{d \sqrt {(a-x) (b-x) x}}+\frac {\left (2 a b \sqrt {x} \sqrt {-a+x} \sqrt {-b+x}\right ) \text {Subst}\left (\int \frac {1}{\sqrt {-a+x^2} \sqrt {-b+x^2} \left (-a b+a \left (1+\frac {b}{a}\right ) x^2-x^4+d x^6\right )} \, dx,x,\sqrt {x}\right )}{d \sqrt {x (-a+x) (-b+x)}}+\frac {\left (2 (-1+2 a d+2 b d) \sqrt {x} \sqrt {-a+x} \sqrt {-b+x}\right ) \text {Subst}\left (\int \frac {x^4}{\sqrt {-a+x^2} \sqrt {-b+x^2} \left (a b-a \left (1+\frac {b}{a}\right ) x^2+x^4-d x^6\right )} \, dx,x,\sqrt {x}\right )}{d \sqrt {x (-a+x) (-b+x)}}+\frac {\left (2 (a+b-3 a b d) \sqrt {x} \sqrt {-a+x} \sqrt {-b+x}\right ) \text {Subst}\left (\int \frac {x^2}{\sqrt {-a+x^2} \sqrt {-b+x^2} \left (a b-a \left (1+\frac {b}{a}\right ) x^2+x^4-d x^6\right )} \, dx,x,\sqrt {x}\right )}{d \sqrt {x (-a+x) (-b+x)}} \\ \end{align*}

Mathematica [A] (verified)

Time = 12.47 (sec) , antiderivative size = 33, normalized size of antiderivative = 0.82 \[ \int \frac {3 a b x-2 (a+b) x^2+x^3}{\sqrt {x (-a+x) (-b+x)} \left (-a b+(a+b) x-x^2+d x^3\right )} \, dx=-\frac {2 \text {arctanh}\left (\frac {\sqrt {x (-a+x) (-b+x)}}{\sqrt {d} x^2}\right )}{\sqrt {d}} \]

[In]

Integrate[(3*a*b*x - 2*(a + b)*x^2 + x^3)/(Sqrt[x*(-a + x)*(-b + x)]*(-(a*b) + (a + b)*x - x^2 + d*x^3)),x]

[Out]

(-2*ArcTanh[Sqrt[x*(-a + x)*(-b + x)]/(Sqrt[d]*x^2)])/Sqrt[d]

Maple [C] (warning: unable to verify)

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

Time = 0.88 (sec) , antiderivative size = 293, normalized size of antiderivative = 7.32

method result size
elliptic \(-\frac {2 b \sqrt {-\frac {-b +x}{b}}\, \sqrt {\frac {-a +x}{-a +b}}\, \sqrt {\frac {x}{b}}\, \operatorname {EllipticF}\left (\sqrt {-\frac {-b +x}{b}}, \sqrt {\frac {b}{-a +b}}\right )}{d \sqrt {a b x -a \,x^{2}-b \,x^{2}+x^{3}}}+\frac {2 \left (\munderset {\underline {\hspace {1.25 ex}}\alpha =\operatorname {RootOf}\left (d \,\textit {\_Z}^{3}-\textit {\_Z}^{2}+\left (a +b \right ) \textit {\_Z} -a b \right )}{\sum }\frac {\left (2 \underline {\hspace {1.25 ex}}\alpha ^{2} a d +2 \underline {\hspace {1.25 ex}}\alpha ^{2} b d -3 \underline {\hspace {1.25 ex}}\alpha a b d -\underline {\hspace {1.25 ex}}\alpha ^{2}+\underline {\hspace {1.25 ex}}\alpha a +\underline {\hspace {1.25 ex}}\alpha b -a b \right ) \left (\underline {\hspace {1.25 ex}}\alpha ^{2} d +\underline {\hspace {1.25 ex}}\alpha b d +d \,b^{2}-\underline {\hspace {1.25 ex}}\alpha +a \right ) \sqrt {-\frac {-b +x}{b}}\, \sqrt {\frac {-a +x}{-a +b}}\, \sqrt {\frac {x}{b}}\, \operatorname {EllipticPi}\left (\sqrt {-\frac {-b +x}{b}}, \frac {\underline {\hspace {1.25 ex}}\alpha ^{2} d +\underline {\hspace {1.25 ex}}\alpha b d +d \,b^{2}-\underline {\hspace {1.25 ex}}\alpha +a}{b^{2} d}, \sqrt {\frac {b}{-a +b}}\right )}{\left (3 \underline {\hspace {1.25 ex}}\alpha ^{2} d -2 \underline {\hspace {1.25 ex}}\alpha +a +b \right ) \sqrt {x \left (a b -a x -b x +x^{2}\right )}}\right )}{d^{2} b^{2}}\) \(293\)
default \(-\frac {2 b \sqrt {-\frac {-b +x}{b}}\, \sqrt {\frac {-a +x}{-a +b}}\, \sqrt {\frac {x}{b}}\, \operatorname {EllipticF}\left (\sqrt {-\frac {-b +x}{b}}, \sqrt {\frac {b}{-a +b}}\right )}{d \sqrt {a b x -a \,x^{2}-b \,x^{2}+x^{3}}}+\frac {2 \left (\munderset {\underline {\hspace {1.25 ex}}\alpha =\operatorname {RootOf}\left (d \,\textit {\_Z}^{3}-\textit {\_Z}^{2}+\left (a +b \right ) \textit {\_Z} -a b \right )}{\sum }\frac {\left (-2 \underline {\hspace {1.25 ex}}\alpha ^{2} a d -2 \underline {\hspace {1.25 ex}}\alpha ^{2} b d +3 \underline {\hspace {1.25 ex}}\alpha a b d +\underline {\hspace {1.25 ex}}\alpha ^{2}-\underline {\hspace {1.25 ex}}\alpha a -\underline {\hspace {1.25 ex}}\alpha b +a b \right ) \left (\underline {\hspace {1.25 ex}}\alpha ^{2} d +\underline {\hspace {1.25 ex}}\alpha b d +d \,b^{2}-\underline {\hspace {1.25 ex}}\alpha +a \right ) \sqrt {-\frac {-b +x}{b}}\, \sqrt {\frac {-a +x}{-a +b}}\, \sqrt {\frac {x}{b}}\, \operatorname {EllipticPi}\left (\sqrt {-\frac {-b +x}{b}}, \frac {\underline {\hspace {1.25 ex}}\alpha ^{2} d +\underline {\hspace {1.25 ex}}\alpha b d +d \,b^{2}-\underline {\hspace {1.25 ex}}\alpha +a}{b^{2} d}, \sqrt {\frac {b}{-a +b}}\right )}{\left (-3 \underline {\hspace {1.25 ex}}\alpha ^{2} d +2 \underline {\hspace {1.25 ex}}\alpha -a -b \right ) \sqrt {x \left (a b -a x -b x +x^{2}\right )}}\right )}{d^{2} b^{2}}\) \(296\)

[In]

int((3*a*b*x-2*(a+b)*x^2+x^3)/(x*(-a+x)*(-b+x))^(1/2)/(-a*b+(a+b)*x-x^2+d*x^3),x,method=_RETURNVERBOSE)

[Out]

-2/d*b*(-(-b+x)/b)^(1/2)*((-a+x)/(-a+b))^(1/2)*(x/b)^(1/2)/(a*b*x-a*x^2-b*x^2+x^3)^(1/2)*EllipticF((-(-b+x)/b)
^(1/2),(b/(-a+b))^(1/2))+2/d^2/b^2*sum((2*_alpha^2*a*d+2*_alpha^2*b*d-3*_alpha*a*b*d-_alpha^2+_alpha*a+_alpha*
b-a*b)/(3*_alpha^2*d-2*_alpha+a+b)*(_alpha^2*d+_alpha*b*d+b^2*d-_alpha+a)*(-(-b+x)/b)^(1/2)*((-a+x)/(-a+b))^(1
/2)*(x/b)^(1/2)/(x*(a*b-a*x-b*x+x^2))^(1/2)*EllipticPi((-(-b+x)/b)^(1/2),(_alpha^2*d+_alpha*b*d+b^2*d-_alpha+a
)/b^2/d,(b/(-a+b))^(1/2)),_alpha=RootOf(d*_Z^3-_Z^2+(a+b)*_Z-a*b))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 77 vs. \(2 (31) = 62\).

Time = 0.99 (sec) , antiderivative size = 285, normalized size of antiderivative = 7.12 \[ \int \frac {3 a b x-2 (a+b) x^2+x^3}{\sqrt {x (-a+x) (-b+x)} \left (-a b+(a+b) x-x^2+d x^3\right )} \, dx=\left [\frac {\log \left (\frac {d^{2} x^{6} + 6 \, d x^{5} - {\left (6 \, {\left (a + b\right )} d - 1\right )} x^{4} + a^{2} b^{2} + 2 \, {\left (3 \, a b d - a - b\right )} x^{3} + {\left (a^{2} + 4 \, a b + b^{2}\right )} x^{2} - 4 \, {\left (d x^{4} + a b x - {\left (a + b\right )} x^{2} + x^{3}\right )} \sqrt {a b x - {\left (a + b\right )} x^{2} + x^{3}} \sqrt {d} - 2 \, {\left (a^{2} b + a b^{2}\right )} x}{d^{2} x^{6} - 2 \, d x^{5} + {\left (2 \, {\left (a + b\right )} d + 1\right )} x^{4} + a^{2} b^{2} - 2 \, {\left (a b d + a + b\right )} x^{3} + {\left (a^{2} + 4 \, a b + b^{2}\right )} x^{2} - 2 \, {\left (a^{2} b + a b^{2}\right )} x}\right )}{2 \, \sqrt {d}}, \frac {\sqrt {-d} \arctan \left (\frac {{\left (d x^{3} + a b - {\left (a + b\right )} x + x^{2}\right )} \sqrt {a b x - {\left (a + b\right )} x^{2} + x^{3}} \sqrt {-d}}{2 \, {\left (a b d x^{2} - {\left (a + b\right )} d x^{3} + d x^{4}\right )}}\right )}{d}\right ] \]

[In]

integrate((3*a*b*x-2*(a+b)*x^2+x^3)/(x*(-a+x)*(-b+x))^(1/2)/(-a*b+(a+b)*x-x^2+d*x^3),x, algorithm="fricas")

[Out]

[1/2*log((d^2*x^6 + 6*d*x^5 - (6*(a + b)*d - 1)*x^4 + a^2*b^2 + 2*(3*a*b*d - a - b)*x^3 + (a^2 + 4*a*b + b^2)*
x^2 - 4*(d*x^4 + a*b*x - (a + b)*x^2 + x^3)*sqrt(a*b*x - (a + b)*x^2 + x^3)*sqrt(d) - 2*(a^2*b + a*b^2)*x)/(d^
2*x^6 - 2*d*x^5 + (2*(a + b)*d + 1)*x^4 + a^2*b^2 - 2*(a*b*d + a + b)*x^3 + (a^2 + 4*a*b + b^2)*x^2 - 2*(a^2*b
 + a*b^2)*x))/sqrt(d), sqrt(-d)*arctan(1/2*(d*x^3 + a*b - (a + b)*x + x^2)*sqrt(a*b*x - (a + b)*x^2 + x^3)*sqr
t(-d)/(a*b*d*x^2 - (a + b)*d*x^3 + d*x^4))/d]

Sympy [F(-1)]

Timed out. \[ \int \frac {3 a b x-2 (a+b) x^2+x^3}{\sqrt {x (-a+x) (-b+x)} \left (-a b+(a+b) x-x^2+d x^3\right )} \, dx=\text {Timed out} \]

[In]

integrate((3*a*b*x-2*(a+b)*x**2+x**3)/(x*(-a+x)*(-b+x))**(1/2)/(-a*b+(a+b)*x-x**2+d*x**3),x)

[Out]

Timed out

Maxima [F]

\[ \int \frac {3 a b x-2 (a+b) x^2+x^3}{\sqrt {x (-a+x) (-b+x)} \left (-a b+(a+b) x-x^2+d x^3\right )} \, dx=\int { \frac {3 \, a b x - 2 \, {\left (a + b\right )} x^{2} + x^{3}}{{\left (d x^{3} - a b + {\left (a + b\right )} x - x^{2}\right )} \sqrt {{\left (a - x\right )} {\left (b - x\right )} x}} \,d x } \]

[In]

integrate((3*a*b*x-2*(a+b)*x^2+x^3)/(x*(-a+x)*(-b+x))^(1/2)/(-a*b+(a+b)*x-x^2+d*x^3),x, algorithm="maxima")

[Out]

integrate((3*a*b*x - 2*(a + b)*x^2 + x^3)/((d*x^3 - a*b + (a + b)*x - x^2)*sqrt((a - x)*(b - x)*x)), x)

Giac [F]

\[ \int \frac {3 a b x-2 (a+b) x^2+x^3}{\sqrt {x (-a+x) (-b+x)} \left (-a b+(a+b) x-x^2+d x^3\right )} \, dx=\int { \frac {3 \, a b x - 2 \, {\left (a + b\right )} x^{2} + x^{3}}{{\left (d x^{3} - a b + {\left (a + b\right )} x - x^{2}\right )} \sqrt {{\left (a - x\right )} {\left (b - x\right )} x}} \,d x } \]

[In]

integrate((3*a*b*x-2*(a+b)*x^2+x^3)/(x*(-a+x)*(-b+x))^(1/2)/(-a*b+(a+b)*x-x^2+d*x^3),x, algorithm="giac")

[Out]

integrate((3*a*b*x - 2*(a + b)*x^2 + x^3)/((d*x^3 - a*b + (a + b)*x - x^2)*sqrt((a - x)*(b - x)*x)), x)

Mupad [B] (verification not implemented)

Time = 8.29 (sec) , antiderivative size = 69, normalized size of antiderivative = 1.72 \[ \int \frac {3 a b x-2 (a+b) x^2+x^3}{\sqrt {x (-a+x) (-b+x)} \left (-a b+(a+b) x-x^2+d x^3\right )} \, dx=\frac {\ln \left (\frac {a\,b-a\,x-b\,x+d\,x^3+x^2-2\,\sqrt {d}\,x\,\sqrt {x\,\left (a-x\right )\,\left (b-x\right )}}{a\,x-a\,b+b\,x+d\,x^3-x^2}\right )}{\sqrt {d}} \]

[In]

int(-(x^3 - 2*x^2*(a + b) + 3*a*b*x)/((x*(a - x)*(b - x))^(1/2)*(a*b - d*x^3 + x^2 - x*(a + b))),x)

[Out]

log((a*b - a*x - b*x + d*x^3 + x^2 - 2*d^(1/2)*x*(x*(a - x)*(b - x))^(1/2))/(a*x - a*b + b*x + d*x^3 - x^2))/d
^(1/2)