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

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 = 29, antiderivative size = 119 \[ \int \cos (c+d x) (a+b \sec (c+d x))^3 (A+B \sec (c+d x)) \, dx=a^2 (3 A b+a B) x+\frac {b \left (6 a A b+6 a^2 B+b^2 B\right ) \text {arctanh}(\sin (c+d x))}{2 d}+\frac {a^2 (2 a A-b B) \sin (c+d x)}{2 d}+\frac {b B (a+b \sec (c+d x))^2 \sin (c+d x)}{2 d}+\frac {b^2 (A b+2 a B) \tan (c+d x)}{d} \] Output:

a^2*(3*A*b+B*a)*x+1/2*b*(6*A*a*b+6*B*a^2+B*b^2)*arctanh(sin(d*x+c))/d+1/2* 
a^2*(2*A*a-B*b)*sin(d*x+c)/d+1/2*b*B*(a+b*sec(d*x+c))^2*sin(d*x+c)/d+b^2*( 
A*b+2*B*a)*tan(d*x+c)/d
 

Mathematica [A] (verified)

Time = 0.79 (sec) , antiderivative size = 105, normalized size of antiderivative = 0.88 \[ \int \cos (c+d x) (a+b \sec (c+d x))^3 (A+B \sec (c+d x)) \, dx=\frac {6 a^2 A b d x+2 a^3 B d x+b \left (6 a A b+6 a^2 B+b^2 B\right ) \text {arctanh}(\sin (c+d x))+2 a^3 A \sin (c+d x)+2 A b^3 \tan (c+d x)+6 a b^2 B \tan (c+d x)+b^3 B \sec (c+d x) \tan (c+d x)}{2 d} \] Input:

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

Output:

(6*a^2*A*b*d*x + 2*a^3*B*d*x + b*(6*a*A*b + 6*a^2*B + b^2*B)*ArcTanh[Sin[c 
 + d*x]] + 2*a^3*A*Sin[c + d*x] + 2*A*b^3*Tan[c + d*x] + 6*a*b^2*B*Tan[c + 
 d*x] + b^3*B*Sec[c + d*x]*Tan[c + d*x])/(2*d)
 

Rubi [A] (verified)

Time = 0.54 (sec) , antiderivative size = 134, normalized size of antiderivative = 1.13, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.207, Rules used = {3042, 4513, 25, 3042, 4536, 2009}

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 (c+d x) (a+b \sec (c+d x))^3 (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 )^3 \left (A+B \csc \left (c+d x+\frac {\pi }{2}\right )\right )}{\csc \left (c+d x+\frac {\pi }{2}\right )}dx\)

\(\Big \downarrow \) 4513

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

\(\Big \downarrow \) 25

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4536

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

\(\Big \downarrow \) 2009

\(\displaystyle \frac {1}{2} \left (\frac {b \left (6 a^2 B+6 a A b+b^2 B\right ) \text {arctanh}(\sin (c+d x))}{d}-\frac {2 b \left (2 a^2 A-3 a b B-A b^2\right ) \tan (c+d x)}{d}+2 a^2 x (a B+3 A b)\right )-\frac {b^2 (2 a A-b B) \tan (c+d x) \sec (c+d x)}{2 d}+\frac {a A \sin (c+d x) (a+b \sec (c+d x))^2}{d}\)

Input:

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

Output:

(a*A*(a + b*Sec[c + d*x])^2*Sin[c + d*x])/d - (b^2*(2*a*A - b*B)*Sec[c + d 
*x]*Tan[c + d*x])/(2*d) + (2*a^2*(3*A*b + a*B)*x + (b*(6*a*A*b + 6*a^2*B + 
 b^2*B)*ArcTanh[Sin[c + d*x]])/d - (2*b*(2*a^2*A - A*b^2 - 3*a*b*B)*Tan[c 
+ d*x])/d)/2
 

Defintions of rubi rules used

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

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 4513
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + ( 
a_))^(m_)*(csc[(e_.) + (f_.)*(x_)]*(B_.) + (A_)), x_Symbol] :> Simp[a*A*Cot 
[e + f*x]*(a + b*Csc[e + f*x])^(m - 1)*((d*Csc[e + f*x])^n/(f*n)), x] + Sim 
p[1/(d*n)   Int[(a + b*Csc[e + f*x])^(m - 2)*(d*Csc[e + f*x])^(n + 1)*Simp[ 
a*(a*B*n - A*b*(m - n - 1)) + (2*a*b*B*n + A*(b^2*n + a^2*(1 + n)))*Csc[e + 
 f*x] + b*(b*B*n + a*A*(m + n))*Csc[e + f*x]^2, x], x], x] /; FreeQ[{a, b, 
d, e, f, A, B}, x] && NeQ[A*b - a*B, 0] && NeQ[a^2 - b^2, 0] && GtQ[m, 1] & 
& LeQ[n, -1]
 

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

