\(\int \csc ^2(c+d x) (a-a \csc (c+d x)) (A-A \csc (c+d x)) \, dx\) [20]

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [A] (verified)
Fricas [B] (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 = 31, antiderivative size = 70 \[ \int \csc ^2(c+d x) (a-a \csc (c+d x)) (A-A \csc (c+d x)) \, dx=\frac {a A \text {arctanh}(\cos (c+d x))}{d}-\frac {5 a A \cot (c+d x)}{3 d}+\frac {a A \cot (c+d x) \csc (c+d x)}{d}-\frac {a A \cot (c+d x) \csc ^2(c+d x)}{3 d} \] Output:

a*A*arctanh(cos(d*x+c))/d-5/3*a*A*cot(d*x+c)/d+a*A*cot(d*x+c)*csc(d*x+c)/d 
-1/3*a*A*cot(d*x+c)*csc(d*x+c)^2/d
 

Mathematica [A] (verified)

Time = 0.06 (sec) , antiderivative size = 116, normalized size of antiderivative = 1.66 \[ \int \csc ^2(c+d x) (a-a \csc (c+d x)) (A-A \csc (c+d x)) \, dx=-\frac {5 a A \cot (c+d x)}{3 d}+\frac {a A \csc ^2\left (\frac {1}{2} (c+d x)\right )}{4 d}-\frac {a A \cot (c+d x) \csc ^2(c+d x)}{3 d}+\frac {a A \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )}{d}-\frac {a A \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )}{d}-\frac {a A \sec ^2\left (\frac {1}{2} (c+d x)\right )}{4 d} \] Input:

Integrate[Csc[c + d*x]^2*(a - a*Csc[c + d*x])*(A - A*Csc[c + d*x]),x]
 

Output:

(-5*a*A*Cot[c + d*x])/(3*d) + (a*A*Csc[(c + d*x)/2]^2)/(4*d) - (a*A*Cot[c 
+ d*x]*Csc[c + d*x]^2)/(3*d) + (a*A*Log[Cos[(c + d*x)/2]])/d - (a*A*Log[Si 
n[(c + d*x)/2]])/d - (a*A*Sec[(c + d*x)/2]^2)/(4*d)
 

Rubi [A] (verified)

Time = 0.56 (sec) , antiderivative size = 85, normalized size of antiderivative = 1.21, number of steps used = 12, number of rules used = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.355, Rules used = {2011, 3042, 4275, 3042, 4255, 3042, 4257, 4534, 3042, 4254, 24}

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 ^2(c+d x) (a-a \csc (c+d x)) (A-A \csc (c+d x)) \, dx\)

\(\Big \downarrow \) 2011

\(\displaystyle \frac {A \int \csc ^2(c+d x) (a-a \csc (c+d x))^2dx}{a}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {A \int \csc (c+d x)^2 (a-a \csc (c+d x))^2dx}{a}\)

\(\Big \downarrow \) 4275

\(\displaystyle \frac {A \left (\int \csc ^2(c+d x) \left (\csc ^2(c+d x) a^2+a^2\right )dx-2 a^2 \int \csc ^3(c+d x)dx\right )}{a}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {A \left (\int \csc (c+d x)^2 \left (\csc (c+d x)^2 a^2+a^2\right )dx-2 a^2 \int \csc (c+d x)^3dx\right )}{a}\)

\(\Big \downarrow \) 4255

\(\displaystyle \frac {A \left (\int \csc (c+d x)^2 \left (\csc (c+d x)^2 a^2+a^2\right )dx-2 a^2 \left (\frac {1}{2} \int \csc (c+d x)dx-\frac {\cot (c+d x) \csc (c+d x)}{2 d}\right )\right )}{a}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {A \left (\int \csc (c+d x)^2 \left (\csc (c+d x)^2 a^2+a^2\right )dx-2 a^2 \left (\frac {1}{2} \int \csc (c+d x)dx-\frac {\cot (c+d x) \csc (c+d x)}{2 d}\right )\right )}{a}\)

\(\Big \downarrow \) 4257

\(\displaystyle \frac {A \left (\int \csc (c+d x)^2 \left (\csc (c+d x)^2 a^2+a^2\right )dx-2 a^2 \left (-\frac {\text {arctanh}(\cos (c+d x))}{2 d}-\frac {\cot (c+d x) \csc (c+d x)}{2 d}\right )\right )}{a}\)

\(\Big \downarrow \) 4534

