\(\int \sin ^2(c+d x) (a+b \sin (c+d x)) \tan ^2(c+d x) \, dx\) [1439]

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

Optimal result

Integrand size = 27, antiderivative size = 77 \[ \int \sin ^2(c+d x) (a+b \sin (c+d x)) \tan ^2(c+d x) \, dx=-\frac {3 a x}{2}+\frac {2 b \cos (c+d x)}{d}-\frac {b \cos ^3(c+d x)}{3 d}+\frac {b \sec (c+d x)}{d}+\frac {a \cos (c+d x) \sin (c+d x)}{2 d}+\frac {a \tan (c+d x)}{d} \] Output:

-3/2*a*x+2*b*cos(d*x+c)/d-1/3*b*cos(d*x+c)^3/d+b*sec(d*x+c)/d+1/2*a*cos(d* 
x+c)*sin(d*x+c)/d+a*tan(d*x+c)/d
 

Mathematica [A] (verified)

Time = 0.61 (sec) , antiderivative size = 82, normalized size of antiderivative = 1.06 \[ \int \sin ^2(c+d x) (a+b \sin (c+d x)) \tan ^2(c+d x) \, dx=-\frac {3 a (c+d x)}{2 d}+\frac {7 b \cos (c+d x)}{4 d}-\frac {b \cos (3 (c+d x))}{12 d}+\frac {b \sec (c+d x)}{d}+\frac {a \sin (2 (c+d x))}{4 d}+\frac {a \tan (c+d x)}{d} \] Input:

Integrate[Sin[c + d*x]^2*(a + b*Sin[c + d*x])*Tan[c + d*x]^2,x]
 

Output:

(-3*a*(c + d*x))/(2*d) + (7*b*Cos[c + d*x])/(4*d) - (b*Cos[3*(c + d*x)])/( 
12*d) + (b*Sec[c + d*x])/d + (a*Sin[2*(c + d*x)])/(4*d) + (a*Tan[c + d*x]) 
/d
 

Rubi [A] (verified)

Time = 0.41 (sec) , antiderivative size = 86, normalized size of antiderivative = 1.12, number of steps used = 11, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.370, Rules used = {3042, 3317, 3042, 3070, 244, 2009, 3071, 252, 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(c+d x) \tan ^2(c+d x) (a+b \sin (c+d x)) \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\sin (c+d x)^4 (a+b \sin (c+d x))}{\cos (c+d x)^2}dx\)

\(\Big \downarrow \) 3317

\(\displaystyle a \int \sin ^2(c+d x) \tan ^2(c+d x)dx+b \int \sin ^3(c+d x) \tan ^2(c+d x)dx\)

\(\Big \downarrow \) 3042

\(\displaystyle a \int \sin (c+d x)^2 \tan (c+d x)^2dx+b \int \sin (c+d x)^3 \tan (c+d x)^2dx\)

\(\Big \downarrow \) 3070

\(\displaystyle a \int \sin (c+d x)^2 \tan (c+d x)^2dx-\frac {b \int \left (1-\cos ^2(c+d x)\right )^2 \sec ^2(c+d x)d\cos (c+d x)}{d}\)

\(\Big \downarrow \) 244

\(\displaystyle a \int \sin (c+d x)^2 \tan (c+d x)^2dx-\frac {b \int \left (\cos ^2(c+d x)+\sec ^2(c+d x)-2\right )d\cos (c+d x)}{d}\)

\(\Big \downarrow \) 2009

\(\displaystyle a \int \sin (c+d x)^2 \tan (c+d x)^2dx-\frac {b \left (\frac {1}{3} \cos ^3(c+d x)-2 \cos (c+d x)-\sec (c+d x)\right )}{d}\)

\(\Big \downarrow \) 3071

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

\(\Big \downarrow \) 252

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

\(\Big \downarrow \) 262

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

\(\Big \downarrow \) 216

\(\displaystyle \frac {a \left (\frac {3}{2} (\tan (c+d x)-\arctan (\tan (c+d x)))-\frac {\tan ^3(c+d x)}{2 \left (\tan ^2(c+d x)+1\right )}\right )}{d}-\frac {b \left (\frac {1}{3} \cos ^3(c+d x)-2 \cos (c+d x)-\sec (c+d x)\right )}{d}\)

Input:

Int[Sin[c + d*x]^2*(a + b*Sin[c + d*x])*Tan[c + d*x]^2,x]
 

Output:

-((b*(-2*Cos[c + d*x] + Cos[c + d*x]^3/3 - Sec[c + d*x]))/d) + (a*((3*(-Ar 
cTan[Tan[c + d*x]] + Tan[c + d*x]))/2 - Tan[c + d*x]^3/(2*(1 + Tan[c + d*x 
]^2))))/d
 

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

