\(\int \cos ^2(c+d x) (a+b \sec (c+d x))^2 (A+B \sec (c+d x)) \, dx\) [290]

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

Optimal result

Integrand size = 31, antiderivative size = 80 \[ \int \cos ^2(c+d x) (a+b \sec (c+d x))^2 (A+B \sec (c+d x)) \, dx=\frac {1}{2} \left (a^2 A+2 A b^2+4 a b B\right ) x+\frac {b^2 B \text {arctanh}(\sin (c+d x))}{d}+\frac {a (2 A b+a B) \sin (c+d x)}{d}+\frac {a^2 A \cos (c+d x) \sin (c+d x)}{2 d} \] Output:

1/2*(A*a^2+2*A*b^2+4*B*a*b)*x+b^2*B*arctanh(sin(d*x+c))/d+a*(2*A*b+B*a)*si 
n(d*x+c)/d+1/2*a^2*A*cos(d*x+c)*sin(d*x+c)/d
 

Mathematica [A] (verified)

Time = 0.88 (sec) , antiderivative size = 120, normalized size of antiderivative = 1.50 \[ \int \cos ^2(c+d x) (a+b \sec (c+d x))^2 (A+B \sec (c+d x)) \, dx=\frac {2 \left (a^2 A+2 A b^2+4 a b B\right ) (c+d x)-4 b^2 B \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+4 b^2 B \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )+4 a (2 A b+a B) \sin (c+d x)+a^2 A \sin (2 (c+d x))}{4 d} \] Input:

Integrate[Cos[c + d*x]^2*(a + b*Sec[c + d*x])^2*(A + B*Sec[c + d*x]),x]
 

Output:

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

Rubi [A] (verified)

Time = 0.63 (sec) , antiderivative size = 84, normalized size of antiderivative = 1.05, number of steps used = 10, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.323, Rules used = {3042, 4512, 25, 3042, 4535, 24, 3042, 4533, 3042, 4257}

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4512

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

\(\Big \downarrow \) 25

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

\(\Big \downarrow \) 3042

\(\displaystyle \frac {1}{2} \int \frac {2 b^2 B \csc \left (c+d x+\frac {\pi }{2}\right )^2+\left (A a^2+4 b B a+2 A b^2\right ) \csc \left (c+d x+\frac {\pi }{2}\right )+2 a (2 A b+a B)}{\csc \left (c+d x+\frac {\pi }{2}\right )}dx+\frac {a^2 A \sin (c+d x) \cos (c+d x)}{2 d}\)

\(\Big \downarrow \) 4535

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

\(\Big \downarrow \) 24

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

\(\Big \downarrow \) 3042

\(\displaystyle \frac {1}{2} \left (\int \frac {2 b^2 B \csc \left (c+d x+\frac {\pi }{2}\right )^2+2 a (2 A b+a B)}{\csc \left (c+d x+\frac {\pi }{2}\right )}dx+x \left (a^2 A+4 a b B+2 A b^2\right )\right )+\frac {a^2 A \sin (c+d x) \cos (c+d x)}{2 d}\)

\(\Big \downarrow \) 4533

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

\(\Big \downarrow \) 3042

\(\displaystyle \frac {1}{2} \left (2 b^2 B \int \csc \left (c+d x+\frac {\pi }{2}\right )dx+x \left (a^2 A+4 a b B+2 A b^2\right )+\frac {2 a (a B+2 A b) \sin (c+d x)}{d}\right )+\frac {a^2 A \sin (c+d x) \cos (c+d x)}{2 d}\)

\(\Big \downarrow \) 4257

\(\displaystyle \frac {1}{2} \left (x \left (a^2 A+4 a b B+2 A b^2\right )+\frac {2 a (a B+2 A b) \sin (c+d x)}{d}+\frac {2 b^2 B \text {arctanh}(\sin (c+d x))}{d}\right )+\frac {a^2 A \sin (c+d x) \cos (c+d x)}{2 d}\)

Input:

Int[Cos[c + d*x]^2*(a + b*Sec[c + d*x])^2*(A + B*Sec[c + d*x]),x]
 

Output:

(a^2*A*Cos[c + d*x]*Sin[c + d*x])/(2*d) + ((a^2*A + 2*A*b^2 + 4*a*b*B)*x + 
 (2*b^2*B*ArcTanh[Sin[c + d*x]])/d + (2*a*(2*A*b + a*B)*Sin[c + d*x])/d)/2
 

Defintions of rubi rules used

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

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

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

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

