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

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

Optimal result

Integrand size = 23, antiderivative size = 138 \[ \int \frac {\sin ^2(e+f x)}{\left (a+b \tan ^2(e+f x)\right )^2} \, dx=\frac {(a+3 b) x}{2 (a-b)^3}-\frac {\sqrt {b} (3 a+b) \arctan \left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a}}\right )}{2 \sqrt {a} (a-b)^3 f}-\frac {\cos (e+f x) \sin (e+f x)}{2 (a-b) f \left (a+b \tan ^2(e+f x)\right )}-\frac {b \tan (e+f x)}{(a-b)^2 f \left (a+b \tan ^2(e+f x)\right )} \] Output:

1/2*(a+3*b)*x/(a-b)^3-1/2*b^(1/2)*(3*a+b)*arctan(b^(1/2)*tan(f*x+e)/a^(1/2 
))/a^(1/2)/(a-b)^3/f-1/2*cos(f*x+e)*sin(f*x+e)/(a-b)/f/(a+b*tan(f*x+e)^2)- 
b*tan(f*x+e)/(a-b)^2/f/(a+b*tan(f*x+e)^2)
 

Mathematica [A] (verified)

Time = 1.41 (sec) , antiderivative size = 111, normalized size of antiderivative = 0.80 \[ \int \frac {\sin ^2(e+f x)}{\left (a+b \tan ^2(e+f x)\right )^2} \, dx=-\frac {-2 (a+3 b) (e+f x)+\frac {2 \sqrt {b} (3 a+b) \arctan \left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a}}\right )}{\sqrt {a}}+(a-b) \sin (2 (e+f x))+\frac {2 (a-b) b \sin (2 (e+f x))}{a+b+(a-b) \cos (2 (e+f x))}}{4 (a-b)^3 f} \] Input:

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

Output:

-1/4*(-2*(a + 3*b)*(e + f*x) + (2*Sqrt[b]*(3*a + b)*ArcTan[(Sqrt[b]*Tan[e 
+ f*x])/Sqrt[a]])/Sqrt[a] + (a - b)*Sin[2*(e + f*x)] + (2*(a - b)*b*Sin[2* 
(e + f*x)])/(a + b + (a - b)*Cos[2*(e + f*x)]))/((a - b)^3*f)
 

Rubi [A] (verified)

Time = 0.56 (sec) , antiderivative size = 161, normalized size of antiderivative = 1.17, number of steps used = 9, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.348, Rules used = {3042, 4146, 373, 402, 27, 397, 216, 218}

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4146

\(\displaystyle \frac {\int \frac {\tan ^2(e+f x)}{\left (\tan ^2(e+f x)+1\right )^2 \left (b \tan ^2(e+f x)+a\right )^2}d\tan (e+f x)}{f}\)

\(\Big \downarrow \) 373

\(\displaystyle \frac {\frac {\int \frac {a-3 b \tan ^2(e+f x)}{\left (\tan ^2(e+f x)+1\right ) \left (b \tan ^2(e+f x)+a\right )^2}d\tan (e+f x)}{2 (a-b)}-\frac {\tan (e+f x)}{2 (a-b) \left (\tan ^2(e+f x)+1\right ) \left (a+b \tan ^2(e+f x)\right )}}{f}\)

\(\Big \downarrow \) 402

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

\(\Big \downarrow \) 27

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

\(\Big \downarrow \) 397

\(\displaystyle \frac {\frac {\frac {\frac {(a+3 b) \int \frac {1}{\tan ^2(e+f x)+1}d\tan (e+f x)}{a-b}-\frac {b (3 a+b) \int \frac {1}{b \tan ^2(e+f x)+a}d\tan (e+f x)}{a-b}}{a-b}-\frac {2 b \tan (e+f x)}{(a-b) \left (a+b \tan ^2(e+f x)\right )}}{2 (a-b)}-\frac {\tan (e+f x)}{2 (a-b) \left (\tan ^2(e+f x)+1\right ) \left (a+b \tan ^2(e+f x)\right )}}{f}\)

\(\Big \downarrow \) 216

