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

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 = 237 \[ \int \frac {A+B \tan (e+f x)+C \tan ^2(e+f x)}{\sqrt {a+b \tan (e+f x)} \sqrt {c+d \tan (e+f x)}} \, dx=-\frac {(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 {a-i b} \sqrt {c-i d} f}-\frac {(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 {a+i b} \sqrt {c+i d} f}+\frac {2 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} f} \] Output:

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

Mathematica [A] (verified)

Time = 1.45 (sec) , antiderivative size = 362, normalized size of antiderivative = 1.53 \[ \int \frac {A+B \tan (e+f x)+C \tan ^2(e+f x)}{\sqrt {a+b \tan (e+f x)} \sqrt {c+d \tan (e+f x)}} \, dx=\frac {\frac {\left (b B+\sqrt {-b^2} (A-C)\right ) \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 B+\sqrt {-b^2} (-A+C)\right ) \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 {2 \sqrt {b} C \sqrt {c-\frac {a d}{b}} \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 f} \] Input:

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

Output:

(((b*B + Sqrt[-b^2]*(A - C))*ArcTanh[(Sqrt[-c + (Sqrt[-b^2]*d)/b]*Sqrt[a + 
 b*Tan[e + f*x]])/(Sqrt[-a + Sqrt[-b^2]]*Sqrt[c + d*Tan[e + f*x]])])/(Sqrt 
[-a + Sqrt[-b^2]]*Sqrt[-c + (Sqrt[-b^2]*d)/b]) - ((b*B + Sqrt[-b^2]*(-A + 
C))*ArcTanh[(Sqrt[c + (Sqrt[-b^2]*d)/b]*Sqrt[a + b*Tan[e + f*x]])/(Sqrt[a 
+ Sqrt[-b^2]]*Sqrt[c + d*Tan[e + f*x]])])/(Sqrt[a + Sqrt[-b^2]]*Sqrt[c + ( 
Sqrt[-b^2]*d)/b]) + (2*Sqrt[b]*C*Sqrt[c - (a*d)/b]*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*f)
 

Rubi [A] (verified)

Time = 1.16 (sec) , antiderivative size = 232, normalized size of antiderivative = 0.98, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.082, Rules used = {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 {A+B \tan (e+f x)+C \tan ^2(e+f x)}{\sqrt {a+b \tan (e+f x)} \sqrt {c+d \tan (e+f x)}} \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4138

\(\displaystyle \frac {\int \frac {C \tan ^2(e+f x)+B \tan (e+f x)+A}{\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)}{f}\)

\(\Big \downarrow \) 2348

\(\displaystyle \frac {\int \left (\frac {i (A-C)-B}{2 (i-\tan (e+f x)) \sqrt {a+b \tan (e+f x)} \sqrt {c+d \tan (e+f x)}}+\frac {C}{\sqrt {a+b \tan (e+f x)} \sqrt {c+d \tan (e+f x)}}+\frac {B+i (A-C)}{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)}{f}\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {-\frac {(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 {a-i b} \sqrt {c-i d}}-\frac {(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 {a+i b} \sqrt {c+i d}}+\frac {2 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}}}{f}\)

Input:

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

Output:

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

Defintions of rubi rules used

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

Input:

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

Output:

int((A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(a+b*tan(f*x+e))^(1/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. 48154 vs. \(2 (180) = 360\).

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

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

Output:

Too large to include
 

Sympy [F]

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

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

Output:

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

Maxima [F]

\[ \int \frac {A+B \tan (e+f x)+C \tan ^2(e+f x)}{\sqrt {a+b \tan (e+f x)} \sqrt {c+d \tan (e+f x)}} \, dx=\int { \frac {C \tan \left (f x + e\right )^{2} + B \tan \left (f x + e\right ) + A}{\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)+C*tan(f*x+e)^2)/(a+b*tan(f*x+e))^(1/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 {A+B \tan (e+f x)+C \tan ^2(e+f x)}{\sqrt {a+b \tan (e+f x)} \sqrt {c+d \tan (e+f x)}} \, dx=\int { \frac {C \tan \left (f x + e\right )^{2} + B \tan \left (f x + e\right ) + A}{\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)+C*tan(f*x+e)^2)/(a+b*tan(f*x+e))^(1/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 {A+B \tan (e+f x)+C \tan ^2(e+f x)}{\sqrt {a+b \tan (e+f x)} \sqrt {c+d \tan (e+f x)}} \, dx=\text {Hanged} \] Input:

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

Output:

\text{Hanged}
 

Reduce [F]

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

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

Output:

(2*sqrt(tan(e + f*x)*d + c)*sqrt(tan(e + f*x)*b + a)*a - 2*int((sqrt(tan(e 
 + f*x)*d + c)*sqrt(tan(e + f*x)*b + a)*tan(e + f*x)**3)/(tan(e + f*x)**2* 
a*b*d**2 + tan(e + f*x)**2*b**2*c*d + tan(e + f*x)*a**2*d**2 + 2*tan(e + f 
*x)*a*b*c*d + tan(e + f*x)*b**2*c**2 + a**2*c*d + a*b*c**2),x)*a**2*b*d**2 
*f - 2*int((sqrt(tan(e + f*x)*d + c)*sqrt(tan(e + f*x)*b + a)*tan(e + f*x) 
**3)/(tan(e + f*x)**2*a*b*d**2 + tan(e + f*x)**2*b**2*c*d + tan(e + f*x)*a 
**2*d**2 + 2*tan(e + f*x)*a*b*c*d + tan(e + f*x)*b**2*c**2 + a**2*c*d + a* 
b*c**2),x)*a*b**2*c*d*f - int((sqrt(tan(e + f*x)*d + c)*sqrt(tan(e + f*x)* 
b + a)*tan(e + f*x)**2)/(tan(e + f*x)**2*a*b*d**2 + tan(e + f*x)**2*b**2*c 
*d + tan(e + f*x)*a**2*d**2 + 2*tan(e + f*x)*a*b*c*d + tan(e + f*x)*b**2*c 
**2 + a**2*c*d + a*b*c**2),x)*a**3*d**2*f - 2*int((sqrt(tan(e + f*x)*d + c 
)*sqrt(tan(e + f*x)*b + a)*tan(e + f*x)**2)/(tan(e + f*x)**2*a*b*d**2 + ta 
n(e + f*x)**2*b**2*c*d + tan(e + f*x)*a**2*d**2 + 2*tan(e + f*x)*a*b*c*d + 
 tan(e + f*x)*b**2*c**2 + a**2*c*d + a*b*c**2),x)*a**2*b*c*d*f - int((sqrt 
(tan(e + f*x)*d + c)*sqrt(tan(e + f*x)*b + a)*tan(e + f*x)**2)/(tan(e + f* 
x)**2*a*b*d**2 + tan(e + f*x)**2*b**2*c*d + tan(e + f*x)*a**2*d**2 + 2*tan 
(e + f*x)*a*b*c*d + tan(e + f*x)*b**2*c**2 + a**2*c*d + a*b*c**2),x)*a*b** 
2*c**2*f + int((sqrt(tan(e + f*x)*d + c)*sqrt(tan(e + f*x)*b + a)*tan(e + 
f*x)**2)/(tan(e + f*x)**2*b*d + tan(e + f*x)*a*d + tan(e + f*x)*b*c + a*c) 
,x)*a*c*d*f + int((sqrt(tan(e + f*x)*d + c)*sqrt(tan(e + f*x)*b + a)*ta...