\(\int \cos ^2(a+b x) \csc (c-b x) \, dx\) [399]

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

Optimal result

Integrand size = 16, antiderivative size = 33 \[ \int \cos ^2(a+b x) \csc (c-b x) \, dx=\frac {\text {arctanh}(\cos (c-b x)) \cos ^2(a+c)}{b}-\frac {\cos (2 a+c+b x)}{b} \] Output:

arctanh(cos(b*x-c))*cos(a+c)^2/b-cos(b*x+2*a+c)/b
 

Mathematica [A] (verified)

Time = 0.11 (sec) , antiderivative size = 52, normalized size of antiderivative = 1.58 \[ \int \cos ^2(a+b x) \csc (c-b x) \, dx=\frac {-\cos (2 a+c+b x)+\cos ^2(a+c) \left (\log \left (\cos \left (\frac {1}{2} (c-b x)\right )\right )-\log \left (-\sin \left (\frac {1}{2} (c-b x)\right )\right )\right )}{b} \] Input:

Integrate[Cos[a + b*x]^2*Csc[c - b*x],x]
 

Output:

(-Cos[2*a + c + b*x] + Cos[a + c]^2*(Log[Cos[(c - b*x)/2]] - Log[-Sin[(c - 
 b*x)/2]]))/b
 

Rubi [F]

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

\(\Big \downarrow \) 7299

\(\displaystyle \int \cos ^2(a+b x) \csc (c-b x)dx\)

Input:

Int[Cos[a + b*x]^2*Csc[c - b*x],x]
 

Output:

$Aborted
 

Defintions of rubi rules used

rule 7299
Int[u_, x_] :> CannotIntegrate[u, x]
 
Maple [C] (verified)

Result contains complex when optimal does not.

Time = 0.93 (sec) , antiderivative size = 128, normalized size of antiderivative = 3.88

method result size
risch \(-\frac {\ln \left (-{\mathrm e}^{i \left (a +c \right )}+{\mathrm e}^{i \left (b x +a \right )}\right )}{2 b}-\frac {\ln \left (-{\mathrm e}^{i \left (a +c \right )}+{\mathrm e}^{i \left (b x +a \right )}\right ) \cos \left (2 a +2 c \right )}{2 b}+\frac {\ln \left ({\mathrm e}^{i \left (a +c \right )}+{\mathrm e}^{i \left (b x +a \right )}\right )}{2 b}+\frac {\ln \left ({\mathrm e}^{i \left (a +c \right )}+{\mathrm e}^{i \left (b x +a \right )}\right ) \cos \left (2 a +2 c \right )}{2 b}-\frac {\cos \left (b x +2 a +c \right )}{b}\) \(128\)
default \(-\frac {-\frac {2 \left (\left (\sin \left (a \right ) \cos \left (c \right )+\cos \left (a \right ) \sin \left (c \right )\right ) \tan \left (\frac {a}{2}+\frac {b x}{2}\right )+\sin \left (a \right ) \sin \left (c \right )-\cos \left (a \right ) \cos \left (c \right )\right )}{\left (\cos \left (a \right )^{2} \cos \left (c \right )^{2}+\sin \left (c \right )^{2} \cos \left (a \right )^{2}+\cos \left (c \right )^{2} \sin \left (a \right )^{2}+\sin \left (a \right )^{2} \sin \left (c \right )^{2}\right ) \left (1+\tan \left (\frac {a}{2}+\frac {b x}{2}\right )^{2}\right )}+\frac {2 \left (\sin \left (a \right )^{2} \sin \left (c \right )^{2}-2 \cos \left (a \right ) \cos \left (c \right ) \sin \left (a \right ) \sin \left (c \right )+\cos \left (a \right )^{2} \cos \left (c \right )^{2}\right ) \arctan \left (\frac {2 \left (\sin \left (a \right ) \cos \left (c \right )+\cos \left (a \right ) \sin \left (c \right )\right ) \tan \left (\frac {a}{2}+\frac {b x}{2}\right )-2 \sin \left (a \right ) \sin \left (c \right )+2 \cos \left (a \right ) \cos \left (c \right )}{2 \sqrt {-\cos \left (c \right )^{2} \sin \left (a \right )^{2}-\cos \left (a \right )^{2} \cos \left (c \right )^{2}-\sin \left (a \right )^{2} \sin \left (c \right )^{2}-\sin \left (c \right )^{2} \cos \left (a \right )^{2}}}\right )}{\left (\cos \left (a \right )^{2} \cos \left (c \right )^{2}+\sin \left (c \right )^{2} \cos \left (a \right )^{2}+\cos \left (c \right )^{2} \sin \left (a \right )^{2}+\sin \left (a \right )^{2} \sin \left (c \right )^{2}\right ) \sqrt {-\cos \left (c \right )^{2} \sin \left (a \right )^{2}-\cos \left (a \right )^{2} \cos \left (c \right )^{2}-\sin \left (a \right )^{2} \sin \left (c \right )^{2}-\sin \left (c \right )^{2} \cos \left (a \right )^{2}}}}{b}\) \(290\)