rule 4512
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + ( 
a_))^2*(csc[(e_.) + (f_.)*(x_)]*(B_.) + (A_)), x_Symbol] :> Simp[a^2*A*Cos[ 
e + f*x]*((d*Csc[e + f*x])^(n + 1)/(d*f*n)), x] + Simp[1/(d*n)   Int[(d*Csc 
[e + f*x])^(n + 1)*(a*(2*A*b + a*B)*n + (2*a*b*B*n + A*(b^2*n + a^2*(n + 1) 
))*Csc[e + f*x] + b^2*B*n*Csc[e + f*x]^2), x], x] /; FreeQ[{a, b, d, e, f, 
A, B}, x] && NeQ[A*b - a*B, 0] && NeQ[a^2 - b^2, 0] && LeQ[n, -1]
 

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

rule 4535
Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*((A_.) + csc[(e_.) + (f_.)*(x_)]* 
(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_.)), x_Symbol] :> Simp[B/b   Int[(b*Cs 
c[e + f*x])^(m + 1), x], x] + Int[(b*Csc[e + f*x])^m*(A + C*Csc[e + f*x]^2) 
, x] /; FreeQ[{b, e, f, A, B, C, m}, x]
 
Maple [A] (verified)

Time = 0.36 (sec) , antiderivative size = 94, normalized size of antiderivative = 1.18

