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

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

Optimal result

Integrand size = 49, antiderivative size = 290 \[ \int \frac {\sqrt {a+b \tan (e+f x)} \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{\sqrt {c+d \tan (e+f x)}} \, dx=-\frac {\sqrt {a-i b} (i A+B-i C) \text {arctanh}\left (\frac {\sqrt {c-i d} \sqrt {a+b \tan (e+f x)}}{\sqrt {a-i b} \sqrt {c+d \tan (e+f x)}}\right )}{\sqrt {c-i d} f}+\frac {\sqrt {a+i b} (i A-B-i C) \text {arctanh}\left (\frac {\sqrt {c+i d} \sqrt {a+b \tan (e+f x)}}{\sqrt {a+i b} \sqrt {c+d \tan (e+f x)}}\right )}{\sqrt {c+i d} f}-\frac {(b c C-2 b B d-a C d) \text {arctanh}\left (\frac {\sqrt {d} \sqrt {a+b \tan (e+f x)}}{\sqrt {b} \sqrt {c+d \tan (e+f x)}}\right )}{\sqrt {b} d^{3/2} f}+\frac {C \sqrt {a+b \tan (e+f x)} \sqrt {c+d \tan (e+f x)}}{d f} \] Output:

-(a-I*b)^(1/2)*(I*A+B-I*C)*arctanh((c-I*d)^(1/2)*(a+b*tan(f*x+e))^(1/2)/(a 
-I*b)^(1/2)/(c+d*tan(f*x+e))^(1/2))/(c-I*d)^(1/2)/f+(a+I*b)^(1/2)*(I*A-B-I 
*C)*arctanh((c+I*d)^(1/2)*(a+b*tan(f*x+e))^(1/2)/(a+I*b)^(1/2)/(c+d*tan(f* 
x+e))^(1/2))/(c+I*d)^(1/2)/f-(-2*B*b*d-C*a*d+C*b*c)*arctanh(d^(1/2)*(a+b*t 
an(f*x+e))^(1/2)/b^(1/2)/(c+d*tan(f*x+e))^(1/2))/b^(1/2)/d^(3/2)/f+C*(a+b* 
tan(f*x+e))^(1/2)*(c+d*tan(f*x+e))^(1/2)/d/f
 

Mathematica [A] (verified)

Time = 4.41 (sec) , antiderivative size = 450, normalized size of antiderivative = 1.55 \[ \int \frac {\sqrt {a+b \tan (e+f x)} \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{\sqrt {c+d \tan (e+f x)}} \, dx=\frac {C \sqrt {a+b \tan (e+f x)} \sqrt {c+d \tan (e+f x)}}{d f}-\frac {\frac {\left (-b (A b+a B-b C)+\sqrt {-b^2} (b B+a (-A+C))\right ) d \text {arctanh}\left (\frac {\sqrt {-c+\frac {\sqrt {-b^2} d}{b}} \sqrt {a+b \tan (e+f x)}}{\sqrt {-a+\sqrt {-b^2}} \sqrt {c+d \tan (e+f x)}}\right )}{\sqrt {-a+\sqrt {-b^2}} \sqrt {-c+\frac {\sqrt {-b^2} d}{b}}}+\frac {\left (b (A b+a B-b C)+\sqrt {-b^2} (b B+a (-A+C))\right ) d \text {arctanh}\left (\frac {\sqrt {c+\frac {\sqrt {-b^2} d}{b}} \sqrt {a+b \tan (e+f x)}}{\sqrt {a+\sqrt {-b^2}} \sqrt {c+d \tan (e+f x)}}\right )}{\sqrt {a+\sqrt {-b^2}} \sqrt {c+\frac {\sqrt {-b^2} d}{b}}}+\frac {\sqrt {b} \sqrt {c-\frac {a d}{b}} (b c C-2 b B d-a C d) \text {arcsinh}\left (\frac {\sqrt {d} \sqrt {a+b \tan (e+f x)}}{\sqrt {b} \sqrt {c-\frac {a d}{b}}}\right ) \sqrt {\frac {b (c+d \tan (e+f x))}{b c-a d}}}{\sqrt {d} \sqrt {c+d \tan (e+f x)}}}{b d f} \] Input:

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

Output:

(C*Sqrt[a + b*Tan[e + f*x]]*Sqrt[c + d*Tan[e + f*x]])/(d*f) - (((-(b*(A*b 
+ a*B - b*C)) + Sqrt[-b^2]*(b*B + a*(-A + C)))*d*ArcTanh[(Sqrt[-c + (Sqrt[ 
-b^2]*d)/b]*Sqrt[a + b*Tan[e + f*x]])/(Sqrt[-a + Sqrt[-b^2]]*Sqrt[c + d*Ta 
n[e + f*x]])])/(Sqrt[-a + Sqrt[-b^2]]*Sqrt[-c + (Sqrt[-b^2]*d)/b]) + ((b*( 
A*b + a*B - b*C) + Sqrt[-b^2]*(b*B + a*(-A + C)))*d*ArcTanh[(Sqrt[c + (Sqr 
t[-b^2]*d)/b]*Sqrt[a + b*Tan[e + f*x]])/(Sqrt[a + Sqrt[-b^2]]*Sqrt[c + d*T 
an[e + f*x]])])/(Sqrt[a + Sqrt[-b^2]]*Sqrt[c + (Sqrt[-b^2]*d)/b]) + (Sqrt[ 
b]*Sqrt[c - (a*d)/b]*(b*c*C - 2*b*B*d - a*C*d)*ArcSinh[(Sqrt[d]*Sqrt[a + b 
*Tan[e + f*x]])/(Sqrt[b]*Sqrt[c - (a*d)/b])]*Sqrt[(b*(c + d*Tan[e + f*x])) 
/(b*c - a*d)])/(Sqrt[d]*Sqrt[c + d*Tan[e + f*x]]))/(b*d*f)
 

Rubi [A] (verified)

Time = 2.04 (sec) , antiderivative size = 294, normalized size of antiderivative = 1.01, number of steps used = 8, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3042, 4130, 27, 3042, 4138, 2348, 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 \frac {\sqrt {a+b \tan (e+f x)} \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{\sqrt {c+d \tan (e+f x)}} \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4130

\(\displaystyle \frac {\int -\frac {(b c C-a d C-2 b B d) \tan ^2(e+f x)-2 (A b-C b+a B) d \tan (e+f x)+b c C-2 a A d+a C d}{2 \sqrt {a+b \tan (e+f x)} \sqrt {c+d \tan (e+f x)}}dx}{d}+\frac {C \sqrt {a+b \tan (e+f x)} \sqrt {c+d \tan (e+f x)}}{d f}\)

\(\Big \downarrow \) 27

\(\displaystyle \frac {C \sqrt {a+b \tan (e+f x)} \sqrt {c+d \tan (e+f x)}}{d f}-\frac {\int \frac {(b c C-a d C-2 b B d) \tan ^2(e+f x)-2 (A b-C b+a B) d \tan (e+f x)+b c C-a (2 A-C) d}{\sqrt {a+b \tan (e+f x)} \sqrt {c+d \tan (e+f x)}}dx}{2 d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {C \sqrt {a+b \tan (e+f x)} \sqrt {c+d \tan (e+f x)}}{d f}-\frac {\int \frac {(b c C-a d C-2 b B d) \tan (e+f x)^2-2 (A b-C b+a B) d \tan (e+f x)+b c C-a (2 A-C) d}{\sqrt {a+b \tan (e+f x)} \sqrt {c+d \tan (e+f x)}}dx}{2 d}\)

\(\Big \downarrow \) 4138

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

\(\Big \downarrow \) 2348

\(\displaystyle \frac {C \sqrt {a+b \tan (e+f x)} \sqrt {c+d \tan (e+f x)}}{d f}-\frac {\int \left (\frac {b c C-a d C-2 b B d}{\sqrt {a+b \tan (e+f x)} \sqrt {c+d \tan (e+f x)}}+\frac {2 A b d+2 a B d-2 b C d+i (-2 a A d+2 b B d+2 a C d)}{2 (i-\tan (e+f x)) \sqrt {a+b \tan (e+f x)} \sqrt {c+d \tan (e+f x)}}+\frac {-2 A b d-2 a B d+2 b C d+i (-2 a A d+2 b B d+2 a C d)}{2 (\tan (e+f x)+i) \sqrt {a+b \tan (e+f x)} \sqrt {c+d \tan (e+f x)}}\right )d\tan (e+f x)}{2 d f}\)

\(\Big \downarrow \) 2009

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

Input:

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

Output:

-1/2*((2*Sqrt[a - I*b]*(B + I*(A - C))*d*ArcTanh[(Sqrt[c - I*d]*Sqrt[a + b 
*Tan[e + f*x]])/(Sqrt[a - I*b]*Sqrt[c + d*Tan[e + f*x]])])/Sqrt[c - I*d] - 
 (2*Sqrt[a + I*b]*(I*A - B - I*C)*d*ArcTanh[(Sqrt[c + I*d]*Sqrt[a + b*Tan[ 
e + f*x]])/(Sqrt[a + I*b]*Sqrt[c + d*Tan[e + f*x]])])/Sqrt[c + I*d] + (2*( 
b*c*C - 2*b*B*d - a*C*d)*ArcTanh[(Sqrt[d]*Sqrt[a + b*Tan[e + f*x]])/(Sqrt[ 
b]*Sqrt[c + d*Tan[e + f*x]])])/(Sqrt[b]*Sqrt[d]))/(d*f) + (C*Sqrt[a + b*Ta 
n[e + f*x]]*Sqrt[c + d*Tan[e + f*x]])/(d*f)
 

Defintions of rubi rules used

rule 27
Int[(a_)*(Fx_), x_Symbol] :> Simp[a   Int[Fx, x], x] /; FreeQ[a, x] &&  !Ma 
tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
 

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

rule 2348
Int[(Px_)*((c_) + (d_.)*(x_))^(m_.)*((e_) + (f_.)*(x_))^(n_.)*((a_.) + (b_. 
)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIntegrand[Px*(c + d*x)^m*(e + f*x)^ 
n*(a + b*x^2)^p, x], x] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && PolyQ[P 
x, x] && (IntegerQ[p] || (IntegerQ[2*p] && IntegerQ[m] && ILtQ[n, 0])) && 
!(IGtQ[m, 0] && IGtQ[n, 0])
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4130
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*tan[(e_.) 
+ (f_.)*(x_)])^(n_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_. 
) + (f_.)*(x_)]^2), x_Symbol] :> Simp[C*(a + b*Tan[e + f*x])^m*((c + d*Tan[ 
e + f*x])^(n + 1)/(d*f*(m + n + 1))), x] + Simp[1/(d*(m + n + 1))   Int[(a 
+ b*Tan[e + f*x])^(m - 1)*(c + d*Tan[e + f*x])^n*Simp[a*A*d*(m + n + 1) - C 
*(b*c*m + a*d*(n + 1)) + d*(A*b + a*B - b*C)*(m + n + 1)*Tan[e + f*x] - (C* 
m*(b*c - a*d) - b*B*d*(m + n + 1))*Tan[e + f*x]^2, x], x], x] /; FreeQ[{a, 
b, c, d, e, f, A, B, C, n}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && 
 NeQ[c^2 + d^2, 0] && GtQ[m, 0] &&  !(IGtQ[n, 0] && ( !IntegerQ[m] || (EqQ[ 
c, 0] && NeQ[a, 0])))
 

rule 4138
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
 (f_.)*(x_)])^(n_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) 
 + (f_.)*(x_)]^2), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x], x]}, S 
