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

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

Optimal result

Integrand size = 32, antiderivative size = 416 \[ \int \frac {A+B x}{\left (a+b x+c x^2\right ) \sqrt {d+e x+f x^2}} \, dx=\frac {\left (b B-2 A c-B \sqrt {b^2-4 a c}\right ) \text {arctanh}\left (\frac {4 c d-\left (b-\sqrt {b^2-4 a c}\right ) e+2 \left (c e-\left (b-\sqrt {b^2-4 a c}\right ) f\right ) x}{2 \sqrt {2} \sqrt {2 c^2 d-b c e+b^2 f-2 a c f+\sqrt {b^2-4 a c} (c e-b f)} \sqrt {d+e x+f x^2}}\right )}{\sqrt {2} \sqrt {b^2-4 a c} \sqrt {2 c^2 d-b c e+b^2 f-2 a c f+\sqrt {b^2-4 a c} (c e-b f)}}+\frac {\left (2 A c-B \left (b+\sqrt {b^2-4 a c}\right )\right ) \text {arctanh}\left (\frac {4 c d-\left (b+\sqrt {b^2-4 a c}\right ) e+2 \left (c e-\left (b+\sqrt {b^2-4 a c}\right ) f\right ) x}{2 \sqrt {2} \sqrt {2 c^2 d-b c e+b^2 f-2 a c f-\sqrt {b^2-4 a c} (c e-b f)} \sqrt {d+e x+f x^2}}\right )}{\sqrt {2} \sqrt {b^2-4 a c} \sqrt {2 c^2 d-b c e+b^2 f-2 a c f-\sqrt {b^2-4 a c} (c e-b f)}} \] Output:

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

Mathematica [C] (verified)

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