rule 252
Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbol] :> Simp[c*(c*x 
)^(m - 1)*((a + b*x^2)^(p + 1)/(2*b*(p + 1))), x] - Simp[c^2*((m - 1)/(2*b* 
(p + 1)))   Int[(c*x)^(m - 2)*(a + b*x^2)^(p + 1), x], x] /; FreeQ[{a, b, c 
}, x] && LtQ[p, -1] && GtQ[m, 1] &&  !ILtQ[(m + 2*p + 3)/2, 0] && IntBinomi 
alQ[a, b, c, 2, m, p, x]
 

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 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

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

rule 3070
Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*tan[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] 
:> Simp[-f^(-1)   Subst[Int[(1 - x^2)^((m + n - 1)/2)/x^n, x], x, Cos[e + f 
*x]], x] /; FreeQ[{e, f}, x] && IntegersQ[m, n, (m + n - 1)/2]
 

rule 3071
Int[sin[(e_.) + (f_.)*(x_)]^(m_)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_S 
ymbol] :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Simp[b*(ff/f)   Subst[I 
nt[(ff*x)^(m + n)/(b^2 + ff^2*x^2)^(m/2 + 1), x], x, b*(Tan[e + f*x]/ff)], 
x]] /; FreeQ[{b, e, f, n}, x] && IntegerQ[m/2]
 

rule 3317
Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((d_.)*sin[(e_.) + (f_.)*(x_)])^(n 
_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[a   Int[(g*Co 
s[e + f*x])^p*(d*Sin[e + f*x])^n, x], x] + Simp[b/d   Int[(g*Cos[e + f*x])^ 
p*(d*Sin[e + f*x])^(n + 1), x], x] /; FreeQ[{a, b, d, e, f, g, n, p}, x]
 
Maple [A] (verified)

Time = 1.95 (sec) , antiderivative size = 104, normalized size of antiderivative = 1.35

method result size
derivativedivides \(\frac {a \left (\frac {\sin \left (d x +c \right )^{5}}{\cos \left (d x +c \right )}+\left (\sin \left (d x +c \right )^{3}+\frac {3 \sin \left (d x +c \right )}{2}\right ) \cos \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )+b \left (\frac {\sin \left (d x +c \right )^{6}}{\cos \left (d x +c \right )}+\left (\frac {8}{3}+\sin \left (d x +c \right )^{4}+\frac {4 \sin \left (d x +c \right )^{2}}{3}\right ) \cos \left (d x +c \right )\right )}{d}\) \(104\)
default \(\frac {a \left (\frac {\sin \left (d x +c \right )^{5}}{\cos \left (d x +c \right )}+\left (\sin \left (d x +c \right )^{3}+\frac {3 \sin \left (d x +c \right )}{2}\right ) \cos \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )+b \left (\frac {\sin \left (d x +c \right )^{6}}{\cos \left (d x +c \right )}+\left (\frac {8}{3}+\sin \left (d x +c \right )^{4}+\frac {4 \sin \left (d x +c \right )^{2}}{3}\right ) \cos \left (d x +c \right )\right )}{d}\) \(104\)
parts \(\frac {a \left (\frac {\sin \left (d x +c \right )^{5}}{\cos \left (d x +c \right )}+\left (\sin \left (d x +c \right )^{3}+\frac {3 \sin \left (d x +c \right )}{2}\right ) \cos \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )}{d}+\frac {b \left (\frac {\sin \left (d x +c \right )^{6}}{\cos \left (d x +c \right )}+\left (\frac {8}{3}+\sin \left (d x +c \right )^{4}+\frac {4 \sin \left (d x +c \right )^{2}}{3}\right ) \cos \left (d x +c \right )\right )}{d}\) \(106\)
risch \(-\frac {3 a x}{2}-\frac {i a \,{\mathrm e}^{2 i \left (d x +c \right )}}{8 d}+\frac {7 b \,{\mathrm e}^{i \left (d x +c \right )}}{8 d}+\frac {7 b \,{\mathrm e}^{-i \left (d x +c \right )}}{8 d}+\frac {i a \,{\mathrm e}^{-2 i \left (d x +c \right )}}{8 d}+\frac {2 i a +2 b \,{\mathrm e}^{i \left (d x +c \right )}}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}-\frac {b \cos \left (3 d x +3 c \right )}{12 d}\) \(117\)

Input:

int(sin(d*x+c)^2*(a+b*sin(d*x+c))*tan(d*x+c)^2,x,method=_RETURNVERBOSE)
 

Output:

1/d*(a*(sin(d*x+c)^5/cos(d*x+c)+(sin(d*x+c)^3+3/2*sin(d*x+c))*cos(d*x+c)-3 
/2*d*x-3/2*c)+b*(sin(d*x+c)^6/cos(d*x+c)+(8/3+sin(d*x+c)^4+4/3*sin(d*x+c)^ 
2)*cos(d*x+c)))
 

Fricas [A] (verification not implemented)

