\(\int (a+b \sec ^2(e+f x))^2 \sin ^2(e+f x) \, dx\) [23]

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [A] (verified)
Fricas [A] (verification not implemented)
Sympy [F]
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 = 65 \[ \int \left (a+b \sec ^2(e+f x)\right )^2 \sin ^2(e+f x) \, dx=\frac {1}{2} a (a-4 b) x-\frac {a^2 \cos (e+f x) \sin (e+f x)}{2 f}+\frac {2 a b \tan (e+f x)}{f}+\frac {b^2 \tan ^3(e+f x)}{3 f} \] Output:

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

Mathematica [A] (verified)

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

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

Output:

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

Rubi [A] (verified)

Time = 0.27 (sec) , antiderivative size = 76, normalized size of antiderivative = 1.17, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.261, Rules used = {3042, 4620, 366, 363, 262, 216}

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

\(\Big \downarrow \) 3042

\(\displaystyle \int \sin (e+f x)^2 \left (a+b \sec (e+f x)^2\right )^2dx\)

\(\Big \downarrow \) 4620

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

\(\Big \downarrow \) 366

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

\(\Big \downarrow \) 363

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

\(\Big \downarrow \) 262

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

\(\Big \downarrow \) 216

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

Input:

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

Output:

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

Defintions of rubi rules used

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 262
Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbol] :> Simp[c*(c*x) 
^(m - 1)*((a + b*x^2)^(p + 1)/(b*(m + 2*p + 1))), x] - Simp[a*c^2*((m - 1)/ 
(b*(m + 2*p + 1)))   Int[(c*x)^(m - 2)*(a + b*x^2)^p, x], x] /; FreeQ[{a, b 
, c, p}, x] && GtQ[m, 2 - 1] && NeQ[m + 2*p + 1, 0] && IntBinomialQ[a, b, c 
, 2, m, p, x]
 

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

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

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

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

Time = 0.75 (sec) , antiderivative size = 71, normalized size of antiderivative = 1.09