method result size
derivativedivides \(\frac {A \,a^{2} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+B \,a^{2} \sin \left (d x +c \right )+2 A a b \sin \left (d x +c \right )+2 B a b \left (d x +c \right )+A \,b^{2} \left (d x +c \right )+b^{2} B \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}\) \(94\)
default \(\frac {A \,a^{2} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+B \,a^{2} \sin \left (d x +c \right )+2 A a b \sin \left (d x +c \right )+2 B a b \left (d x +c \right )+A \,b^{2} \left (d x +c \right )+b^{2} B \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}\) \(94\)
parallelrisch \(\frac {-4 B \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) b^{2}+4 B \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) b^{2}+A \,a^{2} \sin \left (2 d x +2 c \right )+\left (8 A a b +4 B \,a^{2}\right ) \sin \left (d x +c \right )+2 \left (A \,a^{2}+2 A \,b^{2}+4 B a b \right ) x d}{4 d}\) \(97\)
risch \(\frac {a^{2} A x}{2}+x A \,b^{2}+2 x B a b -\frac {i {\mathrm e}^{i \left (d x +c \right )} A a b}{d}-\frac {i {\mathrm e}^{i \left (d x +c \right )} B \,a^{2}}{2 d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )} A a b}{d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )} B \,a^{2}}{2 d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) b^{2} B}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) b^{2} B}{d}+\frac {A \,a^{2} \sin \left (2 d x +2 c \right )}{4 d}\) \(156\)
norman \(\frac {\left (\frac {1}{2} A \,a^{2}+A \,b^{2}+2 B a b \right ) x +\left (\frac {1}{2} A \,a^{2}+A \,b^{2}+2 B a b \right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{8}+\left (-A \,a^{2}-2 A \,b^{2}-4 B a b \right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\frac {a \left (A a +4 A b +2 B a \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {a \left (3 A a -4 A b -2 B a \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{d}-\frac {a \left (A a -4 A b -2 B a \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{7}}{d}-\frac {a \left (3 A a +4 A b +2 B a \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{d}}{\left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right )^{2}}+\frac {b^{2} B \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}-\frac {b^{2} B \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}\) \(269\)

Input:

int(cos(d*x+c)^2*(a+b*sec(d*x+c))^2*(A+B*sec(d*x+c)),x,method=_RETURNVERBO 
SE)
 

Output:

1/d*(A*a^2*(1/2*cos(d*x+c)*sin(d*x+c)+1/2*d*x+1/2*c)+B*a^2*sin(d*x+c)+2*A* 
a*b*sin(d*x+c)+2*B*a*b*(d*x+c)+A*b^2*(d*x+c)+b^2*B*ln(sec(d*x+c)+tan(d*x+c 
)))
 

Fricas [A] (verification not implemented)

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

integrate(cos(d*x+c)^2*(a+b*sec(d*x+c))^2*(A+B*sec(d*x+c)),x, algorithm="f 
ricas")
 

Output:

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

Sympy [F]

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

integrate(cos(d*x+c)**2*(a+b*sec(d*x+c))**2*(A+B*sec(d*x+c)),x)
 

Output:

Integral((A + B*sec(c + d*x))*(a + b*sec(c + d*x))**2*cos(c + d*x)**2, x)
 

Maxima [A] (verification not implemented)

Time = 0.04 (sec) , antiderivative size = 99, normalized size of antiderivative = 1.24 \[ \int \cos ^2(c+d x) (a+b \sec (c+d x))^2 (A+B \sec (c+d x)) \, dx=\frac {{\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} A a^{2} + 8 \, {\left (d x + c\right )} B a b + 4 \, {\left (d x + c\right )} A b^{2} + 2 \, B b^{2} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 4 \, B a^{2} \sin \left (d x + c\right ) + 8 \, A a b \sin \left (d x + c\right )}{4 \, d} \] Input:

integrate(cos(d*x+c)^2*(a+b*sec(d*x+c))^2*(A+B*sec(d*x+c)),x, algorithm="m 
axima")
 

Output:

1/4*((2*d*x + 2*c + sin(2*d*x + 2*c))*A*a^2 + 8*(d*x + c)*B*a*b + 4*(d*x + 
 c)*A*b^2 + 2*B*b^2*(log(sin(d*x + c) + 1) - log(sin(d*x + c) - 1)) + 4*B* 
a^2*sin(d*x + c) + 8*A*a*b*sin(d*x + c))/d
 

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 178 vs. \(2 (76) = 152\).

Time = 0.15 (sec) , antiderivative size = 178, normalized size of antiderivative = 2.22 \[ \int \cos ^2(c+d x) (a+b \sec (c+d x))^2 (A+B \sec (c+d x)) \, dx=\frac {2 \, B b^{2} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 2 \, B b^{2} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) + {\left (A a^{2} + 4 \, B a b + 2 \, A b^{2}\right )} {\left (d x + c\right )} - \frac {2 \, {\left (A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 2 \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 4 \, A a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 4 \, A a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{2}}}{2 \, d} \] Input:

integrate(cos(d*x+c)^2*(a+b*sec(d*x+c))^2*(A+B*sec(d*x+c)),x, algorithm="g 
iac")
 

Output:

1/2*(2*B*b^2*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - 2*B*b^2*log(abs(tan(1/2* 
d*x + 1/2*c) - 1)) + (A*a^2 + 4*B*a*b + 2*A*b^2)*(d*x + c) - 2*(A*a^2*tan( 
1/2*d*x + 1/2*c)^3 - 2*B*a^2*tan(1/2*d*x + 1/2*c)^3 - 4*A*a*b*tan(1/2*d*x 
+ 1/2*c)^3 - A*a^2*tan(1/2*d*x + 1/2*c) - 2*B*a^2*tan(1/2*d*x + 1/2*c) - 4 
*A*a*b*tan(1/2*d*x + 1/2*c))/(tan(1/2*d*x + 1/2*c)^2 + 1)^2)/d
 

Mupad [B] (verification not implemented)

Time = 11.69 (sec) , antiderivative size = 169, normalized size of antiderivative = 2.11 \[ \int \cos ^2(c+d x) (a+b \sec (c+d x))^2 (A+B \sec (c+d x)) \, dx=\frac {B\,a^2\,\sin \left (c+d\,x\right )}{d}+\frac {A\,a^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {2\,A\,b^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {2\,B\,b^2\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {A\,a^2\,\sin \left (2\,c+2\,d\,x\right )}{4\,d}+\frac {2\,A\,a\,b\,\sin \left (c+d\,x\right )}{d}+\frac {4\,B\,a\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d} \] Input:

int(cos(c + d*x)^2*(A + B/cos(c + d*x))*(a + b/cos(c + d*x))^2,x)
 

Output:

(B*a^2*sin(c + d*x))/d + (A*a^2*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2) 
))/d + (2*A*b^2*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d + (2*B*b^2* 
atanh(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d + (A*a^2*sin(2*c + 2*d*x)) 
/(4*d) + (2*A*a*b*sin(c + d*x))/d + (4*B*a*b*atan(sin(c/2 + (d*x)/2)/cos(c 
/2 + (d*x)/2)))/d
 

Reduce [B] (verification not implemented)

Time = 0.16 (sec) , antiderivative size = 94, normalized size of antiderivative = 1.18 \[ \int \cos ^2(c+d x) (a+b \sec (c+d x))^2 (A+B \sec (c+d x)) \, dx=\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right ) a^{3}-2 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) b^{3}+2 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) b^{3}+6 \sin \left (d x +c \right ) a^{2} b +a^{3} c +a^{3} d x +6 a \,b^{2} c +6 a \,b^{2} d x}{2 d} \] Input:

int(cos(d*x+c)^2*(a+b*sec(d*x+c))^2*(A+B*sec(d*x+c)),x)
 

Output:

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