Time = 0.57 (sec) , antiderivative size = 278, normalized size of antiderivative = 0.67 \[ \int \frac {A+B x}{\left (a+b x+c x^2\right ) \sqrt {d+e x+f x^2}} \, dx=-\text {RootSum}\left [c d^2-b d e+a e^2+2 b d \sqrt {f} \text {$\#$1}-4 a e \sqrt {f} \text {$\#$1}-2 c d \text {$\#$1}^2+b e \text {$\#$1}^2+4 a f \text {$\#$1}^2-2 b \sqrt {f} \text {$\#$1}^3+c \text {$\#$1}^4\&,\frac {B d \log \left (-\sqrt {f} x+\sqrt {d+e x+f x^2}-\text {$\#$1}\right )-A e \log \left (-\sqrt {f} x+\sqrt {d+e x+f x^2}-\text {$\#$1}\right )+2 A \sqrt {f} \log \left (-\sqrt {f} x+\sqrt {d+e x+f x^2}-\text {$\#$1}\right ) \text {$\#$1}-B \log \left (-\sqrt {f} x+\sqrt {d+e x+f x^2}-\text {$\#$1}\right ) \text {$\#$1}^2}{b d \sqrt {f}-2 a e \sqrt {f}-2 c d \text {$\#$1}+b e \text {$\#$1}+4 a f \text {$\#$1}-3 b \sqrt {f} \text {$\#$1}^2+2 c \text {$\#$1}^3}\&\right ] \] Input:

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

Output:

-RootSum[c*d^2 - b*d*e + a*e^2 + 2*b*d*Sqrt[f]*#1 - 4*a*e*Sqrt[f]*#1 - 2*c 
*d*#1^2 + b*e*#1^2 + 4*a*f*#1^2 - 2*b*Sqrt[f]*#1^3 + c*#1^4 & , (B*d*Log[- 
(Sqrt[f]*x) + Sqrt[d + e*x + f*x^2] - #1] - A*e*Log[-(Sqrt[f]*x) + Sqrt[d 
+ e*x + f*x^2] - #1] + 2*A*Sqrt[f]*Log[-(Sqrt[f]*x) + Sqrt[d + e*x + f*x^2 
] - #1]*#1 - B*Log[-(Sqrt[f]*x) + Sqrt[d + e*x + f*x^2] - #1]*#1^2)/(b*d*S 
qrt[f] - 2*a*e*Sqrt[f] - 2*c*d*#1 + b*e*#1 + 4*a*f*#1 - 3*b*Sqrt[f]*#1^2 + 
 2*c*#1^3) & ]
 

Rubi [A] (verified)

Time = 0.73 (sec) , antiderivative size = 416, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.094, Rules used = {1365, 1154, 219}

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

\(\Big \downarrow \) 1365

\(\displaystyle -\frac {\left (-B \sqrt {b^2-4 a c}-2 A c+b B\right ) \int \frac {1}{\left (b+2 c x-\sqrt {b^2-4 a c}\right ) \sqrt {f x^2+e x+d}}dx}{\sqrt {b^2-4 a c}}-\frac {\left (2 A c-B \left (\sqrt {b^2-4 a c}+b\right )\right ) \int \frac {1}{\left (b+2 c x+\sqrt {b^2-4 a c}\right ) \sqrt {f x^2+e x+d}}dx}{\sqrt {b^2-4 a c}}\)

\(\Big \downarrow \) 1154

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

\(\Big \downarrow \) 219

\(\displaystyle \frac {\left (-B \sqrt {b^2-4 a c}-2 A c+b B\right ) \text {arctanh}\left (\frac {2 x \left (c e-f \left (b-\sqrt {b^2-4 a c}\right )\right )-e \left (b-\sqrt {b^2-4 a c}\right )+4 c d}{2 \sqrt {2} \sqrt {d+e x+f x^2} \sqrt {\sqrt {b^2-4 a c} (c e-b f)-2 a c f+b^2 f-b c e+2 c^2 d}}\right )}{\sqrt {2} \sqrt {b^2-4 a c} \sqrt {\sqrt {b^2-4 a c} (c e-b f)-2 a c f+b^2 f-b c e+2 c^2 d}}+\frac {\left (2 A c-B \left (\sqrt {b^2-4 a c}+b\right )\right ) \text {arctanh}\left (\frac {2 x \left (c e-f \left (\sqrt {b^2-4 a c}+b\right )\right )-e \left (\sqrt {b^2-4 a c}+b\right )+4 c d}{2 \sqrt {2} \sqrt {d+e x+f x^2} \sqrt {-\sqrt {b^2-4 a c} (c e-b f)-2 a c f+b^2 f-b c e+2 c^2 d}}\right )}{\sqrt {2} \sqrt {b^2-4 a c} \sqrt {-\sqrt {b^2-4 a c} (c e-b f)-2 a c f+b^2 f-b c e+2 c^2 d}}\)

Input:

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

Output:

((b*B - 2*A*c - B*Sqrt[b^2 - 4*a*c])*ArcTanh[(4*c*d - (b - Sqrt[b^2 - 4*a* 
c])*e + 2*(c*e - (b - Sqrt[b^2 - 4*a*c])*f)*x)/(2*Sqrt[2]*Sqrt[2*c^2*d - b 
*c*e + b^2*f - 2*a*c*f + Sqrt[b^2 - 4*a*c]*(c*e - b*f)]*Sqrt[d + e*x + f*x 
^2])])/(Sqrt[2]*Sqrt[b^2 - 4*a*c]*Sqrt[2*c^2*d - b*c*e + b^2*f - 2*a*c*f + 
 Sqrt[b^2 - 4*a*c]*(c*e - b*f)]) + ((2*A*c - B*(b + Sqrt[b^2 - 4*a*c]))*Ar 
cTanh[(4*c*d - (b + Sqrt[b^2 - 4*a*c])*e + 2*(c*e - (b + Sqrt[b^2 - 4*a*c] 
)*f)*x)/(2*Sqrt[2]*Sqrt[2*c^2*d - b*c*e + b^2*f - 2*a*c*f - Sqrt[b^2 - 4*a 
*c]*(c*e - b*f)]*Sqrt[d + e*x + f*x^2])])/(Sqrt[2]*Sqrt[b^2 - 4*a*c]*Sqrt[ 
2*c^2*d - b*c*e + b^2*f - 2*a*c*f - Sqrt[b^2 - 4*a*c]*(c*e - b*f)])
 

Defintions of rubi rules used

rule 219
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))* 
ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (Gt 
Q[a, 0] || LtQ[b, 0])
 