Time = 0.08 (sec) , antiderivative size = 72, normalized size of antiderivative = 0.94 \[ \int \sin ^2(c+d x) (a+b \sin (c+d x)) \tan ^2(c+d x) \, dx=-\frac {2 \, b \cos \left (d x + c\right )^{4} + 9 \, a d x \cos \left (d x + c\right ) - 12 \, b \cos \left (d x + c\right )^{2} - 3 \, {\left (a \cos \left (d x + c\right )^{2} + 2 \, a\right )} \sin \left (d x + c\right ) - 6 \, b}{6 \, d \cos \left (d x + c\right )} \] Input:

integrate(sin(d*x+c)^2*(a+b*sin(d*x+c))*tan(d*x+c)^2,x, algorithm="fricas" 
)
 

Output:

-1/6*(2*b*cos(d*x + c)^4 + 9*a*d*x*cos(d*x + c) - 12*b*cos(d*x + c)^2 - 3* 
(a*cos(d*x + c)^2 + 2*a)*sin(d*x + c) - 6*b)/(d*cos(d*x + c))
 

Sympy [F]

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

integrate(sin(d*x+c)**2*(a+b*sin(d*x+c))*tan(d*x+c)**2,x)
 

Output:

Integral((a + b*sin(c + d*x))*sin(c + d*x)**2*tan(c + d*x)**2, x)
 

Maxima [A] (verification not implemented)

Time = 0.11 (sec) , antiderivative size = 75, normalized size of antiderivative = 0.97 \[ \int \sin ^2(c+d x) (a+b \sin (c+d x)) \tan ^2(c+d x) \, dx=-\frac {3 \, {\left (3 \, d x + 3 \, c - \frac {\tan \left (d x + c\right )}{\tan \left (d x + c\right )^{2} + 1} - 2 \, \tan \left (d x + c\right )\right )} a + 2 \, {\left (\cos \left (d x + c\right )^{3} - \frac {3}{\cos \left (d x + c\right )} - 6 \, \cos \left (d x + c\right )\right )} b}{6 \, d} \] Input:

integrate(sin(d*x+c)^2*(a+b*sin(d*x+c))*tan(d*x+c)^2,x, algorithm="maxima" 
)
 

Output:

-1/6*(3*(3*d*x + 3*c - tan(d*x + c)/(tan(d*x + c)^2 + 1) - 2*tan(d*x + c)) 
*a + 2*(cos(d*x + c)^3 - 3/cos(d*x + c) - 6*cos(d*x + c))*b)/d
 

Giac [F(-1)]

Timed out. \[ \int \sin ^2(c+d x) (a+b \sin (c+d x)) \tan ^2(c+d x) \, dx=\text {Timed out} \] Input:

integrate(sin(d*x+c)^2*(a+b*sin(d*x+c))*tan(d*x+c)^2,x, algorithm="giac")
 

Output:

Timed out
 

Mupad [B] (verification not implemented)

Time = 22.53 (sec) , antiderivative size = 112, normalized size of antiderivative = 1.45 \[ \int \sin ^2(c+d x) (a+b \sin (c+d x)) \tan ^2(c+d x) \, dx=-\frac {3\,a\,x}{2}-\frac {3\,a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^7+5\,a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+5\,a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+\frac {32\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}{3}+3\,a\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )+\frac {16\,b}{3}}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-1\right )\,{\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )}^3} \] Input:

int(sin(c + d*x)^2*tan(c + d*x)^2*(a + b*sin(c + d*x)),x)
 

Output:

- (3*a*x)/2 - ((16*b)/3 + 3*a*tan(c/2 + (d*x)/2) + 5*a*tan(c/2 + (d*x)/2)^ 
3 + 5*a*tan(c/2 + (d*x)/2)^5 + 3*a*tan(c/2 + (d*x)/2)^7 + (32*b*tan(c/2 + 
(d*x)/2)^2)/3)/(d*(tan(c/2 + (d*x)/2)^2 - 1)*(tan(c/2 + (d*x)/2)^2 + 1)^3)
 

Reduce [B] (verification not implemented)

Time = 0.18 (sec) , antiderivative size = 89, normalized size of antiderivative = 1.16 \[ \int \sin ^2(c+d x) (a+b \sin (c+d x)) \tan ^2(c+d x) \, dx=\frac {-9 \cos \left (d x +c \right ) a c -9 \cos \left (d x +c \right ) a d x -16 \cos \left (d x +c \right ) b -2 \sin \left (d x +c \right )^{4} b -3 \sin \left (d x +c \right )^{3} a -8 \sin \left (d x +c \right )^{2} b +9 \sin \left (d x +c \right ) a +16 b}{6 \cos \left (d x +c \right ) d} \] Input:

int(sin(d*x+c)^2*(a+b*sin(d*x+c))*tan(d*x+c)^2,x)
 

Output:

( - 9*cos(c + d*x)*a*c - 9*cos(c + d*x)*a*d*x - 16*cos(c + d*x)*b - 2*sin( 
c + d*x)**4*b - 3*sin(c + d*x)**3*a - 8*sin(c + d*x)**2*b + 9*sin(c + d*x) 
*a + 16*b)/(6*cos(c + d*x)*d)