\(\displaystyle \frac {\frac {\frac {\frac {(a+3 b) \arctan (\tan (e+f x))}{a-b}-\frac {b (3 a+b) \int \frac {1}{b \tan ^2(e+f x)+a}d\tan (e+f x)}{a-b}}{a-b}-\frac {2 b \tan (e+f x)}{(a-b) \left (a+b \tan ^2(e+f x)\right )}}{2 (a-b)}-\frac {\tan (e+f x)}{2 (a-b) \left (\tan ^2(e+f x)+1\right ) \left (a+b \tan ^2(e+f x)\right )}}{f}\)

\(\Big \downarrow \) 218

\(\displaystyle \frac {\frac {\frac {\frac {(a+3 b) \arctan (\tan (e+f x))}{a-b}-\frac {\sqrt {b} (3 a+b) \arctan \left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a}}\right )}{\sqrt {a} (a-b)}}{a-b}-\frac {2 b \tan (e+f x)}{(a-b) \left (a+b \tan ^2(e+f x)\right )}}{2 (a-b)}-\frac {\tan (e+f x)}{2 (a-b) \left (\tan ^2(e+f x)+1\right ) \left (a+b \tan ^2(e+f x)\right )}}{f}\)

Input:

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

Output:

(-1/2*Tan[e + f*x]/((a - b)*(1 + Tan[e + f*x]^2)*(a + b*Tan[e + f*x]^2)) + 
 ((((a + 3*b)*ArcTan[Tan[e + f*x]])/(a - b) - (Sqrt[b]*(3*a + b)*ArcTan[(S 
qrt[b]*Tan[e + f*x])/Sqrt[a]])/(Sqrt[a]*(a - b)))/(a - b) - (2*b*Tan[e + f 
*x])/((a - b)*(a + b*Tan[e + f*x]^2)))/(2*(a - b)))/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 216
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*A 
rcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a 
, 0] || GtQ[b, 0])
 

rule 218
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/R 
t[a/b, 2]], x] /; FreeQ[{a, b}, x] && PosQ[a/b]
 

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 397
Int[((e_) + (f_.)*(x_)^2)/(((a_) + (b_.)*(x_)^2)*((c_) + (d_.)*(x_)^2)), x_ 
Symbol] :> Simp[(b*e - a*f)/(b*c - a*d)   Int[1/(a + b*x^2), x], x] - Simp[ 
(d*e - c*f)/(b*c - a*d)   Int[1/(c + d*x^2), x], x] /; FreeQ[{a, b, c, d, e 
, f}, x]
 

rule 402
Int[((a_) + (b_.)*(x_)^2)^(p_)*((c_) + (d_.)*(x_)^2)^(q_.)*((e_) + (f_.)*(x 
_)^2), x_Symbol] :> Simp[(-(b*e - a*f))*x*(a + b*x^2)^(p + 1)*((c + d*x^2)^ 
(q + 1)/(a*2*(b*c - a*d)*(p + 1))), x] + Simp[1/(a*2*(b*c - a*d)*(p + 1)) 
 Int[(a + b*x^2)^(p + 1)*(c + d*x^2)^q*Simp[c*(b*e - a*f) + e*2*(b*c - a*d) 
*(p + 1) + d*(b*e - a*f)*(2*(p + q + 2) + 1)*x^2, x], x], x] /; FreeQ[{a, b 
, c, d, e, f, q}, x] && LtQ[p, -1]
 

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

rule 4146
Int[sin[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_ 
)])^(n_))^(p_.), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Sim 
p[c*(ff^(m + 1)/f)   Subst[Int[x^m*((a + b*(ff*x)^n)^p/(c^2 + ff^2*x^2)^(m/ 
2 + 1)), x], x, c*(Tan[e + f*x]/ff)], x]] /; FreeQ[{a, b, c, e, f, n, p}, x 
] && IntegerQ[m/2]
 
Maple [A] (verified)

Time = 7.65 (sec) , antiderivative size = 120, normalized size of antiderivative = 0.87