rule 1154
Int[1/(((d_.) + (e_.)*(x_))*Sqrt[(a_.) + (b_.)*(x_) + (c_.)*(x_)^2]), x_Sym 
bol] :> Simp[-2   Subst[Int[1/(4*c*d^2 - 4*b*d*e + 4*a*e^2 - x^2), x], x, ( 
2*a*e - b*d - (2*c*d - b*e)*x)/Sqrt[a + b*x + c*x^2]], x] /; FreeQ[{a, b, c 
, d, e}, x]
 

rule 1365
Int[((g_.) + (h_.)*(x_))/(((a_) + (b_.)*(x_) + (c_.)*(x_)^2)*Sqrt[(d_.) + ( 
e_.)*(x_) + (f_.)*(x_)^2]), x_Symbol] :> With[{q = Rt[b^2 - 4*a*c, 2]}, Sim 
p[(2*c*g - h*(b - q))/q   Int[1/((b - q + 2*c*x)*Sqrt[d + e*x + f*x^2]), x] 
, x] - Simp[(2*c*g - h*(b + q))/q   Int[1/((b + q + 2*c*x)*Sqrt[d + e*x + f 
*x^2]), x], x]] /; FreeQ[{a, b, c, d, e, f, g, h}, x] && NeQ[b^2 - 4*a*c, 0 
] && NeQ[e^2 - 4*d*f, 0] && PosQ[b^2 - 4*a*c]
 
Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(805\) vs. \(2(370)=740\).

Time = 2.72 (sec) , antiderivative size = 806, normalized size of antiderivative = 1.94

