\(\int \frac {\tan ^2(e+f x)}{\sqrt {a+b \sin ^2(e+f x)}} \, dx\) [448]

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

Optimal result

Integrand size = 25, antiderivative size = 109 \[ \int \frac {\tan ^2(e+f x)}{\sqrt {a+b \sin ^2(e+f x)}} \, dx=-\frac {\sqrt {\cos ^2(e+f x)} E\left (\arcsin (\sin (e+f x))\left |-\frac {b}{a}\right .\right ) \sec (e+f x) \sqrt {a+b \sin ^2(e+f x)}}{(a+b) f \sqrt {1+\frac {b \sin ^2(e+f x)}{a}}}+\frac {\sqrt {a+b \sin ^2(e+f x)} \tan (e+f x)}{(a+b) f} \] Output:

-(cos(f*x+e)^2)^(1/2)*EllipticE(sin(f*x+e),(-b/a)^(1/2))*sec(f*x+e)*(a+b*s 
in(f*x+e)^2)^(1/2)/(a+b)/f/(1+b*sin(f*x+e)^2/a)^(1/2)+(a+b*sin(f*x+e)^2)^( 
1/2)*tan(f*x+e)/(a+b)/f
 

Mathematica [A] (verified)

Time = 0.78 (sec) , antiderivative size = 100, normalized size of antiderivative = 0.92 \[ \int \frac {\tan ^2(e+f x)}{\sqrt {a+b \sin ^2(e+f x)}} \, dx=\frac {-2 a \sqrt {\frac {2 a+b-b \cos (2 (e+f x))}{a}} E\left (e+f x\left |-\frac {b}{a}\right .\right )+\sqrt {2} (2 a+b-b \cos (2 (e+f x))) \tan (e+f x)}{2 (a+b) f \sqrt {2 a+b-b \cos (2 (e+f x))}} \] Input:

Integrate[Tan[e + f*x]^2/Sqrt[a + b*Sin[e + f*x]^2],x]
 

Output:

(-2*a*Sqrt[(2*a + b - b*Cos[2*(e + f*x)])/a]*EllipticE[e + f*x, -(b/a)] + 
Sqrt[2]*(2*a + b - b*Cos[2*(e + f*x)])*Tan[e + f*x])/(2*(a + b)*f*Sqrt[2*a 
 + b - b*Cos[2*(e + f*x)]])
 

Rubi [A] (verified)

Time = 0.32 (sec) , antiderivative size = 123, normalized size of antiderivative = 1.13, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.200, Rules used = {3042, 3675, 373, 330, 327}

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 {\tan ^2(e+f x)}{\sqrt {a+b \sin ^2(e+f x)}} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\tan (e+f x)^2}{\sqrt {a+b \sin (e+f x)^2}}dx\)

\(\Big \downarrow \) 3675

\(\displaystyle \frac {\sqrt {\cos ^2(e+f x)} \sec (e+f x) \int \frac {\sin ^2(e+f x)}{\left (1-\sin ^2(e+f x)\right )^{3/2} \sqrt {b \sin ^2(e+f x)+a}}d\sin (e+f x)}{f}\)

\(\Big \downarrow \) 373

\(\displaystyle \frac {\sqrt {\cos ^2(e+f x)} \sec (e+f x) \left (\frac {\sin (e+f x) \sqrt {a+b \sin ^2(e+f x)}}{(a+b) \sqrt {1-\sin ^2(e+f x)}}-\frac {\int \frac {\sqrt {b \sin ^2(e+f x)+a}}{\sqrt {1-\sin ^2(e+f x)}}d\sin (e+f x)}{a+b}\right )}{f}\)

\(\Big \downarrow \) 330

\(\displaystyle \frac {\sqrt {\cos ^2(e+f x)} \sec (e+f x) \left (\frac {\sin (e+f x) \sqrt {a+b \sin ^2(e+f x)}}{(a+b) \sqrt {1-\sin ^2(e+f x)}}-\frac {\sqrt {a+b \sin ^2(e+f x)} \int \frac {\sqrt {\frac {b \sin ^2(e+f x)}{a}+1}}{\sqrt {1-\sin ^2(e+f x)}}d\sin (e+f x)}{(a+b) \sqrt {\frac {b \sin ^2(e+f x)}{a}+1}}\right )}{f}\)

\(\Big \downarrow \) 327

\(\displaystyle \frac {\sqrt {\cos ^2(e+f x)} \sec (e+f x) \left (\frac {\sin (e+f x) \sqrt {a+b \sin ^2(e+f x)}}{(a+b) \sqrt {1-\sin ^2(e+f x)}}-\frac {\sqrt {a+b \sin ^2(e+f x)} E\left (\arcsin (\sin (e+f x))\left |-\frac {b}{a}\right .\right )}{(a+b) \sqrt {\frac {b \sin ^2(e+f x)}{a}+1}}\right )}{f}\)

Input:

Int[Tan[e + f*x]^2/Sqrt[a + b*Sin[e + f*x]^2],x]
 

Output:

(Sqrt[Cos[e + f*x]^2]*Sec[e + f*x]*((Sin[e + f*x]*Sqrt[a + b*Sin[e + f*x]^ 
2])/((a + b)*Sqrt[1 - Sin[e + f*x]^2]) - (EllipticE[ArcSin[Sin[e + f*x]], 
-(b/a)]*Sqrt[a + b*Sin[e + f*x]^2])/((a + b)*Sqrt[1 + (b*Sin[e + f*x]^2)/a 
])))/f
 

Defintions of rubi rules used

rule 327
Int[Sqrt[(a_) + (b_.)*(x_)^2]/Sqrt[(c_) + (d_.)*(x_)^2], x_Symbol] :> Simp[ 
(Sqrt[a]/(Sqrt[c]*Rt[-d/c, 2]))*EllipticE[ArcSin[Rt[-d/c, 2]*x], b*(c/(a*d) 
)], x] /; FreeQ[{a, b, c, d}, x] && NegQ[d/c] && GtQ[c, 0] && GtQ[a, 0]
 

rule 330
Int[Sqrt[(a_) + (b_.)*(x_)^2]/Sqrt[(c_) + (d_.)*(x_)^2], x_Symbol] :> Simp[ 
Sqrt[a + b*x^2]/Sqrt[1 + (b/a)*x^2]   Int[Sqrt[1 + (b/a)*x^2]/Sqrt[c + d*x^ 
2], x], x] /; FreeQ[{a, b, c, d}, x] && NegQ[d/c] && GtQ[c, 0] &&  !GtQ[a, 
0]
 

rule 373
Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_)*((c_) + (d_.)*(x_)^2)^(q_ 
), x_Symbol] :> Simp[e*(e*x)^(m - 1)*(a + b*x^2)^(p + 1)*((c + d*x^2)^(q + 
1)/(2*(b*c - a*d)*(p + 1))), x] - Simp[e^2/(2*(b*c - a*d)*(p + 1))   Int[(e 
*x)^(m - 2)*(a + b*x^2)^(p + 1)*(c + d*x^2)^q*Simp[c*(m - 1) + d*(m + 2*p + 
 2*q + 3)*x^2, x], x], x] /; FreeQ[{a, b, c, d, e, q}, x] && NeQ[b*c - a*d, 
 0] && LtQ[p, -1] && GtQ[m, 1] && LeQ[m, 3] && IntBinomialQ[a, b, c, d, e, 
m, 2, p, q, x]
 

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

rule 3675
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(p_.)*tan[(e_.) + (f_.)*(x_)]^ 
(m_), x_Symbol] :> With[{ff = FreeFactors[Sin[e + f*x], x]}, Simp[ff^(m + 1 
)*(Sqrt[Cos[e + f*x]^2]/(f*Cos[e + f*x]))   Subst[Int[x^m*((a + b*ff^2*x^2) 
^p/(1 - ff^2*x^2)^((m + 1)/2)), x], x, Sin[e + f*x]/ff], x]] /; FreeQ[{a, b 
, e, f, p}, x] && IntegerQ[m/2] &&  !IntegerQ[p]
 
Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(221\) vs. \(2(102)=204\).

Time = 2.42 (sec) , antiderivative size = 222, normalized size of antiderivative = 2.04

method result size
default \(\frac {-\sqrt {-b \cos \left (f x +e \right )^{4}+\left (a +b \right ) \cos \left (f x +e \right )^{2}}\, b \cos \left (f x +e \right )^{2} \sin \left (f x +e \right )+\sqrt {-b \cos \left (f x +e \right )^{4}+\left (a +b \right ) \cos \left (f x +e \right )^{2}}\, \left (a +b \right ) \sin \left (f x +e \right )-a \sqrt {\frac {\cos \left (2 f x +2 e \right )}{2}+\frac {1}{2}}\, \sqrt {-\frac {b \cos \left (f x +e \right )^{2}}{a}+\frac {a +b}{a}}\, \sqrt {-b \cos \left (f x +e \right )^{4}+\left (a +b \right ) \cos \left (f x +e \right )^{2}}\, \operatorname {EllipticE}\left (\sin \left (f x +e \right ), \sqrt {-\frac {b}{a}}\right )}{\left (a +b \right ) \sqrt {-\left (a +b \sin \left (f x +e \right )^{2}\right ) \left (\sin \left (f x +e \right )-1\right ) \left (1+\sin \left (f x +e \right )\right )}\, \cos \left (f x +e \right ) \sqrt {a +b \sin \left (f x +e \right )^{2}}\, f}\) \(222\)

Input:

int(tan(f*x+e)^2/(a+b*sin(f*x+e)^2)^(1/2),x,method=_RETURNVERBOSE)
 

Output:

(-(-b*cos(f*x+e)^4+(a+b)*cos(f*x+e)^2)^(1/2)*b*cos(f*x+e)^2*sin(f*x+e)+(-b 
*cos(f*x+e)^4+(a+b)*cos(f*x+e)^2)^(1/2)*(a+b)*sin(f*x+e)-a*(cos(f*x+e)^2)^ 
(1/2)*(-b/a*cos(f*x+e)^2+(a+b)/a)^(1/2)*(-b*cos(f*x+e)^4+(a+b)*cos(f*x+e)^ 
2)^(1/2)*EllipticE(sin(f*x+e),(-b/a)^(1/2)))/(a+b)/(-(a+b*sin(f*x+e)^2)*(s 
in(f*x+e)-1)*(1+sin(f*x+e)))^(1/2)/cos(f*x+e)/(a+b*sin(f*x+e)^2)^(1/2)/f
 