method result size
derivativedivides \(\frac {-\frac {b \left (\frac {\left (\frac {a}{2}-\frac {b}{2}\right ) \tan \left (f x +e \right )}{a +b \tan \left (f x +e \right )^{2}}+\frac {\left (3 a +b \right ) \arctan \left (\frac {b \tan \left (f x +e \right )}{\sqrt {a b}}\right )}{2 \sqrt {a b}}\right )}{\left (a -b \right )^{3}}+\frac {\frac {\left (-\frac {a}{2}+\frac {b}{2}\right ) \tan \left (f x +e \right )}{1+\tan \left (f x +e \right )^{2}}+\frac {\left (a +3 b \right ) \arctan \left (\tan \left (f x +e \right )\right )}{2}}{\left (a -b \right )^{3}}}{f}\) \(120\)
default \(\frac {-\frac {b \left (\frac {\left (\frac {a}{2}-\frac {b}{2}\right ) \tan \left (f x +e \right )}{a +b \tan \left (f x +e \right )^{2}}+\frac {\left (3 a +b \right ) \arctan \left (\frac {b \tan \left (f x +e \right )}{\sqrt {a b}}\right )}{2 \sqrt {a b}}\right )}{\left (a -b \right )^{3}}+\frac {\frac {\left (-\frac {a}{2}+\frac {b}{2}\right ) \tan \left (f x +e \right )}{1+\tan \left (f x +e \right )^{2}}+\frac {\left (a +3 b \right ) \arctan \left (\tan \left (f x +e \right )\right )}{2}}{\left (a -b \right )^{3}}}{f}\) \(120\)
risch \(\frac {x a}{2 \left (a^{2}-2 a b +b^{2}\right ) \left (a -b \right )}+\frac {3 x b}{2 \left (a^{2}-2 a b +b^{2}\right ) \left (a -b \right )}+\frac {i {\mathrm e}^{2 i \left (f x +e \right )}}{8 \left (a^{2}-2 a b +b^{2}\right ) f}-\frac {i {\mathrm e}^{-2 i \left (f x +e \right )}}{8 \left (a^{2}-2 a b +b^{2}\right ) f}-\frac {i b \left (a \,{\mathrm e}^{2 i \left (f x +e \right )}+b \,{\mathrm e}^{2 i \left (f x +e \right )}+a -b \right )}{f \left (-a +b \right )^{3} \left (-a \,{\mathrm e}^{4 i \left (f x +e \right )}+b \,{\mathrm e}^{4 i \left (f x +e \right )}-2 a \,{\mathrm e}^{2 i \left (f x +e \right )}-2 b \,{\mathrm e}^{2 i \left (f x +e \right )}-a +b \right )}-\frac {3 \sqrt {-a b}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {2 i \sqrt {-a b}-a -b}{a -b}\right )}{4 \left (a -b \right )^{3} f}-\frac {\sqrt {-a b}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {2 i \sqrt {-a b}-a -b}{a -b}\right ) b}{4 a \left (a -b \right )^{3} f}+\frac {3 \sqrt {-a b}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+\frac {2 i \sqrt {-a b}+a +b}{a -b}\right )}{4 \left (a -b \right )^{3} f}+\frac {\sqrt {-a b}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+\frac {2 i \sqrt {-a b}+a +b}{a -b}\right ) b}{4 a \left (a -b \right )^{3} f}\) \(415\)

Input:

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

Output:

1/f*(-1/(a-b)^3*b*((1/2*a-1/2*b)*tan(f*x+e)/(a+b*tan(f*x+e)^2)+1/2*(3*a+b) 
/(a*b)^(1/2)*arctan(b*tan(f*x+e)/(a*b)^(1/2)))+1/(a-b)^3*((-1/2*a+1/2*b)*t 
an(f*x+e)/(1+tan(f*x+e)^2)+1/2*(a+3*b)*arctan(tan(f*x+e))))
 

Fricas [A] (verification not implemented)

