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

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

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

Mathematica [A] (verified)

Time = 0.38 (sec) , antiderivative size = 145, normalized size of antiderivative = 1.06 \[ \int (a+b \sec (c+d x))^3 (A+B \sec (c+d x)) \, dx=\frac {6 a^3 A d x+6 a^2 (3 A b+a B) \coth ^{-1}(\sin (c+d x))+3 b^2 (A b+3 a B) \text {arctanh}(\sin (c+d x))+18 a A b^2 \tan (c+d x)+18 a^2 b B \tan (c+d x)+6 b^3 B \tan (c+d x)+3 A b^3 \sec (c+d x) \tan (c+d x)+9 a b^2 B \sec (c+d x) \tan (c+d x)+2 b^3 B \tan ^3(c+d x)}{6 d} \] Input:

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

Output:

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

Rubi [A] (verified)

Time = 0.50 (sec) , antiderivative size = 144, normalized size of antiderivative = 1.05, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.217, Rules used = {3042, 4406, 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 (a+b \sec (c+d x))^3 (A+B \sec (c+d x)) \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \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 )dx\)

\(\Big \downarrow \) 4406

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4536

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

\(\Big \downarrow \) 2009

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

Input:

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

Output:

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

Defintions of rubi rules used

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 4406
Int[(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_)*(csc[(e_.) + (f_.)*(x_)]*(d 
_.) + (c_)), x_Symbol] :> Simp[(-b)*d*Cot[e + f*x]*((a + b*Csc[e + f*x])^(m 
 - 1)/(f*m)), x] + Simp[1/m   Int[(a + b*Csc[e + f*x])^(m - 2)*Simp[a^2*c*m 
 + (b^2*d*(m - 1) + 2*a*b*c*m + a^2*d*m)*Csc[e + f*x] + b*(b*c*m + a*d*(2*m 
 - 1))*Csc[e + f*x]^2, x], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b* 
c - a*d, 0] && GtQ[m, 1] && NeQ[a^2 - b^2, 0] && IntegerQ[2*m]
 

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 = 1.12 (sec) , antiderivative size = 139, normalized size of antiderivative = 1.01

method result size
parts \(a^{3} A x +\frac {\left (A \,b^{3}+3 B a \,b^{2}\right ) \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}+\frac {\left (3 A a \,b^{2}+3 B \,a^{2} b \right ) \tan \left (d x +c \right )}{d}+\frac {\left (3 A \,a^{2} b +B \,a^{3}\right ) \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}-\frac {B \,b^{3} \left (-\frac {2}{3}-\frac {\sec \left (d x +c \right )^{2}}{3}\right ) \tan \left (d x +c \right )}{d}\) \(139\)
derivativedivides \(\frac {a^{3} A \left (d x +c \right )+B \,a^{3} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+3 A \,a^{2} b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+3 B \tan \left (d x +c \right ) a^{2} b +3 A \tan \left (d x +c \right ) a \,b^{2}+3 B a \,b^{2} \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 )+A \,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 )-B \,b^{3} \left (-\frac {2}{3}-\frac {\sec \left (d x +c \right )^{2}}{3}\right ) \tan \left (d x +c \right )}{d}\) \(180\)
default \(\frac {a^{3} A \left (d x +c \right )+B \,a^{3} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+3 A \,a^{2} b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+3 B \tan \left (d x +c \right ) a^{2} b +3 A \tan \left (d x +c \right ) a \,b^{2}+3 B a \,b^{2} \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 )+A \,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 )-B \,b^{3} \left (-\frac {2}{3}-\frac {\sec \left (d x +c \right )^{2}}{3}\right ) \tan \left (d x +c \right )}{d}\) \(180\)
parallelrisch \(\frac {-27 \left (A \,a^{2} b +\frac {1}{6} A \,b^{3}+\frac {1}{3} B \,a^{3}+\frac {1}{2} B a \,b^{2}\right ) \left (\frac {\cos \left (3 d x +3 c \right )}{3}+\cos \left (d x +c \right )\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+27 \left (A \,a^{2} b +\frac {1}{6} A \,b^{3}+\frac {1}{3} B \,a^{3}+\frac {1}{2} B a \,b^{2}\right ) \left (\frac {\cos \left (3 d x +3 c \right )}{3}+\cos \left (d x +c \right )\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )+3 a^{3} A x d \cos \left (3 d x +3 c \right )+\left (9 A a \,b^{2}+9 B \,a^{2} b +2 B \,b^{3}\right ) \sin \left (3 d x +3 c \right )+3 \left (A \,b^{3}+3 B a \,b^{2}\right ) \sin \left (2 d x +2 c \right )+9 a^{3} A x d \cos \left (d x +c \right )+9 \sin \left (d x +c \right ) b \left (A a b +B \,a^{2}+\frac {2}{3} b^{2} B \right )}{3 d \left (\cos \left (3 d x +3 c \right )+3 \cos \left (d x +c \right )\right )}\) \(254\)
norman \(\frac {a^{3} A x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}-a^{3} A x +3 a^{3} A x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-3 a^{3} A x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\frac {4 b \left (9 A a b +9 B \,a^{2}+b^{2} B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{3 d}-\frac {b \left (6 A a b -A \,b^{2}+6 B \,a^{2}-3 B a b +2 b^{2} B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{d}-\frac {b \left (6 A a b +A \,b^{2}+6 B \,a^{2}+3 B a b +2 b^{2} B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}}{\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right )^{3}}-\frac {\left (6 A \,a^{2} b +A \,b^{3}+2 B \,a^{3}+3 B a \,b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2 d}+\frac {\left (6 A \,a^{2} b +A \,b^{3}+2 B \,a^{3}+3 B a \,b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2 d}\) \(288\)
risch \(a^{3} A x -\frac {i b \left (3 A \,b^{2} {\mathrm e}^{5 i \left (d x +c \right )}+9 B a b \,{\mathrm e}^{5 i \left (d x +c \right )}-18 A a b \,{\mathrm e}^{4 i \left (d x +c \right )}-18 B \,a^{2} {\mathrm e}^{4 i \left (d x +c \right )}-36 A a b \,{\mathrm e}^{2 i \left (d x +c \right )}-36 B \,a^{2} {\mathrm e}^{2 i \left (d x +c \right )}-12 B \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}-3 A \,b^{2} {\mathrm e}^{i \left (d x +c \right )}-9 B a b \,{\mathrm e}^{i \left (d x +c \right )}-18 A a b -18 B \,a^{2}-4 b^{2} B \right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3}}-\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A \,a^{2} b}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A \,b^{3}}{2 d}-\frac {a^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B}{d}-\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B a \,b^{2}}{2 d}+\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A \,a^{2} b}{d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A \,b^{3}}{2 d}+\frac {a^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B}{d}+\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B a \,b^{2}}{2 d}\) \(356\)