method result size
default \(-\frac {\left (2 A c +B \sqrt {-4 a c +b^{2}}-B b \right ) \ln \left (\frac {-\frac {f b \sqrt {-4 a c +b^{2}}-c e \sqrt {-4 a c +b^{2}}+2 a c f -b^{2} f +b c e -2 c^{2} d}{c^{2}}-\frac {\left (-\sqrt {-4 a c +b^{2}}\, f +f b -c e \right ) \left (x -\frac {-b +\sqrt {-4 a c +b^{2}}}{2 c}\right )}{c}+\frac {\sqrt {-\frac {2 \left (f b \sqrt {-4 a c +b^{2}}-c e \sqrt {-4 a c +b^{2}}+2 a c f -b^{2} f +b c e -2 c^{2} d \right )}{c^{2}}}\, \sqrt {4 {\left (x -\frac {-b +\sqrt {-4 a c +b^{2}}}{2 c}\right )}^{2} f -\frac {4 \left (-\sqrt {-4 a c +b^{2}}\, f +f b -c e \right ) \left (x -\frac {-b +\sqrt {-4 a c +b^{2}}}{2 c}\right )}{c}-\frac {2 \left (f b \sqrt {-4 a c +b^{2}}-c e \sqrt {-4 a c +b^{2}}+2 a c f -b^{2} f +b c e -2 c^{2} d \right )}{c^{2}}}}{2}}{x -\frac {-b +\sqrt {-4 a c +b^{2}}}{2 c}}\right )}{\sqrt {-4 a c +b^{2}}\, c \sqrt {-\frac {2 \left (f b \sqrt {-4 a c +b^{2}}-c e \sqrt {-4 a c +b^{2}}+2 a c f -b^{2} f +b c e -2 c^{2} d \right )}{c^{2}}}}+\frac {\left (2 A c -B \sqrt {-4 a c +b^{2}}-B b \right ) \ln \left (\frac {-\frac {-f b \sqrt {-4 a c +b^{2}}+c e \sqrt {-4 a c +b^{2}}+2 a c f -b^{2} f +b c e -2 c^{2} d}{c^{2}}-\frac {\left (\sqrt {-4 a c +b^{2}}\, f +f b -c e \right ) \left (x +\frac {b +\sqrt {-4 a c +b^{2}}}{2 c}\right )}{c}+\frac {\sqrt {-\frac {2 \left (-f b \sqrt {-4 a c +b^{2}}+c e \sqrt {-4 a c +b^{2}}+2 a c f -b^{2} f +b c e -2 c^{2} d \right )}{c^{2}}}\, \sqrt {4 {\left (x +\frac {b +\sqrt {-4 a c +b^{2}}}{2 c}\right )}^{2} f -\frac {4 \left (\sqrt {-4 a c +b^{2}}\, f +f b -c e \right ) \left (x +\frac {b +\sqrt {-4 a c +b^{2}}}{2 c}\right )}{c}-\frac {2 \left (-f b \sqrt {-4 a c +b^{2}}+c e \sqrt {-4 a c +b^{2}}+2 a c f -b^{2} f +b c e -2 c^{2} d \right )}{c^{2}}}}{2}}{x +\frac {b +\sqrt {-4 a c +b^{2}}}{2 c}}\right )}{\sqrt {-4 a c +b^{2}}\, c \sqrt {-\frac {2 \left (-f b \sqrt {-4 a c +b^{2}}+c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)^(1/2)*f+f*b- 
c*e)/c*(x+1/2*(b+(-4*a*c+b^2)^(1/2))/c)+1/2*(-2*(-f*b*(-4*a*c+b^2)^(1/2)+c 
*e*(-4*a*c+b^2)^(1/2)+2*a*c*f-b^2*f+b*c*e-2*c^2*d)/c^2)^(1/2)*(4*(x+1/2*(b 
+(-4*a*c+b^2)^(1/2))/c)^2*f-4*((-4*a*c+b^2)^(1/2)*f+f*b-c*e)/c*(x+1/2*(b+( 
-4*a*c+b^2)^(1/2))/c)-2*(-f*b*(-4*a*c+b^2)^(1/2)+c*e*(-4*a*c+b^2)^(1/2)+2* 
a*c*f-b^2*f+b*c*e-2*c^2*d)/c^2)^(1/2))/(x+1/2*(b+(-4*a*c+b^2)^(1/2))/c))
 

Fricas [F(-1)]

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

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

Output:

Timed out
 

Sympy [F]

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

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

Output:

Integral((A + B*x)/((a + b*x + c*x**2)*sqrt(d + e*x + f*x**2)), x)
 

Maxima [F(-2)]

Exception generated. \[ \int \frac {A+B x}{\left (a+b x+c x^2\right ) \sqrt {d+e x+f x^2}} \, dx=\text {Exception raised: ValueError} \] Input:

integrate((B*x+A)/(c*x^2+b*x+a)/(f*x^2+e*x+d)^(1/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(-2)]

Exception generated. \[ \int \frac {A+B x}{\left (a+b x+c x^2\right ) \sqrt {d+e x+f x^2}} \, dx=\text {Exception raised: TypeError} \] Input:

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

Output:

Exception raised: TypeError >> an error occurred running a Giac command:IN 
PUT:sage2:=int(sage0,sageVARx):;OUTPUT:Unable to divide, perhaps due to ro 
unding error%%%{%%{poly1[%%%{-4,[3,2,0]%%%}+%%%{16,[1,3,1]%%%},%%%{4,[4,2, 
0]%%%}+%%
 

Mupad [F(-1)]

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

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

Output:

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

Reduce [F]

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

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

Output:

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