\(\displaystyle \frac {A \left (\frac {5}{3} a^2 \int \csc ^2(c+d x)dx-2 a^2 \left (-\frac {\text {arctanh}(\cos (c+d x))}{2 d}-\frac {\cot (c+d x) \csc (c+d x)}{2 d}\right )-\frac {a^2 \cot (c+d x) \csc ^2(c+d x)}{3 d}\right )}{a}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {A \left (\frac {5}{3} a^2 \int \csc (c+d x)^2dx-2 a^2 \left (-\frac {\text {arctanh}(\cos (c+d x))}{2 d}-\frac {\cot (c+d x) \csc (c+d x)}{2 d}\right )-\frac {a^2 \cot (c+d x) \csc ^2(c+d x)}{3 d}\right )}{a}\)

\(\Big \downarrow \) 4254

\(\displaystyle \frac {A \left (-\frac {5 a^2 \int 1d\cot (c+d x)}{3 d}-2 a^2 \left (-\frac {\text {arctanh}(\cos (c+d x))}{2 d}-\frac {\cot (c+d x) \csc (c+d x)}{2 d}\right )-\frac {a^2 \cot (c+d x) \csc ^2(c+d x)}{3 d}\right )}{a}\)

\(\Big \downarrow \) 24

\(\displaystyle \frac {A \left (-2 a^2 \left (-\frac {\text {arctanh}(\cos (c+d x))}{2 d}-\frac {\cot (c+d x) \csc (c+d x)}{2 d}\right )-\frac {5 a^2 \cot (c+d x)}{3 d}-\frac {a^2 \cot (c+d x) \csc ^2(c+d x)}{3 d}\right )}{a}\)

Input:

Int[Csc[c + d*x]^2*(a - a*Csc[c + d*x])*(A - A*Csc[c + d*x]),x]
 

Output:

(A*((-5*a^2*Cot[c + d*x])/(3*d) - (a^2*Cot[c + d*x]*Csc[c + d*x]^2)/(3*d) 
- 2*a^2*(-1/2*ArcTanh[Cos[c + d*x]]/d - (Cot[c + d*x]*Csc[c + d*x])/(2*d)) 
))/a
 

Defintions of rubi rules used

rule 24
Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]
 

rule 2011
Int[(u_.)*((a_) + (b_.)*(v_))^(m_.)*((c_) + (d_.)*(v_))^(n_.), x_Symbol] :> 
 Simp[(b/d)^m   Int[u*(c + d*v)^(m + n), x], x] /; FreeQ[{a, b, c, d, n}, x 
] && EqQ[b*c - a*d, 0] && IntegerQ[m] && ( !IntegerQ[n] || SimplerQ[c + d*x 
, a + b*x])
 

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

rule 4254
Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Simp[-d^(-1)   Subst[Int[Exp 
andIntegrand[(1 + x^2)^(n/2 - 1), x], x], x, Cot[c + d*x]], x] /; FreeQ[{c, 
 d}, x] && IGtQ[n/2, 0]
 

rule 4255
Int[(csc[(c_.) + (d_.)*(x_)]*(b_.))^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d* 
x]*((b*Csc[c + d*x])^(n - 1)/(d*(n - 1))), x] + Simp[b^2*((n - 2)/(n - 1)) 
  Int[(b*Csc[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] 
&& IntegerQ[2*n]
 

rule 4257
Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] 
 /; FreeQ[{c, d}, x]
 

rule 4275
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + 
(a_))^2, x_Symbol] :> Simp[2*a*(b/d)   Int[(d*Csc[e + f*x])^(n + 1), x], x] 
 + Int[(d*Csc[e + f*x])^n*(a^2 + b^2*Csc[e + f*x]^2), x] /; FreeQ[{a, b, d, 
 e, f, n}, x]
 

rule 4534
Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*(csc[(e_.) + (f_.)*(x_)]^2*(C_.) 
+ (A_)), x_Symbol] :> Simp[(-C)*Cot[e + f*x]*((b*Csc[e + f*x])^m/(f*(m + 1) 
)), x] + Simp[(C*m + A*(m + 1))/(m + 1)   Int[(b*Csc[e + f*x])^m, x], x] /; 
 FreeQ[{b, e, f, A, C, m}, x] && NeQ[C*m + A*(m + 1), 0] &&  !LeQ[m, -1]
 
Maple [A] (verified)

Time = 0.21 (sec) , antiderivative size = 74, normalized size of antiderivative = 1.06

