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

Optimal result
Mathematica [B] (verified)
Rubi [A] (warning: unable to verify)
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 = 29, antiderivative size = 100 \[ \int \csc ^3(c+d x) \sec ^2(c+d x) (a+b \sin (c+d x))^2 \, dx=-\frac {\left (3 a^2+2 b^2\right ) \text {arctanh}(\cos (c+d x))}{2 d}-\frac {2 a b \cot (c+d x)}{d}+\frac {\left (3 a^2+2 b^2\right ) \sec (c+d x)}{2 d}-\frac {a^2 \csc ^2(c+d x) \sec (c+d x)}{2 d}+\frac {2 a b \tan (c+d x)}{d} \] Output:

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

Mathematica [B] (verified)

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

Time = 1.73 (sec) , antiderivative size = 238, normalized size of antiderivative = 2.38 \[ \int \csc ^3(c+d x) \sec ^2(c+d x) (a+b \sin (c+d x))^2 \, dx=\frac {\csc ^4(c+d x) \left (2 a^2+4 b^2-2 \left (3 a^2+2 b^2\right ) \cos (2 (c+d x))+3 a^2 \cos (3 (c+d x)) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )+2 b^2 \cos (3 (c+d x)) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )-\left (3 a^2+2 b^2\right ) \cos (c+d x) \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 )-3 a^2 \cos (3 (c+d x)) \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )-2 b^2 \cos (3 (c+d x)) \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )+8 a b \sin (c+d x)-8 a b \sin (3 (c+d x))\right )}{2 d \left (\csc ^2\left (\frac {1}{2} (c+d x)\right )-\sec ^2\left (\frac {1}{2} (c+d x)\right )\right )} \] Input:

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

Output:

(Csc[c + d*x]^4*(2*a^2 + 4*b^2 - 2*(3*a^2 + 2*b^2)*Cos[2*(c + d*x)] + 3*a^ 
2*Cos[3*(c + d*x)]*Log[Cos[(c + d*x)/2]] + 2*b^2*Cos[3*(c + d*x)]*Log[Cos[ 
(c + d*x)/2]] - (3*a^2 + 2*b^2)*Cos[c + d*x]*(Log[Cos[(c + d*x)/2]] - Log[ 
Sin[(c + d*x)/2]]) - 3*a^2*Cos[3*(c + d*x)]*Log[Sin[(c + d*x)/2]] - 2*b^2* 
Cos[3*(c + d*x)]*Log[Sin[(c + d*x)/2]] + 8*a*b*Sin[c + d*x] - 8*a*b*Sin[3* 
(c + d*x)]))/(2*d*(Csc[(c + d*x)/2]^2 - Sec[(c + d*x)/2]^2))
 

Rubi [A] (warning: unable to verify)

Time = 0.57 (sec) , antiderivative size = 129, normalized size of antiderivative = 1.29, number of steps used = 13, number of rules used = 12, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.414, Rules used = {3042, 3390, 3042, 3100, 244, 2009, 3680, 354, 87, 61, 73, 219}

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 ^3(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)^3 \cos (c+d x)^2}dx\)

\(\Big \downarrow \) 3390

\(\displaystyle \int \csc ^3(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 ^2(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)^3}dx+2 a b \int \csc (c+d x)^2 \sec (c+d x)^2dx\)

\(\Big \downarrow \) 3100

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

\(\Big \downarrow \) 244

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

\(\Big \downarrow \) 2009

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

\(\Big \downarrow \) 3680

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

\(\Big \downarrow \) 354

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

\(\Big \downarrow \) 87

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

\(\Big \downarrow \) 61

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

\(\Big \downarrow \) 73

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

\(\Big \downarrow \) 219

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

Input:

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

Output:

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

Defintions of rubi rules used

rule 61
Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[ 
(a + b*x)^(m + 1)*((c + d*x)^(n + 1)/((b*c - a*d)*(m + 1))), x] - Simp[d*(( 
m + n + 2)/((b*c - a*d)*(m + 1)))   Int[(a + b*x)^(m + 1)*(c + d*x)^n, x], 
x] /; FreeQ[{a, b, c, d, n}, x] && LtQ[m, -1] &&  !(LtQ[n, -1] && (EqQ[a, 0 
] || (NeQ[c, 0] && LtQ[m - n, 0] && IntegerQ[n]))) && IntLinearQ[a, b, c, d 
, m, n, x]
 

rule 73
Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> With[ 
{p = Denominator[m]}, Simp[p/b   Subst[Int[x^(p*(m + 1) - 1)*(c - a*(d/b) + 
 d*(x^p/b))^n, x], x, (a + b*x)^(1/p)], x]] /; FreeQ[{a, b, c, d}, x] && Lt 