Time = 0.96 (sec) , antiderivative size = 141, normalized size of antiderivative = 1.18

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

Input:

int(cos(d*x+c)*(a+b*sec(d*x+c))^3*(A+B*sec(d*x+c)),x,method=_RETURNVERBOSE 
)
 

Output:

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

Fricas [A] (verification not implemented)

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

integrate(cos(d*x+c)*(a+b*sec(d*x+c))^3*(A+B*sec(d*x+c)),x, algorithm="fri 
cas")
 

Output:

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

Sympy [F]

\[ \int \cos (c+d x) (a+b \sec (c+d x))^3 (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 )^{3} \cos {\left (c + d x \right )}\, dx \] Input:

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

Output:

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

Maxima [A] (verification not implemented)

Time = 0.04 (sec) , antiderivative size = 169, normalized size of antiderivative = 1.42 \[ \int \cos (c+d x) (a+b \sec (c+d x))^3 (A+B \sec (c+d x)) \, dx=\frac {4 \, {\left (d x + c\right )} B a^{3} + 12 \, {\left (d x + c\right )} A a^{2} b - B b^{3} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 6 \, B a^{2} b {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 6 \, A a 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 \, A a^{3} \sin \left (d x + c\right ) + 12 \, B a b^{2} \tan \left (d x + c\right ) + 4 \, A b^{3} \tan \left (d x + c\right )}{4 \, d} \] Input:

integrate(cos(d*x+c)*(a+b*sec(d*x+c))^3*(A+B*sec(d*x+c)),x, algorithm="max 
ima")
 

Output:

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

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 241 vs. \(2 (113) = 226\).

Time = 0.18 (sec) , antiderivative size = 241, normalized size of antiderivative = 2.03 \[ \int \cos (c+d x) (a+b \sec (c+d x))^3 (A+B \sec (c+d x)) \, dx=\frac {\frac {4 \, A a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1} + 2 \, {\left (B a^{3} + 3 \, A a^{2} b\right )} {\left (d x + c\right )} + {\left (6 \, B a^{2} b + 6 \, A a b^{2} + B b^{3}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - {\left (6 \, B a^{2} b + 6 \, A a b^{2} + B b^{3}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, {\left (6 \, B a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 2 \, A b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - B b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 6 \, B a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, A b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - B b^{3} \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)*(a+b*sec(d*x+c))^3*(A+B*sec(d*x+c)),x, algorithm="gia 
c")
 

Output:

1/2*(4*A*a^3*tan(1/2*d*x + 1/2*c)/(tan(1/2*d*x + 1/2*c)^2 + 1) + 2*(B*a^3 
+ 3*A*a^2*b)*(d*x + c) + (6*B*a^2*b + 6*A*a*b^2 + B*b^3)*log(abs(tan(1/2*d 
*x + 1/2*c) + 1)) - (6*B*a^2*b + 6*A*a*b^2 + B*b^3)*log(abs(tan(1/2*d*x + 
1/2*c) - 1)) - 2*(6*B*a*b^2*tan(1/2*d*x + 1/2*c)^3 + 2*A*b^3*tan(1/2*d*x + 
 1/2*c)^3 - B*b^3*tan(1/2*d*x + 1/2*c)^3 - 6*B*a*b^2*tan(1/2*d*x + 1/2*c) 
- 2*A*b^3*tan(1/2*d*x + 1/2*c) - B*b^3*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 = 12.08 (sec) , antiderivative size = 249, normalized size of antiderivative = 2.09 \[ \int \cos (c+d x) (a+b \sec (c+d x))^3 (A+B \sec (c+d x)) \, dx=\frac {\frac {A\,a^3\,\sin \left (3\,c+3\,d\,x\right )}{4}+\frac {A\,b^3\,\sin \left (2\,c+2\,d\,x\right )}{2}+\frac {A\,a^3\,\sin \left (c+d\,x\right )}{4}+\frac {B\,b^3\,\sin \left (c+d\,x\right )}{2}+\frac {3\,B\,a\,b^2\,\sin \left (2\,c+2\,d\,x\right )}{2}}{d\,\left (\frac {\cos \left (2\,c+2\,d\,x\right )}{2}+\frac {1}{2}\right )}-\frac {2\,\left (-B\,a^3\,\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 )+\frac {B\,b^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,1{}\mathrm {i}}{2}-3\,A\,a^2\,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 )+A\,a\,b^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,3{}\mathrm {i}+B\,a^2\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,3{}\mathrm {i}\right )}{d} \] Input:

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

Output:

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

Reduce [B] (verification not implemented)

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

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

Output:

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