method result size
derivativedivides \(\frac {-A a \cot \left (d x +c \right )-2 A a \left (-\frac {\csc \left (d x +c \right ) \cot \left (d x +c \right )}{2}+\frac {\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )+A a \left (-\frac {2}{3}-\frac {\csc \left (d x +c \right )^{2}}{3}\right ) \cot \left (d x +c \right )}{d}\) \(74\)
default \(\frac {-A a \cot \left (d x +c \right )-2 A a \left (-\frac {\csc \left (d x +c \right ) \cot \left (d x +c \right )}{2}+\frac {\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )+A a \left (-\frac {2}{3}-\frac {\csc \left (d x +c \right )^{2}}{3}\right ) \cot \left (d x +c \right )}{d}\) \(74\)
parts \(-\frac {a A \cot \left (d x +c \right )}{d}+\frac {A a \left (-\frac {2}{3}-\frac {\csc \left (d x +c \right )^{2}}{3}\right ) \cot \left (d x +c \right )}{d}+\frac {a A \cot \left (d x +c \right ) \csc \left (d x +c \right )}{d}-\frac {A a \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{d}\) \(80\)
parallelrisch \(\frac {A a \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}-\cot \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}-6 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+6 \cot \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+21 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-24 \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )-21 \cot \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{24 d}\) \(93\)
risch \(-\frac {2 A a \left (3 i {\mathrm e}^{4 i \left (d x +c \right )}+3 \,{\mathrm e}^{5 i \left (d x +c \right )}-12 i {\mathrm e}^{2 i \left (d x +c \right )}+5 i-3 \,{\mathrm e}^{i \left (d x +c \right )}\right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{3}}-\frac {A a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{d}+\frac {A a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{d}\) \(108\)
norman \(\frac {-\frac {A a}{24 d}+\frac {A a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{4 d}-\frac {7 A a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{8 d}+\frac {7 A a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}}{8 d}-\frac {A a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{4 d}+\frac {A a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}}{24 d}}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}-\frac {A a \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}\) \(127\)

Input:

int(csc(d*x+c)^2*(a-a*csc(d*x+c))*(A-A*csc(d*x+c)),x,method=_RETURNVERBOSE 
)
 

Output:

1/d*(-A*a*cot(d*x+c)-2*A*a*(-1/2*csc(d*x+c)*cot(d*x+c)+1/2*ln(csc(d*x+c)-c 
ot(d*x+c)))+A*a*(-2/3-1/3*csc(d*x+c)^2)*cot(d*x+c))
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 135 vs. \(2 (66) = 132\).

Time = 0.08 (sec) , antiderivative size = 135, normalized size of antiderivative = 1.93 \[ \int \csc ^2(c+d x) (a-a \csc (c+d x)) (A-A \csc (c+d x)) \, dx=-\frac {10 \, A a \cos \left (d x + c\right )^{3} + 6 \, A a \cos \left (d x + c\right ) \sin \left (d x + c\right ) - 12 \, A a \cos \left (d x + c\right ) - 3 \, {\left (A a \cos \left (d x + c\right )^{2} - A a\right )} \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) + 3 \, {\left (A a \cos \left (d x + c\right )^{2} - A a\right )} \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right )}{6 \, {\left (d \cos \left (d x + c\right )^{2} - d\right )} \sin \left (d x + c\right )} \] Input:

integrate(csc(d*x+c)^2*(a-a*csc(d*x+c))*(A-A*csc(d*x+c)),x, algorithm="fri 
cas")
 

Output:

-1/6*(10*A*a*cos(d*x + c)^3 + 6*A*a*cos(d*x + c)*sin(d*x + c) - 12*A*a*cos 
(d*x + c) - 3*(A*a*cos(d*x + c)^2 - A*a)*log(1/2*cos(d*x + c) + 1/2)*sin(d 
*x + c) + 3*(A*a*cos(d*x + c)^2 - A*a)*log(-1/2*cos(d*x + c) + 1/2)*sin(d* 
x + c))/((d*cos(d*x + c)^2 - d)*sin(d*x + c))
 

Sympy [F]

\[ \int \csc ^2(c+d x) (a-a \csc (c+d x)) (A-A \csc (c+d x)) \, dx=A a \left (\int \csc ^{2}{\left (c + d x \right )}\, dx + \int \left (- 2 \csc ^{3}{\left (c + d x \right )}\right )\, dx + \int \csc ^{4}{\left (c + d x \right )}\, dx\right ) \] Input:

integrate(csc(d*x+c)**2*(a-a*csc(d*x+c))*(A-A*csc(d*x+c)),x)
 

Output:

A*a*(Integral(csc(c + d*x)**2, x) + Integral(-2*csc(c + d*x)**3, x) + Inte 
gral(csc(c + d*x)**4, x))
 

Maxima [A] (verification not implemented)

Time = 0.03 (sec) , antiderivative size = 87, normalized size of antiderivative = 1.24 \[ \int \csc ^2(c+d x) (a-a \csc (c+d x)) (A-A \csc (c+d x)) \, dx=-\frac {3 \, A a {\left (\frac {2 \, \cos \left (d x + c\right )}{\cos \left (d x + c\right )^{2} - 1} - \log \left (\cos \left (d x + c\right ) + 1\right ) + \log \left (\cos \left (d x + c\right ) - 1\right )\right )} + \frac {6 \, A a}{\tan \left (d x + c\right )} + \frac {2 \, {\left (3 \, \tan \left (d x + c\right )^{2} + 1\right )} A a}{\tan \left (d x + c\right )^{3}}}{6 \, d} \] Input:

integrate(csc(d*x+c)^2*(a-a*csc(d*x+c))*(A-A*csc(d*x+c)),x, algorithm="max 
ima")
 

Output:

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

Giac [A] (verification not implemented)

Time = 0.17 (sec) , antiderivative size = 123, normalized size of antiderivative = 1.76 \[ \int \csc ^2(c+d x) (a-a \csc (c+d x)) (A-A \csc (c+d x)) \, dx=\frac {A a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 6 \, A a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 24 \, A a \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right ) + 21 \, A a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + \frac {44 \, A a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 21 \, A a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 6 \, A a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - A a}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3}}}{24 \, d} \] Input:

integrate(csc(d*x+c)^2*(a-a*csc(d*x+c))*(A-A*csc(d*x+c)),x, algorithm="gia 
c")
 

Output:

1/24*(A*a*tan(1/2*d*x + 1/2*c)^3 - 6*A*a*tan(1/2*d*x + 1/2*c)^2 - 24*A*a*l 
og(abs(tan(1/2*d*x + 1/2*c))) + 21*A*a*tan(1/2*d*x + 1/2*c) + (44*A*a*tan( 
1/2*d*x + 1/2*c)^3 - 21*A*a*tan(1/2*d*x + 1/2*c)^2 + 6*A*a*tan(1/2*d*x + 1 
/2*c) - A*a)/tan(1/2*d*x + 1/2*c)^3)/d
 

Mupad [B] (verification not implemented)

Time = 15.50 (sec) , antiderivative size = 119, normalized size of antiderivative = 1.70 \[ \int \csc ^2(c+d x) (a-a \csc (c+d x)) (A-A \csc (c+d x)) \, dx=\frac {7\,A\,a\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{8\,d}-\frac {A\,a\,\ln \left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d}-\frac {{\mathrm {cot}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,\left (7\,A\,a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-2\,A\,a\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )+\frac {A\,a}{3}\right )}{8\,d}-\frac {A\,a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}{4\,d}+\frac {A\,a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3}{24\,d} \] Input:

int(((A - A/sin(c + d*x))*(a - a/sin(c + d*x)))/sin(c + d*x)^2,x)
 

Output:

(7*A*a*tan(c/2 + (d*x)/2))/(8*d) - (A*a*log(tan(c/2 + (d*x)/2)))/d - (cot( 
c/2 + (d*x)/2)^3*((A*a)/3 + 7*A*a*tan(c/2 + (d*x)/2)^2 - 2*A*a*tan(c/2 + ( 
d*x)/2)))/(8*d) - (A*a*tan(c/2 + (d*x)/2)^2)/(4*d) + (A*a*tan(c/2 + (d*x)/ 
2)^3)/(24*d)
 

Reduce [B] (verification not implemented)

Time = 0.19 (sec) , antiderivative size = 75, normalized size of antiderivative = 1.07 \[ \int \csc ^2(c+d x) (a-a \csc (c+d x)) (A-A \csc (c+d x)) \, dx=\frac {a^{2} \left (-5 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{2}+3 \cos \left (d x +c \right ) \sin \left (d x +c \right )-\cos \left (d x +c \right )-3 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \sin \left (d x +c \right )^{3}\right )}{3 \sin \left (d x +c \right )^{3} d} \] Input:

int(csc(d*x+c)^2*(a-a*csc(d*x+c))*(A-A*csc(d*x+c)),x)
 

Output:

(a**2*( - 5*cos(c + d*x)*sin(c + d*x)**2 + 3*cos(c + d*x)*sin(c + d*x) - c 
os(c + d*x) - 3*log(tan((c + d*x)/2))*sin(c + d*x)**3))/(3*sin(c + d*x)**3 
*d)