Q[-1, m, 0] && LeQ[-1, n, 0] && LeQ[Denominator[n], Denominator[m]] && IntL 
inearQ[a, b, c, d, m, n, x]
 

rule 87
Int[((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p 
_.), x_] :> Simp[(-(b*e - a*f))*(c + d*x)^(n + 1)*((e + f*x)^(p + 1)/(f*(p 
+ 1)*(c*f - d*e))), x] - Simp[(a*d*f*(n + p + 2) - b*(d*e*(n + 1) + c*f*(p 
+ 1)))/(f*(p + 1)*(c*f - d*e))   Int[(c + d*x)^n*(e + f*x)^(p + 1), x], x] 
/; FreeQ[{a, b, c, d, e, f, n}, x] && LtQ[p, -1] && ( !LtQ[n, -1] || Intege 
rQ[p] ||  !(IntegerQ[n] ||  !(EqQ[e, 0] ||  !(EqQ[c, 0] || LtQ[p, n]))))
 

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 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 354
Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^2)^(p_.)*((c_) + (d_.)*(x_)^2)^(q_.), x_S 
ymbol] :> Simp[1/2   Subst[Int[x^((m - 1)/2)*(a + b*x)^p*(c + d*x)^q, x], x 
, x^2], x] /; FreeQ[{a, b, c, d, p, q}, x] && NeQ[b*c - a*d, 0] && IntegerQ 
[(m - 1)/2]
 

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 3100
Int[csc[(e_.) + (f_.)*(x_)]^(m_.)*sec[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] 
:> Simp[1/f   Subst[Int[(1 + x^2)^((m + n)/2 - 1)/x^m, x], x, Tan[e + f*x]] 
, x] /; FreeQ[{e, f}, x] && IntegersQ[m, n, (m + n)/2]
 

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 3680
Int[cos[(e_.) + (f_.)*(x_)]^(m_)*((d_.)*sin[(e_.) + (f_.)*(x_)])^(n_.)*((a_ 
) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(p_.), x_Symbol] :> With[{ff = FreeFac 
tors[Sin[e + f*x], x]}, Simp[ff*(Sqrt[Cos[e + f*x]^2]/(f*Cos[e + f*x]))   S 
ubst[Int[(d*ff*x)^n*(1 - ff^2*x^2)^((m - 1)/2)*(a + b*ff^2*x^2)^p, x], x, S 
in[e + f*x]/ff], x]] /; FreeQ[{a, b, d, e, f, n, p}, x] && IntegerQ[m/2]
 
Maple [A] (verified)

Time = 1.38 (sec) , antiderivative size = 116, normalized size of antiderivative = 1.16

method result size
derivativedivides \(\frac {a^{2} \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 )+2 a b \left (\frac {1}{\sin \left (d x +c \right ) \cos \left (d x +c \right )}-2 \cot \left (d x +c \right )\right )+b^{2} \left (\frac {1}{\cos \left (d x +c \right )}+\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )\right )}{d}\) \(116\)
default \(\frac {a^{2} \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 )+2 a b \left (\frac {1}{\sin \left (d x +c \right ) \cos \left (d x +c \right )}-2 \cot \left (d x +c \right )\right )+b^{2} \left (\frac {1}{\cos \left (d x +c \right )}+\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )\right )}{d}\) \(116\)
parallelrisch \(\frac {\left (\left (12 a^{2}+8 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-12 a^{2}-8 b^{2}\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 )^{4}+8 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} a b +\cot \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} a^{2}+8 \cot \left (\frac {d x}{2}+\frac {c}{2}\right ) a b -48 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) a b -18 a^{2}-16 b^{2}}{8 d \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-8 d}\) \(149\)
risch \(\frac {3 a^{2} {\mathrm e}^{5 i \left (d x +c \right )}+2 b^{2} {\mathrm e}^{5 i \left (d x +c \right )}-2 a^{2} {\mathrm e}^{3 i \left (d x +c \right )}-4 b^{2} {\mathrm e}^{3 i \left (d x +c \right )}+3 a^{2} {\mathrm e}^{i \left (d x +c \right )}+2 b^{2} {\mathrm e}^{i \left (d x +c \right )}-8 i a b \,{\mathrm e}^{2 i \left (d x +c \right )}+8 i a b}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{2} \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}-\frac {3 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{2 d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right ) b^{2}}{d}+\frac {3 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{2 d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right ) b^{2}}{d}\) \(215\)
norman \(\frac {\frac {a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{9}}{d}+\frac {a^{2}}{8 d}+\frac {a^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{10}}{8 d}-\frac {\left (7 a^{2}+8 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{4 d}-\frac {\left (19 a^{2}+16 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}}{8 d}-\frac {\left (33 a^{2}+32 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}}{8 d}-\frac {4 a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{d}-\frac {10 a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{d}-\frac {4 a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{7}}{d}}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} \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 {\left (3 a^{2}+2 b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d}\) \(265\)

Input:

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

Output:

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

Fricas [A] (verification not implemented)

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

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

Output:

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

Sympy [F(-1)]

Timed out. \[ \int \csc ^3(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)**3*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.23 \[ \int \csc ^3(c+d x) \sec ^2(c+d x) (a+b \sin (c+d x))^2 \, dx=\frac {a^{2} {\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 )} + 2 \, b^{2} {\left (\frac {2}{\cos \left (d x + c\right )} - \log \left (\cos \left (d x + c\right ) + 1\right ) + \log \left (\cos \left (d x + c\right ) - 1\right )\right )} - 8 \, a b {\left (\frac {1}{\tan \left (d x + c\right )} - \tan \left (d x + c\right )\right )}}{4 \, d} \] Input:

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

Output:

1/4*(a^2*(2*(3*cos(d*x + c)^2 - 2)/(cos(d*x + c)^3 - cos(d*x + c)) - 3*log 
(cos(d*x + c) + 1) + 3*log(cos(d*x + c) - 1)) + 2*b^2*(2/cos(d*x + c) - lo 
g(cos(d*x + c) + 1) + log(cos(d*x + c) - 1)) - 8*a*b*(1/tan(d*x + c) - tan 
(d*x + c)))/d
 

Giac [A] (verification not implemented)

Time = 0.29 (sec) , antiderivative size = 157, normalized size of antiderivative = 1.57 \[ \int \csc ^3(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 )^{2} + 8 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 4 \, {\left (3 \, a^{2} + 2 \, b^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right ) - \frac {16 \, {\left (2 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + a^{2} + b^{2}\right )}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1} - \frac {18 \, 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} + 8 \, 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 )^{2}}}{8 \, d} \] Input:

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

Output:

1/8*(a^2*tan(1/2*d*x + 1/2*c)^2 + 8*a*b*tan(1/2*d*x + 1/2*c) + 4*(3*a^2 + 
2*b^2)*log(abs(tan(1/2*d*x + 1/2*c))) - 16*(2*a*b*tan(1/2*d*x + 1/2*c) + a 
^2 + b^2)/(tan(1/2*d*x + 1/2*c)^2 - 1) - (18*a^2*tan(1/2*d*x + 1/2*c)^2 + 
12*b^2*tan(1/2*d*x + 1/2*c)^2 + 8*a*b*tan(1/2*d*x + 1/2*c) + a^2)/tan(1/2* 
d*x + 1/2*c)^2)/d
 

Mupad [B] (verification not implemented)

Time = 19.40 (sec) , antiderivative size = 148, normalized size of antiderivative = 1.48 \[ \int \csc ^3(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 )}^2}{8\,d}+\frac {\ln \left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,\left (\frac {3\,a^2}{2}+b^2\right )}{d}+\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\left (\frac {17\,a^2}{2}+8\,b^2\right )-\frac {a^2}{2}+20\,a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3-4\,a\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left (4\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-4\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4\right )}+\frac {a\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d} \] Input:

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

