\(\int \csc ^4(c+d x) \sec ^2(c+d x) (a+b \sin (c+d x))^2 \, dx\) [1452]

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 [B] (verification not implemented)
Mupad [B] (verification not implemented)
Reduce [B] (verification not implemented)

Optimal result

Integrand size = 29, antiderivative size = 102 \[ \int \csc ^4(c+d x) \sec ^2(c+d x) (a+b \sin (c+d x))^2 \, dx=-\frac {3 a b \text {arctanh}(\cos (c+d x))}{d}-\frac {\left (2 a^2+b^2\right ) \cot (c+d x)}{d}-\frac {a^2 \cot ^3(c+d x)}{3 d}-\frac {a b \cot (c+d x) \csc (c+d x)}{d}+\frac {2 a b \sec (c+d x)}{d}+\frac {\left (a^2+b^2\right ) \tan (c+d x)}{d} \] Output:

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

Mathematica [A] (verified)

Time = 2.37 (sec) , antiderivative size = 196, normalized size of antiderivative = 1.92 \[ \int \csc ^4(c+d x) \sec ^2(c+d x) (a+b \sin (c+d x))^2 \, dx=\frac {\csc ^5\left (\frac {1}{2} (c+d x)\right ) \sec ^3\left (\frac {1}{2} (c+d x)\right ) \left (-4 \left (4 a^2+3 b^2\right ) \cos (2 (c+d x))+\left (8 a^2+6 b^2\right ) \cos (4 (c+d x))+3 b \left (2 b+10 a \sin (c+d x)-6 a \left (\log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )-\log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )\right ) \sin (2 (c+d x))-6 a \sin (3 (c+d x))+3 a \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right ) \sin (4 (c+d x))-3 a \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right ) \sin (4 (c+d x))\right )\right )}{192 d \left (-1+\cot ^2\left (\frac {1}{2} (c+d x)\right )\right )} \] Input:

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

Output:

(Csc[(c + d*x)/2]^5*Sec[(c + d*x)/2]^3*(-4*(4*a^2 + 3*b^2)*Cos[2*(c + d*x) 
] + (8*a^2 + 6*b^2)*Cos[4*(c + d*x)] + 3*b*(2*b + 10*a*Sin[c + d*x] - 6*a* 
(Log[Cos[(c + d*x)/2]] - Log[Sin[(c + d*x)/2]])*Sin[2*(c + d*x)] - 6*a*Sin 
[3*(c + d*x)] + 3*a*Log[Cos[(c + d*x)/2]]*Sin[4*(c + d*x)] - 3*a*Log[Sin[( 
c + d*x)/2]]*Sin[4*(c + d*x)])))/(192*d*(-1 + Cot[(c + d*x)/2]^2))
 

Rubi [A] (verified)