Input:

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

Output:

-1/2/b*ln(-exp(I*(a+c))+exp(I*(b*x+a)))-1/2/b*ln(-exp(I*(a+c))+exp(I*(b*x+ 
a)))*cos(2*a+2*c)+1/2/b*ln(exp(I*(a+c))+exp(I*(b*x+a)))+1/2/b*ln(exp(I*(a+ 
c))+exp(I*(b*x+a)))*cos(2*a+2*c)-cos(b*x+2*a+c)/b
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 114 vs. \(2 (34) = 68\).

Time = 0.08 (sec) , antiderivative size = 114, normalized size of antiderivative = 3.45 \[ \int \cos ^2(a+b x) \csc (c-b x) \, dx=\frac {\cos \left (a + c\right )^{2} \log \left (\frac {\cos \left (b x + a\right ) \cos \left (a + c\right ) + \sin \left (b x + a\right ) \sin \left (a + c\right ) + 1}{\cos \left (a + c\right ) + 1}\right ) - \cos \left (a + c\right )^{2} \log \left (-\frac {\cos \left (b x + a\right ) \cos \left (a + c\right ) + \sin \left (b x + a\right ) \sin \left (a + c\right ) - 1}{\cos \left (a + c\right ) + 1}\right ) - 2 \, \cos \left (b x + a\right ) \cos \left (a + c\right ) + 2 \, \sin \left (b x + a\right ) \sin \left (a + c\right )}{2 \, b} \] Input:

integrate(-cos(b*x+a)^2*csc(b*x-c),x, algorithm="fricas")
 

Output:

1/2*(cos(a + c)^2*log((cos(b*x + a)*cos(a + c) + sin(b*x + a)*sin(a + c) + 
 1)/(cos(a + c) + 1)) - cos(a + c)^2*log(-(cos(b*x + a)*cos(a + c) + sin(b 
*x + a)*sin(a + c) - 1)/(cos(a + c) + 1)) - 2*cos(b*x + a)*cos(a + c) + 2* 
sin(b*x + a)*sin(a + c))/b
 

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 1460 vs. \(2 (27) = 54\).

Time = 10.58 (sec) , antiderivative size = 3216, normalized size of antiderivative = 97.45 \[ \int \cos ^2(a+b x) \csc (c-b x) \, dx=\text {Too large to display} \] Input:

integrate(-cos(b*x+a)**2*csc(b*x-c),x)
 

Output:

-2*Piecewise((0, Eq(b, 0) & Eq(c, 0)), (-sin(b*x)/b, Eq(c, 0)), (0, Eq(b, 
0)), (2*log(-tan(c/2) + tan(b*x/2))*tan(c/2)**3*tan(b*x/2)**2/(b*tan(c/2)* 
*4*tan(b*x/2)**2 + b*tan(c/2)**4 + 2*b*tan(c/2)**2*tan(b*x/2)**2 + 2*b*tan 
(c/2)**2 + b*tan(b*x/2)**2 + b) + 2*log(-tan(c/2) + tan(b*x/2))*tan(c/2)** 
3/(b*tan(c/2)**4*tan(b*x/2)**2 + b*tan(c/2)**4 + 2*b*tan(c/2)**2*tan(b*x/2 
)**2 + 2*b*tan(c/2)**2 + b*tan(b*x/2)**2 + b) - 2*log(-tan(c/2) + tan(b*x/ 
2))*tan(c/2)*tan(b*x/2)**2/(b*tan(c/2)**4*tan(b*x/2)**2 + b*tan(c/2)**4 + 
2*b*tan(c/2)**2*tan(b*x/2)**2 + 2*b*tan(c/2)**2 + b*tan(b*x/2)**2 + b) - 2 
*log(-tan(c/2) + tan(b*x/2))*tan(c/2)/(b*tan(c/2)**4*tan(b*x/2)**2 + b*tan 
(c/2)**4 + 2*b*tan(c/2)**2*tan(b*x/2)**2 + 2*b*tan(c/2)**2 + b*tan(b*x/2)* 
*2 + b) - 2*log(tan(b*x/2) + 1/tan(c/2))*tan(c/2)**3*tan(b*x/2)**2/(b*tan( 
c/2)**4*tan(b*x/2)**2 + b*tan(c/2)**4 + 2*b*tan(c/2)**2*tan(b*x/2)**2 + 2* 
b*tan(c/2)**2 + b*tan(b*x/2)**2 + b) - 2*log(tan(b*x/2) + 1/tan(c/2))*tan( 
c/2)**3/(b*tan(c/2)**4*tan(b*x/2)**2 + b*tan(c/2)**4 + 2*b*tan(c/2)**2*tan 
(b*x/2)**2 + 2*b*tan(c/2)**2 + b*tan(b*x/2)**2 + b) + 2*log(tan(b*x/2) + 1 
/tan(c/2))*tan(c/2)*tan(b*x/2)**2/(b*tan(c/2)**4*tan(b*x/2)**2 + b*tan(c/2 
)**4 + 2*b*tan(c/2)**2*tan(b*x/2)**2 + 2*b*tan(c/2)**2 + b*tan(b*x/2)**2 + 
 b) + 2*log(tan(b*x/2) + 1/tan(c/2))*tan(c/2)/(b*tan(c/2)**4*tan(b*x/2)**2 
 + b*tan(c/2)**4 + 2*b*tan(c/2)**2*tan(b*x/2)**2 + 2*b*tan(c/2)**2 + b*tan 
(b*x/2)**2 + b) + 2*tan(c/2)**4*tan(b*x/2)/(b*tan(c/2)**4*tan(b*x/2)**2...
 

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 116 vs. \(2 (34) = 68\).

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

integrate(-cos(b*x+a)^2*csc(b*x-c),x, algorithm="maxima")
 

Output:

1/4*((cos(2*a + 2*c) + 1)*log(cos(b*x)^2 + 2*cos(b*x)*cos(c) + cos(c)^2 + 
sin(b*x)^2 + 2*sin(b*x)*sin(c) + sin(c)^2) - (cos(2*a + 2*c) + 1)*log(cos( 
b*x)^2 - 2*cos(b*x)*cos(c) + cos(c)^2 + sin(b*x)^2 - 2*sin(b*x)*sin(c) + s 
in(c)^2) - 4*cos(b*x + 2*a + c))/b
 

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 1043 vs. \(2 (34) = 68\).

Time = 0.21 (sec) , antiderivative size = 1043, normalized size of antiderivative = 31.61 \[ \int \cos ^2(a+b x) \csc (c-b x) \, dx=\text {Too large to display} \] Input:

integrate(-cos(b*x+a)^2*csc(b*x-c),x, algorithm="giac")
 

Output:

-((tan(1/2*a)^5*tan(1/2*c)^5 - 2*tan(1/2*a)^5*tan(1/2*c)^3 - 9*tan(1/2*a)^ 
4*tan(1/2*c)^4 - 2*tan(1/2*a)^3*tan(1/2*c)^5 + tan(1/2*a)^5*tan(1/2*c) + 1 
0*tan(1/2*a)^4*tan(1/2*c)^2 + 28*tan(1/2*a)^3*tan(1/2*c)^3 + 10*tan(1/2*a) 
^2*tan(1/2*c)^4 + tan(1/2*a)*tan(1/2*c)^5 - tan(1/2*a)^4 - 10*tan(1/2*a)^3 
*tan(1/2*c) - 28*tan(1/2*a)^2*tan(1/2*c)^2 - 10*tan(1/2*a)*tan(1/2*c)^3 - 
tan(1/2*c)^4 + 2*tan(1/2*a)^2 + 9*tan(1/2*a)*tan(1/2*c) + 2*tan(1/2*c)^2 - 
 1)*log(abs(tan(1/2*b*x + 1/2*a)*tan(1/2*a)*tan(1/2*c) - tan(1/2*b*x + 1/2 
*a) + tan(1/2*a) + tan(1/2*c)))/(tan(1/2*a)^5*tan(1/2*c)^5 + 2*tan(1/2*a)^ 
5*tan(1/2*c)^3 - tan(1/2*a)^4*tan(1/2*c)^4 + 2*tan(1/2*a)^3*tan(1/2*c)^5 + 
 tan(1/2*a)^5*tan(1/2*c) - 2*tan(1/2*a)^4*tan(1/2*c)^2 + 4*tan(1/2*a)^3*ta 
n(1/2*c)^3 - 2*tan(1/2*a)^2*tan(1/2*c)^4 + tan(1/2*a)*tan(1/2*c)^5 - tan(1 
/2*a)^4 + 2*tan(1/2*a)^3*tan(1/2*c) - 4*tan(1/2*a)^2*tan(1/2*c)^2 + 2*tan( 
1/2*a)*tan(1/2*c)^3 - tan(1/2*c)^4 - 2*tan(1/2*a)^2 + tan(1/2*a)*tan(1/2*c 
) - 2*tan(1/2*c)^2 - 1) - (tan(1/2*a)^5*tan(1/2*c)^4 + tan(1/2*a)^4*tan(1/ 
2*c)^5 - 2*tan(1/2*a)^5*tan(1/2*c)^2 - 10*tan(1/2*a)^4*tan(1/2*c)^3 - 10*t 
an(1/2*a)^3*tan(1/2*c)^4 - 2*tan(1/2*a)^2*tan(1/2*c)^5 + tan(1/2*a)^5 + 9* 
tan(1/2*a)^4*tan(1/2*c) + 28*tan(1/2*a)^3*tan(1/2*c)^2 + 28*tan(1/2*a)^2*t 
an(1/2*c)^3 + 9*tan(1/2*a)*tan(1/2*c)^4 + tan(1/2*c)^5 - 2*tan(1/2*a)^3 - 
10*tan(1/2*a)^2*tan(1/2*c) - 10*tan(1/2*a)*tan(1/2*c)^2 - 2*tan(1/2*c)^3 + 
 tan(1/2*a) + tan(1/2*c))*log(abs(tan(1/2*b*x + 1/2*a)*tan(1/2*a) + tan...
 

Mupad [B] (verification not implemented)

Time = 1.73 (sec) , antiderivative size = 223, normalized size of antiderivative = 6.76 \[ \int \cos ^2(a+b x) \csc (c-b x) \, dx=-\frac {{\mathrm {e}}^{-a\,2{}\mathrm {i}-c\,1{}\mathrm {i}-b\,x\,1{}\mathrm {i}}}{2\,b}-\frac {{\mathrm {e}}^{a\,2{}\mathrm {i}+c\,1{}\mathrm {i}+b\,x\,1{}\mathrm {i}}}{2\,b}-\frac {{\mathrm {e}}^{-a\,2{}\mathrm {i}-c\,2{}\mathrm {i}}\,\ln \left (-\frac {{\left ({\mathrm {e}}^{a\,2{}\mathrm {i}}\,{\mathrm {e}}^{c\,2{}\mathrm {i}}+1\right )}^2\,1{}\mathrm {i}}{2}+\frac {{\mathrm {e}}^{-c\,1{}\mathrm {i}}\,{\mathrm {e}}^{b\,x\,1{}\mathrm {i}}\,\left ({\mathrm {e}}^{a\,2{}\mathrm {i}}\,{\mathrm {e}}^{c\,2{}\mathrm {i}}\,2{}\mathrm {i}+{\mathrm {e}}^{a\,4{}\mathrm {i}}\,{\mathrm {e}}^{c\,4{}\mathrm {i}}\,1{}\mathrm {i}+1{}\mathrm {i}\right )}{2}\right )\,{\left ({\mathrm {e}}^{a\,2{}\mathrm {i}+c\,2{}\mathrm {i}}+1\right )}^2}{4\,b}+\frac {{\mathrm {e}}^{-a\,2{}\mathrm {i}-c\,2{}\mathrm {i}}\,\ln \left (\frac {{\left ({\mathrm {e}}^{a\,2{}\mathrm {i}}\,{\mathrm {e}}^{c\,2{}\mathrm {i}}+1\right )}^2\,1{}\mathrm {i}}{2}+\frac {{\mathrm {e}}^{-c\,1{}\mathrm {i}}\,{\mathrm {e}}^{b\,x\,1{}\mathrm {i}}\,\left ({\mathrm {e}}^{a\,2{}\mathrm {i}}\,{\mathrm {e}}^{c\,2{}\mathrm {i}}\,2{}\mathrm {i}+{\mathrm {e}}^{a\,4{}\mathrm {i}}\,{\mathrm {e}}^{c\,4{}\mathrm {i}}\,1{}\mathrm {i}+1{}\mathrm {i}\right )}{2}\right )\,{\left ({\mathrm {e}}^{a\,2{}\mathrm {i}+c\,2{}\mathrm {i}}+1\right )}^2}{4\,b} \] Input:

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

Output:

(exp(- a*2i - c*2i)*log(((exp(a*2i)*exp(c*2i) + 1)^2*1i)/2 + (exp(-c*1i)*e 
xp(b*x*1i)*(exp(a*2i)*exp(c*2i)*2i + exp(a*4i)*exp(c*4i)*1i + 1i))/2)*(exp 
(a*2i + c*2i) + 1)^2)/(4*b) - exp(a*2i + c*1i + b*x*1i)/(2*b) - (exp(- a*2 
i - c*2i)*log((exp(-c*1i)*exp(b*x*1i)*(exp(a*2i)*exp(c*2i)*2i + exp(a*4i)* 
exp(c*4i)*1i + 1i))/2 - ((exp(a*2i)*exp(c*2i) + 1)^2*1i)/2)*(exp(a*2i + c* 
2i) + 1)^2)/(4*b) - exp(- a*2i - c*1i - b*x*1i)/(2*b)
 

Reduce [F]

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

int(-cos(b*x+a)^2*csc(b*x-c),x)
 

Output:

 - int(cos(a + b*x)**2*csc(b*x - c),x)