Output:

(a^2*tan(c/2 + (d*x)/2)^2)/(8*d) + (log(tan(c/2 + (d*x)/2))*((3*a^2)/2 + b 
^2))/d + (tan(c/2 + (d*x)/2)^2*((17*a^2)/2 + 8*b^2) - a^2/2 + 20*a*b*tan(c 
/2 + (d*x)/2)^3 - 4*a*b*tan(c/2 + (d*x)/2))/(d*(4*tan(c/2 + (d*x)/2)^2 - 4 
*tan(c/2 + (d*x)/2)^4)) + (a*b*tan(c/2 + (d*x)/2))/d
 

Reduce [B] (verification not implemented)

Time = 0.20 (sec) , antiderivative size = 171, normalized size of antiderivative = 1.71 \[ \int \csc ^3(c+d x) \sec ^2(c+d x) (a+b \sin (c+d x))^2 \, dx=\frac {12 \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 )^{2} a^{2}+8 \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 )^{2} b^{2}-9 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{2} a^{2}-8 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{2} b^{2}+32 \sin \left (d x +c \right )^{3} a b +12 \sin \left (d x +c \right )^{2} a^{2}+8 \sin \left (d x +c \right )^{2} b^{2}-16 \sin \left (d x +c \right ) a b -4 a^{2}}{8 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{2} d} \] Input:

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

Output:

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