Time = 0.58 (sec) , antiderivative size = 106, normalized size of antiderivative = 1.04, number of steps used = 11, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.345, Rules used = {3042, 3390, 3042, 3102, 252, 262, 219, 3679, 355, 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 \csc ^4(c+d x) \sec ^2(c+d x) (a+b \sin (c+d x))^2 \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3390

\(\displaystyle \int \csc ^4(c+d x) \sec ^2(c+d x) \left (a^2+b^2 \sin ^2(c+d x)\right )dx+2 a b \int \csc ^3(c+d x) \sec ^2(c+d x)dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3102

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

\(\Big \downarrow \) 252

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

\(\Big \downarrow \) 262

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

\(\Big \downarrow \) 219

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

\(\Big \downarrow \) 3679

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

\(\Big \downarrow \) 355

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

\(\Big \downarrow \) 2009

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

Input:

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

Output:

(2*a*b*((-3*(ArcTanh[Sec[c + d*x]] - Sec[c + d*x]))/2 + Sec[c + d*x]^3/(2* 
(1 - Sec[c + d*x]^2))))/d + (-((2*a^2 + b^2)*Cot[c + d*x]) - (a^2*Cot[c + 
d*x]^3)/3 + (a^2 + b^2)*Tan[c + d*x])/d
 

Defintions of rubi rules used

rule 219
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))* 
ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (Gt 
Q[a, 0] || LtQ[b, 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 355
Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_.)*((c_) + (d_.)*(x_)^2)^(q 
_.), x_Symbol] :> Int[ExpandIntegrand[(e*x)^m*(a + b*x^2)^p*(c + d*x^2)^q, 
x], x] /; FreeQ[{a, b, c, d, e, m}, x] && NeQ[b*c - a*d, 0] && IGtQ[p, 0] & 
& IGtQ[q, 0]
 

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 3102
Int[csc[(e_.) + (f_.)*(x_)]^(n_.)*((a_.)*sec[(e_.) + (f_.)*(x_)])^(m_), x_S 
ymbol] :> Simp[1/(f*a^n)   Subst[Int[x^(m + n - 1)/(-1 + x^2/a^2)^((n + 1)/ 
2), x], x, a*Sec[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n + 1 
)/2] &&  !(IntegerQ[(m + 1)/2] && LtQ[0, m, n])
 

rule 3390
Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((d_.)*sin[(e_.) + (f_.)*(x_)])^(n 
_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^2, x_Symbol] :> Simp[2*a*(b/d) 
Int[(g*Cos[e + f*x])^p*(d*Sin[e + f*x])^(n + 1), x], x] + Int[(g*Cos[e + f* 
x])^p*(d*Sin[e + f*x])^n*(a^2 + b^2*Sin[e + f*x]^2), x] /; FreeQ[{a, b, d, 
e, f, g, n, p}, x] && NeQ[a^2 - b^2, 0]
 

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

Time = 1.38 (sec) , antiderivative size = 136, normalized size of antiderivative = 1.33

method result size
derivativedivides \(\frac {a^{2} \left (-\frac {1}{3 \sin \left (d x +c \right )^{3} \cos \left (d x +c \right )}+\frac {4}{3 \sin \left (d x +c \right ) \cos \left (d x +c \right )}-\frac {8 \cot \left (d x +c \right )}{3}\right )+2 a b \left (-\frac {1}{2 \sin \left (d x +c \right )^{2} \cos \left (d x +c \right )}+\frac {3}{2 \cos \left (d x +c \right )}+\frac {3 \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )+b^{2} \left (\frac {1}{\sin \left (d x +c \right ) \cos \left (d x +c \right )}-2 \cot \left (d x +c \right )\right )}{d}\) \(136\)
default \(\frac {a^{2} \left (-\frac {1}{3 \sin \left (d x +c \right )^{3} \cos \left (d x +c \right )}+\frac {4}{3 \sin \left (d x +c \right ) \cos \left (d x +c \right )}-\frac {8 \cot \left (d x +c \right )}{3}\right )+2 a b \left (-\frac {1}{2 \sin \left (d x +c \right )^{2} \cos \left (d x +c \right )}+\frac {3}{2 \cos \left (d x +c \right )}+\frac {3 \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )+b^{2} \left (\frac {1}{\sin \left (d x +c \right ) \cos \left (d x +c \right )}-2 \cot \left (d x +c \right )\right )}{d}\) \(136\)
risch \(\frac {6 a b \,{\mathrm e}^{7 i \left (d x +c \right )}-4 i b^{2} {\mathrm e}^{4 i \left (d x +c \right )}-10 a b \,{\mathrm e}^{5 i \left (d x +c \right )}+\frac {32 i a^{2} {\mathrm e}^{2 i \left (d x +c \right )}}{3}+8 i b^{2} {\mathrm e}^{2 i \left (d x +c \right )}+10 a b \,{\mathrm e}^{3 i \left (d x +c \right )}-\frac {16 i a^{2}}{3}-4 i b^{2}-6 a b \,{\mathrm e}^{i \left (d x +c \right )}}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{3} \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}-\frac {3 a b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{d}+\frac {3 a b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{d}\) \(181\)
parallelrisch \(\frac {72 b a \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}+6 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4} a b +4 \left (5 a^{2}+3 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}+18 \left (-5 a^{2}-4 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+\cot \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} a^{2}+6 \cot \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} a b +4 \left (5 a^{2}+3 b^{2}\right ) \cot \left (\frac {d x}{2}+\frac {c}{2}\right )-108 a b}{24 d \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right )}\) \(181\)
norman \(\frac {\frac {a^{2}}{24 d}+\frac {a^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{12}}{24 d}-\frac {5 \left (7 a^{2}+6 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}}{6 d}+\frac {\left (11 a^{2}+6 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{12 d}+\frac {\left (11 a^{2}+6 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{10}}{12 d}-\frac {\left (49 a^{2}+48 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}}{24 d}-\frac {\left (49 a^{2}+48 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{8}}{24 d}-\frac {7 a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{2 d}-\frac {19 a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{7}}{4 d}-\frac {33 a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{4 d}+\frac {a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{4 d}+\frac {a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{11}}{4 d}}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right ) \left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{2}}+\frac {3 a b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}\) \(312\)

Input:

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

Output:

1/d*(a^2*(-1/3/sin(d*x+c)^3/cos(d*x+c)+4/3/sin(d*x+c)/cos(d*x+c)-8/3*cot(d 
*x+c))+2*a*b*(-1/2/sin(d*x+c)^2/cos(d*x+c)+3/2/cos(d*x+c)+3/2*ln(csc(d*x+c 
)-cot(d*x+c)))+b^2*(1/sin(d*x+c)/cos(d*x+c)-2*cot(d*x+c)))
 

Fricas [A] (verification not implemented)

Time = 0.09 (sec) , antiderivative size = 192, normalized size of antiderivative = 1.88 \[ \int \csc ^4(c+d x) \sec ^2(c+d x) (a+b \sin (c+d x))^2 \, dx=-\frac {4 \, {\left (4 \, a^{2} + 3 \, b^{2}\right )} \cos \left (d x + c\right )^{4} - 6 \, {\left (4 \, a^{2} + 3 \, b^{2}\right )} \cos \left (d x + c\right )^{2} + 9 \, {\left (a b \cos \left (d x + c\right )^{3} - a b \cos \left (d x + c\right )\right )} \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) - 9 \, {\left (a b \cos \left (d x + c\right )^{3} - a b \cos \left (d x + c\right )\right )} \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) + 6 \, a^{2} + 6 \, b^{2} - 6 \, {\left (3 \, a b \cos \left (d x + c\right )^{2} - 2 \, a b\right )} \sin \left (d x + c\right )}{6 \, {\left (d \cos \left (d x + c\right )^{3} - d \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )} \] Input:

integrate(csc(d*x+c)^4*sec(d*x+c)^2*(a+b*sin(d*x+c))^2,x, algorithm="frica 
s")
 

Output:

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

Sympy [F(-1)]

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

integrate(csc(d*x+c)**4*sec(d*x+c)**2*(a+b*sin(d*x+c))**2,x)
 

Output:

Timed out
 

Maxima [A] (verification not implemented)

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

integrate(csc(d*x+c)^4*sec(d*x+c)^2*(a+b*sin(d*x+c))^2,x, algorithm="maxim 
a")
 

Output:

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

Giac [B] (verification not implemented)

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

Time = 0.25 (sec) , antiderivative size = 204, normalized size of antiderivative = 2.00 \[ \int \csc ^4(c+d x) \sec ^2(c+d x) (a+b \sin (c+d x))^2 \, dx=\frac {a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 6 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 72 \, a b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right ) + 21 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 12 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - \frac {48 \, {\left (a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 2 \, a b\right )}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1} - \frac {132 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 21 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 12 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 6 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + a^{2}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3}}}{24 \, d} \] Input:

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

Output:

1/24*(a^2*tan(1/2*d*x + 1/2*c)^3 + 6*a*b*tan(1/2*d*x + 1/2*c)^2 + 72*a*b*l 
og(abs(tan(1/2*d*x + 1/2*c))) + 21*a^2*tan(1/2*d*x + 1/2*c) + 12*b^2*tan(1 
/2*d*x + 1/2*c) - 48*(a^2*tan(1/2*d*x + 1/2*c) + b^2*tan(1/2*d*x + 1/2*c) 
+ 2*a*b)/(tan(1/2*d*x + 1/2*c)^2 - 1) - (132*a*b*tan(1/2*d*x + 1/2*c)^3 + 
21*a^2*tan(1/2*d*x + 1/2*c)^2 + 12*b^2*tan(1/2*d*x + 1/2*c)^2 + 6*a*b*tan( 
1/2*d*x + 1/2*c) + a^2)/tan(1/2*d*x + 1/2*c)^3)/d
 

Mupad [B] (verification not implemented)

Time = 19.61 (sec) , antiderivative size = 194, normalized size of antiderivative = 1.90 \[ \int \csc ^4(c+d x) \sec ^2(c+d x) (a+b \sin (c+d x))^2 \, dx=\frac {a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3}{24\,d}-\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\left (\frac {20\,a^2}{3}+4\,b^2\right )-{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4\,\left (23\,a^2+20\,b^2\right )+\frac {a^2}{3}-34\,a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+2\,a\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left (8\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3-8\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5\right )}+\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (\frac {7\,a^2}{8}+\frac {b^2}{2}\right )}{d}+\frac {a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}{4\,d}+\frac {3\,a\,b\,\ln \left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d} \] Input:

int((a + b*sin(c + d*x))^2/(cos(c + d*x)^2*sin(c + d*x)^4),x)
 

Output:

(a^2*tan(c/2 + (d*x)/2)^3)/(24*d) - (tan(c/2 + (d*x)/2)^2*((20*a^2)/3 + 4* 
b^2) - tan(c/2 + (d*x)/2)^4*(23*a^2 + 20*b^2) + a^2/3 - 34*a*b*tan(c/2 + ( 
d*x)/2)^3 + 2*a*b*tan(c/2 + (d*x)/2))/(d*(8*tan(c/2 + (d*x)/2)^3 - 8*tan(c 
/2 + (d*x)/2)^5)) + (tan(c/2 + (d*x)/2)*((7*a^2)/8 + b^2/2))/d + (a*b*tan( 
c/2 + (d*x)/2)^2)/(4*d) + (3*a*b*log(tan(c/2 + (d*x)/2)))/d
 

Reduce [B] (verification not implemented)

Time = 0.18 (sec) , antiderivative size = 147, normalized size of antiderivative = 1.44 \[ \int \csc ^4(c+d x) \sec ^2(c+d x) (a+b \sin (c+d x))^2 \, dx=\frac {36 \cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \sin \left (d x +c \right )^{3} a b -27 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{3} a b +32 \sin \left (d x +c \right )^{4} a^{2}+24 \sin \left (d x +c \right )^{4} b^{2}+36 \sin \left (d x +c \right )^{3} a b -16 \sin \left (d x +c \right )^{2} a^{2}-12 \sin \left (d x +c \right )^{2} b^{2}-12 \sin \left (d x +c \right ) a b -4 a^{2}}{12 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{3} d} \] Input:

int(csc(d*x+c)^4*sec(d*x+c)^2*(a+b*sin(d*x+c))^2,x)
 

Output:

(36*cos(c + d*x)*log(tan((c + d*x)/2))*sin(c + d*x)**3*a*b - 27*cos(c + d* 
x)*sin(c + d*x)**3*a*b + 32*sin(c + d*x)**4*a**2 + 24*sin(c + d*x)**4*b**2 
 + 36*sin(c + d*x)**3*a*b - 16*sin(c + d*x)**2*a**2 - 12*sin(c + d*x)**2*b 
**2 - 12*sin(c + d*x)*a*b - 4*a**2)/(12*cos(c + d*x)*sin(c + d*x)**3*d)