Input:

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

Output:

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

Fricas [A] (verification not implemented)

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

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

Output:

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

Sympy [F]

\[ \int (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}\, dx \] Input:

integrate((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, x)
 

Maxima [A] (verification not implemented)

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

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

Output:

1/12*(12*(d*x + c)*A*a^3 + 4*(tan(d*x + c)^3 + 3*tan(d*x + c))*B*b^3 - 9*B 
*a*b^2*(2*sin(d*x + c)/(sin(d*x + c)^2 - 1) - log(sin(d*x + c) + 1) + log( 
sin(d*x + c) - 1)) - 3*A*b^3*(2*sin(d*x + c)/(sin(d*x + c)^2 - 1) - log(si 
n(d*x + c) + 1) + log(sin(d*x + c) - 1)) + 12*B*a^3*log(sec(d*x + c) + tan 
(d*x + c)) + 36*A*a^2*b*log(sec(d*x + c) + tan(d*x + c)) + 36*B*a^2*b*tan( 
d*x + c) + 36*A*a*b^2*tan(d*x + c))/d
 

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 336 vs. \(2 (129) = 258\).

Time = 0.20 (sec) , antiderivative size = 336, normalized size of antiderivative = 2.45 \[ \int (a+b \sec (c+d x))^3 (A+B \sec (c+d x)) \, dx=\frac {6 \, {\left (d x + c\right )} A a^{3} + 3 \, {\left (2 \, B a^{3} + 6 \, A a^{2} b + 3 \, B a b^{2} + A b^{3}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 3 \, {\left (2 \, B a^{3} + 6 \, A a^{2} b + 3 \, B a b^{2} + A b^{3}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, {\left (18 \, B a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 18 \, A a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 9 \, B a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 3 \, A b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 6 \, B b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 36 \, B a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 36 \, A a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 4 \, B b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 18 \, B a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 18 \, A a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 9 \, B a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 3 \, A b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 6 \, 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 )}^{3}}}{6 \, d} \] Input:

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

Output:

1/6*(6*(d*x + c)*A*a^3 + 3*(2*B*a^3 + 6*A*a^2*b + 3*B*a*b^2 + A*b^3)*log(a 
bs(tan(1/2*d*x + 1/2*c) + 1)) - 3*(2*B*a^3 + 6*A*a^2*b + 3*B*a*b^2 + A*b^3 
)*log(abs(tan(1/2*d*x + 1/2*c) - 1)) - 2*(18*B*a^2*b*tan(1/2*d*x + 1/2*c)^ 
5 + 18*A*a*b^2*tan(1/2*d*x + 1/2*c)^5 - 9*B*a*b^2*tan(1/2*d*x + 1/2*c)^5 - 
 3*A*b^3*tan(1/2*d*x + 1/2*c)^5 + 6*B*b^3*tan(1/2*d*x + 1/2*c)^5 - 36*B*a^ 
2*b*tan(1/2*d*x + 1/2*c)^3 - 36*A*a*b^2*tan(1/2*d*x + 1/2*c)^3 - 4*B*b^3*t 
an(1/2*d*x + 1/2*c)^3 + 18*B*a^2*b*tan(1/2*d*x + 1/2*c) + 18*A*a*b^2*tan(1 
/2*d*x + 1/2*c) + 9*B*a*b^2*tan(1/2*d*x + 1/2*c) + 3*A*b^3*tan(1/2*d*x + 1 
/2*c) + 6*B*b^3*tan(1/2*d*x + 1/2*c))/(tan(1/2*d*x + 1/2*c)^2 - 1)^3)/d
 

Mupad [B] (verification not implemented)

Time = 12.86 (sec) , antiderivative size = 526, normalized size of antiderivative = 3.84 \[ \int (a+b \sec (c+d x))^3 (A+B \sec (c+d x)) \, dx =\text {Too large to display} \] Input:

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

Output:

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

Reduce [B] (verification not implemented)

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

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

Output:

( - 12*cos(c + d*x)*log(tan((c + d*x)/2) - 1)*sin(c + d*x)**2*a**3*b - 6*c 
os(c + d*x)*log(tan((c + d*x)/2) - 1)*sin(c + d*x)**2*a*b**3 + 12*cos(c + 
d*x)*log(tan((c + d*x)/2) - 1)*a**3*b + 6*cos(c + d*x)*log(tan((c + d*x)/2 
) - 1)*a*b**3 + 12*cos(c + d*x)*log(tan((c + d*x)/2) + 1)*sin(c + d*x)**2* 
a**3*b + 6*cos(c + d*x)*log(tan((c + d*x)/2) + 1)*sin(c + d*x)**2*a*b**3 - 
 12*cos(c + d*x)*log(tan((c + d*x)/2) + 1)*a**3*b - 6*cos(c + d*x)*log(tan 
((c + d*x)/2) + 1)*a*b**3 + 3*cos(c + d*x)*sin(c + d*x)**2*a**4*d*x - 6*co 
s(c + d*x)*sin(c + d*x)*a*b**3 - 3*cos(c + d*x)*a**4*d*x + 18*sin(c + d*x) 
**3*a**2*b**2 + 2*sin(c + d*x)**3*b**4 - 18*sin(c + d*x)*a**2*b**2 - 3*sin 
(c + d*x)*b**4)/(3*cos(c + d*x)*d*(sin(c + d*x)**2 - 1))