method result size
derivativedivides \(\frac {a^{2} \left (-\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )+2 a b \left (\tan \left (f x +e \right )-f x -e \right )+\frac {b^{2} \sin \left (f x +e \right )^{3}}{3 \cos \left (f x +e \right )^{3}}}{f}\) \(71\)
default \(\frac {a^{2} \left (-\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )+2 a b \left (\tan \left (f x +e \right )-f x -e \right )+\frac {b^{2} \sin \left (f x +e \right )^{3}}{3 \cos \left (f x +e \right )^{3}}}{f}\) \(71\)
parts \(\frac {a^{2} \left (-\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )}{f}+\frac {b^{2} \sin \left (f x +e \right )^{3}}{3 f \cos \left (f x +e \right )^{3}}+\frac {2 a b \left (\tan \left (f x +e \right )-f x -e \right )}{f}\) \(76\)
risch \(\frac {a^{2} x}{2}-2 x a b +\frac {i {\mathrm e}^{2 i \left (f x +e \right )} a^{2}}{8 f}-\frac {i {\mathrm e}^{-2 i \left (f x +e \right )} a^{2}}{8 f}-\frac {2 i b \left (-6 a \,{\mathrm e}^{4 i \left (f x +e \right )}+3 b \,{\mathrm e}^{4 i \left (f x +e \right )}-12 a \,{\mathrm e}^{2 i \left (f x +e \right )}-6 a +b \right )}{3 f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{3}}\) \(110\)
parallelrisch \(\frac {12 a f x \left (a -4 b \right ) \cos \left (3 f x +3 e \right )+\left (-9 a^{2}+48 a b -8 b^{2}\right ) \sin \left (3 f x +3 e \right )-3 \sin \left (5 f x +5 e \right ) a^{2}+36 a f x \left (a -4 b \right ) \cos \left (f x +e \right )-6 \sin \left (f x +e \right ) \left (a^{2}-8 a b -4 b^{2}\right )}{24 f \left (\cos \left (3 f x +3 e \right )+3 \cos \left (f x +e \right )\right )}\) \(122\)
norman \(\frac {\left (-\frac {1}{2} a^{2}+2 a b \right ) x +\left (-\frac {1}{2} a^{2}+2 a b \right ) x \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{8}+\left (\frac {1}{2} a^{2}-2 a b \right ) x \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2}+\left (\frac {1}{2} a^{2}-2 a b \right ) x \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{10}+\left (-a^{2}+4 a b \right ) x \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{6}+\left (a^{2}-4 a b \right ) x \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{4}+\frac {a \left (a -4 b \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{f}+\frac {a \left (a -4 b \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{9}}{f}-\frac {4 \left (3 a^{2}+2 b^{2}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{3}}{3 f}-\frac {4 \left (3 a^{2}+2 b^{2}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{7}}{3 f}+\frac {2 \left (9 a^{2}+12 a b -8 b^{2}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{5}}{3 f}}{\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2}-1\right )^{3} \left (1+\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2}\right )^{2}}\) \(283\)

Input:

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

Output:

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

Fricas [A] (verification not implemented)

Time = 0.08 (sec) , antiderivative size = 81, normalized size of antiderivative = 1.25 \[ \int \left (a+b \sec ^2(e+f x)\right )^2 \sin ^2(e+f x) \, dx=\frac {3 \, {\left (a^{2} - 4 \, a b\right )} f x \cos \left (f x + e\right )^{3} - {\left (3 \, a^{2} \cos \left (f x + e\right )^{4} - 2 \, {\left (6 \, a b - b^{2}\right )} \cos \left (f x + e\right )^{2} - 2 \, b^{2}\right )} \sin \left (f x + e\right )}{6 \, f \cos \left (f x + e\right )^{3}} \] Input:

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

Output:

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

Sympy [F]

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

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

Output:

Integral((a + b*sec(e + f*x)**2)**2*sin(e + f*x)**2, x)
 

Maxima [A] (verification not implemented)

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

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

Output:

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

Giac [A] (verification not implemented)

Time = 0.15 (sec) , antiderivative size = 67, normalized size of antiderivative = 1.03 \[ \int \left (a+b \sec ^2(e+f x)\right )^2 \sin ^2(e+f x) \, dx=\frac {2 \, b^{2} \tan \left (f x + e\right )^{3} + 12 \, a b \tan \left (f x + e\right ) + 3 \, {\left (a^{2} - 4 \, a b\right )} {\left (f x + e\right )} - \frac {3 \, a^{2} \tan \left (f x + e\right )}{\tan \left (f x + e\right )^{2} + 1}}{6 \, f} \] Input:

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

Output:

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

Mupad [B] (verification not implemented)

Time = 12.65 (sec) , antiderivative size = 94, normalized size of antiderivative = 1.45 \[ \int \left (a+b \sec ^2(e+f x)\right )^2 \sin ^2(e+f x) \, dx=\frac {b^2\,{\mathrm {tan}\left (e+f\,x\right )}^3}{3\,f}-\frac {a^2\,\sin \left (2\,e+2\,f\,x\right )}{4\,f}-\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (2\,b^2-2\,b\,\left (a+b\right )\right )}{f}-\frac {a\,\mathrm {atan}\left (\frac {a\,\mathrm {tan}\left (e+f\,x\right )\,\left (a-4\,b\right )}{2\,\left (2\,a\,b-\frac {a^2}{2}\right )}\right )\,\left (a-4\,b\right )}{2\,f} \] Input:

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

Output:

(b^2*tan(e + f*x)^3)/(3*f) - (a^2*sin(2*e + 2*f*x))/(4*f) - (tan(e + f*x)* 
(2*b^2 - 2*b*(a + b)))/f - (a*atan((a*tan(e + f*x)*(a - 4*b))/(2*(2*a*b - 
a^2/2)))*(a - 4*b))/(2*f)
 

Reduce [B] (verification not implemented)

Time = 0.16 (sec) , antiderivative size = 167, normalized size of antiderivative = 2.57 \[ \int \left (a+b \sec ^2(e+f x)\right )^2 \sin ^2(e+f x) \, dx=\frac {-3 \cos \left (f x +e \right )^{2} \sin \left (f x +e \right )^{3} a^{2}+3 \cos \left (f x +e \right )^{2} \sin \left (f x +e \right ) a^{2}+3 \cos \left (f x +e \right ) \sin \left (f x +e \right )^{2} a^{2} f x -12 \cos \left (f x +e \right ) \sin \left (f x +e \right )^{2} a b f x -3 \cos \left (f x +e \right ) a^{2} f x +12 \cos \left (f x +e \right ) a b f x +12 \sin \left (f x +e \right )^{3} a b -2 \sin \left (f x +e \right )^{3} b^{2}-12 \sin \left (f x +e \right ) a b}{6 \cos \left (f x +e \right ) f \left (\sin \left (f x +e \right )^{2}-1\right )} \] Input:

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

Output:

( - 3*cos(e + f*x)**2*sin(e + f*x)**3*a**2 + 3*cos(e + f*x)**2*sin(e + f*x 
)*a**2 + 3*cos(e + f*x)*sin(e + f*x)**2*a**2*f*x - 12*cos(e + f*x)*sin(e + 
 f*x)**2*a*b*f*x - 3*cos(e + f*x)*a**2*f*x + 12*cos(e + f*x)*a*b*f*x + 12* 
sin(e + f*x)**3*a*b - 2*sin(e + f*x)**3*b**2 - 12*sin(e + f*x)*a*b)/(6*cos 
(e + f*x)*f*(sin(e + f*x)**2 - 1))