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

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

Optimal result

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

x*cos(2*a+2*c)+ln(cos(b*x-c))*sin(2*a+2*c)/b+sin(a+c)^2*tan(b*x-c)/b
 

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(182\) vs. \(2(45)=90\).

Time = 0.42 (sec) , antiderivative size = 182, normalized size of antiderivative = 4.04 \[ \int \cos ^2(a+b x) \sec ^2(c-b x) \, dx=\frac {\sec (c) \sec (c-b x) (b x \cos (2 a+2 c-b x)+b x \cos (2 a+4 c-b x)+b x \cos (2 a+b x)+b x \cos (2 a+2 c+b x)+2 \sin (b x)+\sin (2 a+2 c-b x)+\log (\cos (c-b x)) \sin (2 a+2 c-b x)+\log (\cos (c-b x)) \sin (2 a+4 c-b x)+\log (\cos (c-b x)) \sin (2 a+b x)-\sin (2 a+2 c+b x)+\log (\cos (c-b x)) \sin (2 a+2 c+b x))}{4 b} \] Input:

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

Output:

(Sec[c]*Sec[c - b*x]*(b*x*Cos[2*a + 2*c - b*x] + b*x*Cos[2*a + 4*c - b*x] 
+ b*x*Cos[2*a + b*x] + b*x*Cos[2*a + 2*c + b*x] + 2*Sin[b*x] + Sin[2*a + 2 
*c - b*x] + Log[Cos[c - b*x]]*Sin[2*a + 2*c - b*x] + Log[Cos[c - b*x]]*Sin 
[2*a + 4*c - b*x] + Log[Cos[c - b*x]]*Sin[2*a + b*x] - Sin[2*a + 2*c + b*x 
] + Log[Cos[c - b*x]]*Sin[2*a + 2*c + b*x]))/(4*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) \sec ^2(c-b x) \, dx\)

\(\Big \downarrow \) 7299

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

Input:

Int[Cos[a + b*x]^2*Sec[c - b*x]^2,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 = 3.29 (sec) , antiderivative size = 157, normalized size of antiderivative = 3.49

method result size
risch \(x \,{\mathrm e}^{2 i \left (a +c \right )}-2 i \sin \left (2 a +2 c \right ) x -\frac {2 i \sin \left (2 a +2 c \right ) a}{b}-\frac {i {\mathrm e}^{4 i \left (a +c \right )}}{2 b \left ({\mathrm e}^{2 i \left (a +c \right )}+{\mathrm e}^{2 i \left (b x +a \right )}\right )}+\frac {i {\mathrm e}^{2 i \left (a +c \right )}}{b \left ({\mathrm e}^{2 i \left (a +c \right )}+{\mathrm e}^{2 i \left (b x +a \right )}\right )}-\frac {i}{2 b \left ({\mathrm e}^{2 i \left (a +c \right )}+{\mathrm e}^{2 i \left (b x +a \right )}\right )}+\frac {\ln \left ({\mathrm e}^{2 i \left (a +c \right )}+{\mathrm e}^{2 i \left (b x +a \right )}\right ) \sin \left (2 a +2 c \right )}{b}\) \(157\)
default \(\frac {\frac {\frac {\left (-2 \cos \left (c \right )^{2} \cos \left (a \right ) \sin \left (a \right )-2 \cos \left (a \right )^{2} \cos \left (c \right ) \sin \left (c \right )+2 \sin \left (a \right )^{2} \cos \left (c \right ) \sin \left (c \right )+2 \cos \left (a \right ) \sin \left (a \right ) \sin \left (c \right )^{2}\right ) \ln \left (\tan \left (b x +a \right )^{2}+1\right )}{2}+\left (-\sin \left (c \right )^{2} \cos \left (a \right )^{2}+\cos \left (a \right )^{2} \cos \left (c \right )^{2}-4 \cos \left (a \right ) \cos \left (c \right ) \sin \left (a \right ) \sin \left (c \right )+\sin \left (a \right )^{2} \sin \left (c \right )^{2}-\cos \left (c \right )^{2} \sin \left (a \right )^{2}\right ) \arctan \left (\tan \left (b x +a \right )\right )}{\left (\cos \left (c \right )^{2}+\sin \left (c \right )^{2}\right )^{2} \left (\cos \left (a \right )^{2}+\sin \left (a \right )^{2}\right )^{2}}-\frac {\cos \left (c \right )^{2} \sin \left (a \right )^{2}+2 \cos \left (a \right ) \cos \left (c \right ) \sin \left (a \right ) \sin \left (c \right )+\sin \left (c \right )^{2} \cos \left (a \right )^{2}}{\left (\cos \left (a \right )^{2}+\sin \left (a \right )^{2}\right ) \left (\cos \left (c \right )^{2}+\sin \left (c \right )^{2}\right ) \left (\sin \left (a \right ) \cos \left (c \right )+\cos \left (a \right ) \sin \left (c \right )\right ) \left (\tan \left (b x +a \right ) \sin \left (a \right ) \cos \left (c \right )+\tan \left (b x +a \right ) \cos \left (a \right ) \sin \left (c \right )+\cos \left (a \right ) \cos \left (c \right )-\sin \left (a \right ) \sin \left (c \right )\right )}+\frac {\left (-2 \cos \left (c \right )^{2} \sin \left (c \right ) \sin \left (a \right )^{3}+2 \cos \left (c \right )^{3} \sin \left (a \right )^{2} \cos \left (a \right )-4 \cos \left (c \right ) \sin \left (c \right )^{2} \cos \left (a \right ) \sin \left (a \right )^{2}+4 \cos \left (c \right )^{2} \sin \left (c \right ) \cos \left (a \right )^{2} \sin \left (a \right )-2 \sin \left (c \right )^{3} \sin \left (a \right ) \cos \left (a \right )^{2}+2 \cos \left (c \right ) \sin \left (c \right )^{2} \cos \left (a \right )^{3}\right ) \ln \left (\tan \left (b x +a \right ) \sin \left (a \right ) \cos \left (c \right )+\tan \left (b x +a \right ) \cos \left (a \right ) \sin \left (c \right )+\cos \left (a \right ) \cos \left (c \right )-\sin \left (a \right ) \sin \left (c \right )\right )}{\left (\cos \left (c \right )^{2}+\sin \left (c \right )^{2}\right )^{2} \left (\cos \left (a \right )^{2}+\sin \left (a \right )^{2}\right )^{2} \left (\sin \left (a \right ) \cos \left (c \right )+\cos \left (a \right ) \sin \left (c \right )\right )}}{b}\) \(391\)

Input:

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

Output:

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

Fricas [B] (verification not implemented)

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

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

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

Output:

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

Sympy [F(-2)]

Exception generated. \[ \int \cos ^2(a+b x) \sec ^2(c-b x) \, dx=\text {Exception raised: HeuristicGCDFailed} \] Input:

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

Output:

Exception raised: HeuristicGCDFailed >> no luck
 

Maxima [B] (verification not implemented)

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

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

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

Output:

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

Giac [B] (verification not implemented)

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

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

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

Output:

((tan(1/2*a)^4*tan(1/2*c)^4 - 6*tan(1/2*a)^4*tan(1/2*c)^2 - 16*tan(1/2*a)^ 
3*tan(1/2*c)^3 - 6*tan(1/2*a)^2*tan(1/2*c)^4 + tan(1/2*a)^4 + 16*tan(1/2*a 
)^3*tan(1/2*c) + 36*tan(1/2*a)^2*tan(1/2*c)^2 + 16*tan(1/2*a)*tan(1/2*c)^3 
 + tan(1/2*c)^4 - 6*tan(1/2*a)^2 - 16*tan(1/2*a)*tan(1/2*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*c)^5 - tan(1/2*a)^4 - 8*tan(1/2* 
a)^3*tan(1/2*c) - 14*tan(1/2*a)^2*tan(1/2*c)^2 - 8*tan(1/2*a)*tan(1/2*c...
 

Mupad [B] (verification not implemented)

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

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

Output:

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

Reduce [F]

\[ \int \cos ^2(a+b x) \sec ^2(c-b x) \, dx =\text {Too large to display} \] Input:

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

Output:

( - 7*cos(b*x - c)*cos(a + b*x)*sin(a + b*x) - 96*cos(b*x - c)*int(tan((b* 
x - c)/2)**2/(tan((b*x - c)/2)**4*tan((a + b*x)/2)**4 + 2*tan((b*x - c)/2) 
**4*tan((a + b*x)/2)**2 + tan((b*x - c)/2)**4 - 2*tan((b*x - c)/2)**2*tan( 
(a + b*x)/2)**4 - 4*tan((b*x - c)/2)**2*tan((a + b*x)/2)**2 - 2*tan((b*x - 
 c)/2)**2 + tan((a + b*x)/2)**4 + 2*tan((a + b*x)/2)**2 + 1),x)*b - 96*cos 
(b*x - c)*int(tan((a + b*x)/2)**2/(tan((b*x - c)/2)**4*tan((a + b*x)/2)**4 
 + 2*tan((b*x - c)/2)**4*tan((a + b*x)/2)**2 + tan((b*x - c)/2)**4 - 2*tan 
((b*x - c)/2)**2*tan((a + b*x)/2)**4 - 4*tan((b*x - c)/2)**2*tan((a + b*x) 
/2)**2 - 2*tan((b*x - c)/2)**2 + tan((a + b*x)/2)**4 + 2*tan((a + b*x)/2)* 
*2 + 1),x)*b + 128*cos(b*x - c)*int((tan((b*x - c)/2)*tan((a + b*x)/2))/(t 
an((b*x - c)/2)**4*tan((a + b*x)/2)**4 + 2*tan((b*x - c)/2)**4*tan((a + b* 
x)/2)**2 + tan((b*x - c)/2)**4 - 2*tan((b*x - c)/2)**2*tan((a + b*x)/2)**4 
 - 4*tan((b*x - c)/2)**2*tan((a + b*x)/2)**2 - 2*tan((b*x - c)/2)**2 + tan 
((a + b*x)/2)**4 + 2*tan((a + b*x)/2)**2 + 1),x)*b + 32*cos(b*x - c)*int(1 
/(tan((b*x - c)/2)**4*tan((a + b*x)/2)**4 + 2*tan((b*x - c)/2)**4*tan((a + 
 b*x)/2)**2 + tan((b*x - c)/2)**4 - 2*tan((b*x - c)/2)**2*tan((a + b*x)/2) 
**4 - 4*tan((b*x - c)/2)**2*tan((a + b*x)/2)**2 - 2*tan((b*x - c)/2)**2 + 
tan((a + b*x)/2)**4 + 2*tan((a + b*x)/2)**2 + 1),x)*b - 16*cos(b*x - c)*si 
n(a + b*x) - 9*cos(b*x - c)*a - 9*cos(b*x - c)*b*x + 8*cos(a + b*x)*sin(b* 
x - c) - 8*cos(a + b*x)*sin(a + b*x) - 4*sin(b*x - c)*sin(a + b*x)**2 +...