Time = 0.14 (sec) , antiderivative size = 568, normalized size of antiderivative = 4.12 \[ \int \frac {\sin ^2(e+f x)}{\left (a+b \tan ^2(e+f x)\right )^2} \, dx=\left [\frac {4 \, {\left (a^{2} + 2 \, a b - 3 \, b^{2}\right )} f x \cos \left (f x + e\right )^{2} + 4 \, {\left (a b + 3 \, b^{2}\right )} f x - {\left ({\left (3 \, a^{2} - 2 \, a b - b^{2}\right )} \cos \left (f x + e\right )^{2} + 3 \, a b + b^{2}\right )} \sqrt {-\frac {b}{a}} \log \left (\frac {{\left (a^{2} + 6 \, a b + b^{2}\right )} \cos \left (f x + e\right )^{4} - 2 \, {\left (3 \, a b + b^{2}\right )} \cos \left (f x + e\right )^{2} - 4 \, {\left ({\left (a^{2} + a b\right )} \cos \left (f x + e\right )^{3} - a b \cos \left (f x + e\right )\right )} \sqrt {-\frac {b}{a}} \sin \left (f x + e\right ) + b^{2}}{{\left (a^{2} - 2 \, a b + b^{2}\right )} \cos \left (f x + e\right )^{4} + 2 \, {\left (a b - b^{2}\right )} \cos \left (f x + e\right )^{2} + b^{2}}\right ) - 4 \, {\left ({\left (a^{2} - 2 \, a b + b^{2}\right )} \cos \left (f x + e\right )^{3} + 2 \, {\left (a b - b^{2}\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{8 \, {\left ({\left (a^{4} - 4 \, a^{3} b + 6 \, a^{2} b^{2} - 4 \, a b^{3} + b^{4}\right )} f \cos \left (f x + e\right )^{2} + {\left (a^{3} b - 3 \, a^{2} b^{2} + 3 \, a b^{3} - b^{4}\right )} f\right )}}, \frac {2 \, {\left (a^{2} + 2 \, a b - 3 \, b^{2}\right )} f x \cos \left (f x + e\right )^{2} + 2 \, {\left (a b + 3 \, b^{2}\right )} f x + {\left ({\left (3 \, a^{2} - 2 \, a b - b^{2}\right )} \cos \left (f x + e\right )^{2} + 3 \, a b + b^{2}\right )} \sqrt {\frac {b}{a}} \arctan \left (\frac {{\left ({\left (a + b\right )} \cos \left (f x + e\right )^{2} - b\right )} \sqrt {\frac {b}{a}}}{2 \, b \cos \left (f x + e\right ) \sin \left (f x + e\right )}\right ) - 2 \, {\left ({\left (a^{2} - 2 \, a b + b^{2}\right )} \cos \left (f x + e\right )^{3} + 2 \, {\left (a b - b^{2}\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{4 \, {\left ({\left (a^{4} - 4 \, a^{3} b + 6 \, a^{2} b^{2} - 4 \, a b^{3} + b^{4}\right )} f \cos \left (f x + e\right )^{2} + {\left (a^{3} b - 3 \, a^{2} b^{2} + 3 \, a b^{3} - b^{4}\right )} f\right )}}\right ] \] Input:

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

Output:

[1/8*(4*(a^2 + 2*a*b - 3*b^2)*f*x*cos(f*x + e)^2 + 4*(a*b + 3*b^2)*f*x - ( 
(3*a^2 - 2*a*b - b^2)*cos(f*x + e)^2 + 3*a*b + b^2)*sqrt(-b/a)*log(((a^2 + 
 6*a*b + b^2)*cos(f*x + e)^4 - 2*(3*a*b + b^2)*cos(f*x + e)^2 - 4*((a^2 + 
a*b)*cos(f*x + e)^3 - a*b*cos(f*x + e))*sqrt(-b/a)*sin(f*x + e) + b^2)/((a 
^2 - 2*a*b + b^2)*cos(f*x + e)^4 + 2*(a*b - b^2)*cos(f*x + e)^2 + b^2)) - 
4*((a^2 - 2*a*b + b^2)*cos(f*x + e)^3 + 2*(a*b - b^2)*cos(f*x + e))*sin(f* 
x + e))/((a^4 - 4*a^3*b + 6*a^2*b^2 - 4*a*b^3 + b^4)*f*cos(f*x + e)^2 + (a 
^3*b - 3*a^2*b^2 + 3*a*b^3 - b^4)*f), 1/4*(2*(a^2 + 2*a*b - 3*b^2)*f*x*cos 
(f*x + e)^2 + 2*(a*b + 3*b^2)*f*x + ((3*a^2 - 2*a*b - b^2)*cos(f*x + e)^2 
+ 3*a*b + b^2)*sqrt(b/a)*arctan(1/2*((a + b)*cos(f*x + e)^2 - b)*sqrt(b/a) 
/(b*cos(f*x + e)*sin(f*x + e))) - 2*((a^2 - 2*a*b + b^2)*cos(f*x + e)^3 + 
2*(a*b - b^2)*cos(f*x + e))*sin(f*x + e))/((a^4 - 4*a^3*b + 6*a^2*b^2 - 4* 
a*b^3 + b^4)*f*cos(f*x + e)^2 + (a^3*b - 3*a^2*b^2 + 3*a*b^3 - b^4)*f)]
 

Sympy [F(-1)]

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

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

Output:

Timed out
 

Maxima [A] (verification not implemented)

Time = 0.11 (sec) , antiderivative size = 185, normalized size of antiderivative = 1.34 \[ \int \frac {\sin ^2(e+f x)}{\left (a+b \tan ^2(e+f x)\right )^2} \, dx=\frac {\frac {{\left (f x + e\right )} {\left (a + 3 \, b\right )}}{a^{3} - 3 \, a^{2} b + 3 \, a b^{2} - b^{3}} - \frac {{\left (3 \, a b + b^{2}\right )} \arctan \left (\frac {b \tan \left (f x + e\right )}{\sqrt {a b}}\right )}{{\left (a^{3} - 3 \, a^{2} b + 3 \, a b^{2} - b^{3}\right )} \sqrt {a b}} - \frac {2 \, b \tan \left (f x + e\right )^{3} + {\left (a + b\right )} \tan \left (f x + e\right )}{{\left (a^{2} b - 2 \, a b^{2} + b^{3}\right )} \tan \left (f x + e\right )^{4} + a^{3} - 2 \, a^{2} b + a b^{2} + {\left (a^{3} - a^{2} b - a b^{2} + b^{3}\right )} \tan \left (f x + e\right )^{2}}}{2 \, f} \] Input:

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

Output:

1/2*((f*x + e)*(a + 3*b)/(a^3 - 3*a^2*b + 3*a*b^2 - b^3) - (3*a*b + b^2)*a 
rctan(b*tan(f*x + e)/sqrt(a*b))/((a^3 - 3*a^2*b + 3*a*b^2 - b^3)*sqrt(a*b) 
) - (2*b*tan(f*x + e)^3 + (a + b)*tan(f*x + e))/((a^2*b - 2*a*b^2 + b^3)*t 
an(f*x + e)^4 + a^3 - 2*a^2*b + a*b^2 + (a^3 - a^2*b - a*b^2 + b^3)*tan(f* 
x + e)^2))/f
 

Giac [A] (verification not implemented)

Time = 0.70 (sec) , antiderivative size = 180, normalized size of antiderivative = 1.30 \[ \int \frac {\sin ^2(e+f x)}{\left (a+b \tan ^2(e+f x)\right )^2} \, dx=\frac {{\left (f x + e\right )} {\left (a + 3 \, b\right )}}{2 \, {\left (a^{3} f - 3 \, a^{2} b f + 3 \, a b^{2} f - b^{3} f\right )}} - \frac {{\left (3 \, a b + b^{2}\right )} \arctan \left (\frac {b \tan \left (f x + e\right )}{\sqrt {a b}}\right )}{2 \, {\left (a^{3} f - 3 \, a^{2} b f + 3 \, a b^{2} f - b^{3} f\right )} \sqrt {a b}} - \frac {2 \, b \tan \left (f x + e\right )^{3} + a \tan \left (f x + e\right ) + b \tan \left (f x + e\right )}{2 \, {\left (b \tan \left (f x + e\right )^{4} + a \tan \left (f x + e\right )^{2} + b \tan \left (f x + e\right )^{2} + a\right )} {\left (a^{2} f - 2 \, a b f + b^{2} f\right )}} \] Input:

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

Output:

1/2*(f*x + e)*(a + 3*b)/(a^3*f - 3*a^2*b*f + 3*a*b^2*f - b^3*f) - 1/2*(3*a 
*b + b^2)*arctan(b*tan(f*x + e)/sqrt(a*b))/((a^3*f - 3*a^2*b*f + 3*a*b^2*f 
 - b^3*f)*sqrt(a*b)) - 1/2*(2*b*tan(f*x + e)^3 + a*tan(f*x + e) + b*tan(f* 
x + e))/((b*tan(f*x + e)^4 + a*tan(f*x + e)^2 + b*tan(f*x + e)^2 + a)*(a^2 
*f - 2*a*b*f + b^2*f))
 

Mupad [B] (verification not implemented)

Time = 11.05 (sec) , antiderivative size = 3301, normalized size of antiderivative = 23.92 \[ \int \frac {\sin ^2(e+f x)}{\left (a+b \tan ^2(e+f x)\right )^2} \, dx=\text {Too large to display} \] Input:

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

Output:

(atan((((-a*b)^(1/2)*((tan(e + f*x)*(6*a*b^4 + 5*b^5 + 5*a^2*b^3))/(a^4 - 
4*a^3*b - 4*a*b^3 + b^4 + 6*a^2*b^2) + ((-a*b)^(1/2)*(3*a + b)*((10*a*b^8 
- 2*b^9 - 18*a^2*b^7 + 10*a^3*b^6 + 10*a^4*b^5 - 18*a^5*b^4 + 10*a^6*b^3 - 
 2*a^7*b^2)/(a^6 - 6*a^5*b - 6*a*b^5 + b^6 + 15*a^2*b^4 - 20*a^3*b^3 + 15* 
a^4*b^2) - (tan(e + f*x)*(-a*b)^(1/2)*(3*a + b)*(40*a*b^8 - 8*b^9 - 72*a^2 
*b^7 + 40*a^3*b^6 + 40*a^4*b^5 - 72*a^5*b^4 + 40*a^6*b^3 - 8*a^7*b^2))/(4* 
(a*b^3 + 3*a^3*b - a^4 - 3*a^2*b^2)*(a^4 - 4*a^3*b - 4*a*b^3 + b^4 + 6*a^2 
*b^2))))/(4*(a*b^3 + 3*a^3*b - a^4 - 3*a^2*b^2)))*(3*a + b)*1i)/(4*(a*b^3 
+ 3*a^3*b - a^4 - 3*a^2*b^2)) + ((-a*b)^(1/2)*((tan(e + f*x)*(6*a*b^4 + 5* 
b^5 + 5*a^2*b^3))/(a^4 - 4*a^3*b - 4*a*b^3 + b^4 + 6*a^2*b^2) - ((-a*b)^(1 
/2)*(3*a + b)*((10*a*b^8 - 2*b^9 - 18*a^2*b^7 + 10*a^3*b^6 + 10*a^4*b^5 - 
18*a^5*b^4 + 10*a^6*b^3 - 2*a^7*b^2)/(a^6 - 6*a^5*b - 6*a*b^5 + b^6 + 15*a 
^2*b^4 - 20*a^3*b^3 + 15*a^4*b^2) + (tan(e + f*x)*(-a*b)^(1/2)*(3*a + b)*( 
40*a*b^8 - 8*b^9 - 72*a^2*b^7 + 40*a^3*b^6 + 40*a^4*b^5 - 72*a^5*b^4 + 40* 
a^6*b^3 - 8*a^7*b^2))/(4*(a*b^3 + 3*a^3*b - a^4 - 3*a^2*b^2)*(a^4 - 4*a^3* 
b - 4*a*b^3 + b^4 + 6*a^2*b^2))))/(4*(a*b^3 + 3*a^3*b - a^4 - 3*a^2*b^2))) 
*(3*a + b)*1i)/(4*(a*b^3 + 3*a^3*b - a^4 - 3*a^2*b^2)))/((5*a*b^4 + (3*b^5 
)/2 + (3*a^2*b^3)/2)/(a^6 - 6*a^5*b - 6*a*b^5 + b^6 + 15*a^2*b^4 - 20*a^3* 
b^3 + 15*a^4*b^2) - ((-a*b)^(1/2)*((tan(e + f*x)*(6*a*b^4 + 5*b^5 + 5*a^2* 
b^3))/(a^4 - 4*a^3*b - 4*a*b^3 + b^4 + 6*a^2*b^2) + ((-a*b)^(1/2)*(3*a ...
 

Reduce [B] (verification not implemented)

Time = 0.19 (sec) , antiderivative size = 701, normalized size of antiderivative = 5.08 \[ \int \frac {\sin ^2(e+f x)}{\left (a+b \tan ^2(e+f x)\right )^2} \, dx =\text {Too large to display} \] Input:

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

Output:

(3*sqrt(b)*sqrt(a)*atan((sqrt(a - b) - sqrt(a)*tan((e + f*x)/2))/sqrt(b))* 
sin(e + f*x)**2*a**2 - 2*sqrt(b)*sqrt(a)*atan((sqrt(a - b) - sqrt(a)*tan(( 
e + f*x)/2))/sqrt(b))*sin(e + f*x)**2*a*b - sqrt(b)*sqrt(a)*atan((sqrt(a - 
 b) - sqrt(a)*tan((e + f*x)/2))/sqrt(b))*sin(e + f*x)**2*b**2 - 3*sqrt(b)* 
sqrt(a)*atan((sqrt(a - b) - sqrt(a)*tan((e + f*x)/2))/sqrt(b))*a**2 - sqrt 
(b)*sqrt(a)*atan((sqrt(a - b) - sqrt(a)*tan((e + f*x)/2))/sqrt(b))*a*b - 3 
*sqrt(b)*sqrt(a)*atan((sqrt(a - b) + sqrt(a)*tan((e + f*x)/2))/sqrt(b))*si 
n(e + f*x)**2*a**2 + 2*sqrt(b)*sqrt(a)*atan((sqrt(a - b) + sqrt(a)*tan((e 
+ f*x)/2))/sqrt(b))*sin(e + f*x)**2*a*b + sqrt(b)*sqrt(a)*atan((sqrt(a - b 
) + sqrt(a)*tan((e + f*x)/2))/sqrt(b))*sin(e + f*x)**2*b**2 + 3*sqrt(b)*sq 
rt(a)*atan((sqrt(a - b) + sqrt(a)*tan((e + f*x)/2))/sqrt(b))*a**2 + sqrt(b 
)*sqrt(a)*atan((sqrt(a - b) + sqrt(a)*tan((e + f*x)/2))/sqrt(b))*a*b - cos 
(e + f*x)*sin(e + f*x)**3*a**3 + 2*cos(e + f*x)*sin(e + f*x)**3*a**2*b - c 
os(e + f*x)*sin(e + f*x)**3*a*b**2 + cos(e + f*x)*sin(e + f*x)*a**3 - cos( 
e + f*x)*sin(e + f*x)*a*b**2 + sin(e + f*x)**2*a**3*e + sin(e + f*x)**2*a* 
*3*f*x + 2*sin(e + f*x)**2*a**2*b*e + 2*sin(e + f*x)**2*a**2*b*f*x - 3*sin 
(e + f*x)**2*a*b**2*e - 3*sin(e + f*x)**2*a*b**2*f*x - a**3*e - a**3*f*x - 
 3*a**2*b*e - 3*a**2*b*f*x)/(2*a*f*(sin(e + f*x)**2*a**4 - 4*sin(e + f*x)* 
*2*a**3*b + 6*sin(e + f*x)**2*a**2*b**2 - 4*sin(e + f*x)**2*a*b**3 + sin(e 
 + f*x)**2*b**4 - a**4 + 3*a**3*b - 3*a**2*b**2 + a*b**3))