Fricas [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 0.12 (sec) , antiderivative size = 730, normalized size of antiderivative = 6.70 \[ \int \frac {\tan ^2(e+f x)}{\sqrt {a+b \sin ^2(e+f x)}} \, dx =\text {Too large to display} \] Input:

integrate(tan(f*x+e)^2/(a+b*sin(f*x+e)^2)^(1/2),x, algorithm="fricas")
 

Output:

1/2*(2*sqrt(-b*cos(f*x + e)^2 + a + b)*b^2*sin(f*x + e) - (2*I*sqrt(-b)*b^ 
2*sqrt((a^2 + a*b)/b^2)*cos(f*x + e) + (2*I*a*b + I*b^2)*sqrt(-b)*cos(f*x 
+ e))*sqrt((2*b*sqrt((a^2 + a*b)/b^2) + 2*a + b)/b)*elliptic_e(arcsin(sqrt 
((2*b*sqrt((a^2 + a*b)/b^2) + 2*a + b)/b)*(cos(f*x + e) + I*sin(f*x + e))) 
, (8*a^2 + 8*a*b + b^2 - 4*(2*a*b + b^2)*sqrt((a^2 + a*b)/b^2))/b^2) - (-2 
*I*sqrt(-b)*b^2*sqrt((a^2 + a*b)/b^2)*cos(f*x + e) + (-2*I*a*b - I*b^2)*sq 
rt(-b)*cos(f*x + e))*sqrt((2*b*sqrt((a^2 + a*b)/b^2) + 2*a + b)/b)*ellipti 
c_e(arcsin(sqrt((2*b*sqrt((a^2 + a*b)/b^2) + 2*a + b)/b)*(cos(f*x + e) - I 
*sin(f*x + e))), (8*a^2 + 8*a*b + b^2 - 4*(2*a*b + b^2)*sqrt((a^2 + a*b)/b 
^2))/b^2) - 2*(2*(-I*a*b - I*b^2)*sqrt(-b)*sqrt((a^2 + a*b)/b^2)*cos(f*x + 
 e) + (2*I*a^2 + I*a*b)*sqrt(-b)*cos(f*x + e))*sqrt((2*b*sqrt((a^2 + a*b)/ 
b^2) + 2*a + b)/b)*elliptic_f(arcsin(sqrt((2*b*sqrt((a^2 + a*b)/b^2) + 2*a 
 + b)/b)*(cos(f*x + e) + I*sin(f*x + e))), (8*a^2 + 8*a*b + b^2 - 4*(2*a*b 
 + b^2)*sqrt((a^2 + a*b)/b^2))/b^2) - 2*(2*(I*a*b + I*b^2)*sqrt(-b)*sqrt(( 
a^2 + a*b)/b^2)*cos(f*x + e) + (-2*I*a^2 - I*a*b)*sqrt(-b)*cos(f*x + e))*s 
qrt((2*b*sqrt((a^2 + a*b)/b^2) + 2*a + b)/b)*elliptic_f(arcsin(sqrt((2*b*s 
qrt((a^2 + a*b)/b^2) + 2*a + b)/b)*(cos(f*x + e) - I*sin(f*x + e))), (8*a^ 
2 + 8*a*b + b^2 - 4*(2*a*b + b^2)*sqrt((a^2 + a*b)/b^2))/b^2))/((a*b^2 + b 
^3)*f*cos(f*x + e))
 

Sympy [F]

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

integrate(tan(f*x+e)**2/(a+b*sin(f*x+e)**2)**(1/2),x)
 

Output:

Integral(tan(e + f*x)**2/sqrt(a + b*sin(e + f*x)**2), x)
 

Maxima [F]

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

integrate(tan(f*x+e)^2/(a+b*sin(f*x+e)^2)^(1/2),x, algorithm="maxima")
 

Output:

integrate(tan(f*x + e)^2/sqrt(b*sin(f*x + e)^2 + a), x)
 

Giac [F]

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

integrate(tan(f*x+e)^2/(a+b*sin(f*x+e)^2)^(1/2),x, algorithm="giac")
 

Output:

integrate(tan(f*x + e)^2/sqrt(b*sin(f*x + e)^2 + a), x)
 

Mupad [F(-1)]

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

int(tan(e + f*x)^2/(a + b*sin(e + f*x)^2)^(1/2),x)
 

Output:

int(tan(e + f*x)^2/(a + b*sin(e + f*x)^2)^(1/2), x)
 

Reduce [F]

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

int(tan(f*x+e)^2/(a+b*sin(f*x+e)^2)^(1/2),x)
 

Output:

int((sqrt(sin(e + f*x)**2*b + a)*tan(e + f*x)**2)/(sin(e + f*x)**2*b + a), 
x)