imp[ff/f   Subst[Int[(a + b*ff*x)^m*(c + d*ff*x)^n*((A + B*ff*x + C*ff^2*x^ 
2)/(1 + ff^2*x^2)), x], x, Tan[e + f*x]/ff], x]] /; FreeQ[{a, b, c, d, e, f 
, A, B, C, m, n}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[c^2 + 
 d^2, 0]
 
Maple [F(-1)]

Timed out.

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

Input:

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

Output:

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 38950 vs. \(2 (226) = 452\).

Time = 127.24 (sec) , antiderivative size = 77916, normalized size of antiderivative = 268.68 \[ \int \frac {\sqrt {a+b \tan (e+f x)} \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{\sqrt {c+d \tan (e+f x)}} \, dx=\text {Too large to display} \] Input:

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

Output:

Too large to include
 

Sympy [F]

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

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

Output:

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

Maxima [F]

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

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

Output:

integrate((C*tan(f*x + e)^2 + B*tan(f*x + e) + A)*sqrt(b*tan(f*x + e) + a) 
/sqrt(d*tan(f*x + e) + c), x)
 

Giac [F]

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

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

Output:

integrate((C*tan(f*x + e)^2 + B*tan(f*x + e) + A)*sqrt(b*tan(f*x + e) + a) 
/sqrt(d*tan(f*x + e) + c), x)
 

Mupad [F(-1)]

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

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

Output:

\text{Hanged}
 

Reduce [F]

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

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

Output:

int((sqrt(tan(e + f*x)*d + c)*sqrt(tan(e + f*x)*b + a)*tan(e + f*x)**2)/(t 
an(e + f*x)*d + c),x)*c + int((sqrt(tan(e + f*x)*d + c)*sqrt(tan(e + f*x)* 
b + a)*tan(e + f*x))/(tan(e + f*x)*d + c),x)*b + int((sqrt(tan(e + f*x)*d 
+ c)*sqrt(tan(e + f*x)*b + a))/(tan(e + f*x)*d + c),x)*a