\(\int \sec (c+d x) (a+b \tan (c+d x))^3 \, dx\) [546]

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

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

Mathematica [B] (verified)

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

Time = 1.51 (sec) , antiderivative size = 293, normalized size of antiderivative = 3.26 \[ \int \sec (c+d x) (a+b \tan (c+d x))^3 \, dx=\frac {36 a^2 b-10 b^3-6 a \left (2 a^2-3 b^2\right ) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+12 a^3 \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )-18 a b^2 \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )+\frac {9 a b^2}{\left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}+\frac {b^3}{\left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}+2 b \left (18 a^2-b^2+2 b^2 \cos (c+d x)+\left (18 a^2-5 b^2\right ) \cos (2 (c+d x))\right ) \sec ^3(c+d x) \sin ^2\left (\frac {1}{2} (c+d x)\right )-\frac {9 a b^2}{\left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}+\frac {b^3}{\left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}}{12 d} \] Input:

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

Output:

(36*a^2*b - 10*b^3 - 6*a*(2*a^2 - 3*b^2)*Log[Cos[(c + d*x)/2] - Sin[(c + d 
*x)/2]] + 12*a^3*Log[Cos[(c + d*x)/2] + Sin[(c + d*x)/2]] - 18*a*b^2*Log[C 
os[(c + d*x)/2] + Sin[(c + d*x)/2]] + (9*a*b^2)/(Cos[(c + d*x)/2] - Sin[(c 
 + d*x)/2])^2 + b^3/(Cos[(c + d*x)/2] - Sin[(c + d*x)/2])^2 + 2*b*(18*a^2 
- b^2 + 2*b^2*Cos[c + d*x] + (18*a^2 - 5*b^2)*Cos[2*(c + d*x)])*Sec[c + d* 
x]^3*Sin[(c + d*x)/2]^2 - (9*a*b^2)/(Cos[(c + d*x)/2] + Sin[(c + d*x)/2])^ 
2 + b^3/(Cos[(c + d*x)/2] + Sin[(c + d*x)/2])^2)/(12*d)
 

Rubi [A] (verified)

Time = 0.48 (sec) , antiderivative size = 97, normalized size of antiderivative = 1.08, number of steps used = 12, number of rules used = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.579, Rules used = {3042, 3991, 3042, 4159, 27, 298, 219, 4861, 27, 244, 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 \sec (c+d x) (a+b \tan (c+d x))^3 \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \sec (c+d x) (a+b \tan (c+d x))^3dx\)

\(\Big \downarrow \) 3991

\(\displaystyle \int \sec (c+d x) \left (a^3+3 b^2 \tan ^2(c+d x) a\right )dx+\int \sec (c+d x) \tan (c+d x) \left (\tan ^2(c+d x) b^3+3 a^2 b\right )dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \sec (c+d x) \left (a^3+3 b^2 \tan (c+d x)^2 a\right )dx+\int \sec (c+d x) \tan (c+d x) \left (\tan (c+d x)^2 b^3+3 a^2 b\right )dx\)

\(\Big \downarrow \) 4159

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

\(\Big \downarrow \) 27

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

\(\Big \downarrow \) 298

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

\(\Big \downarrow \) 219

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

\(\Big \downarrow \) 4861

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

\(\Big \downarrow \) 27

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

\(\Big \downarrow \) 244

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

\(\Big \downarrow \) 2009

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

Input:

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

Output:

-((b*(-((3*a^2 - b^2)*Sec[c + d*x]) - (b^2*Sec[c + d*x]^3)/3))/d) + (a*((( 
2*a^2 - 3*b^2)*ArcTanh[Sin[c + d*x]])/2 + (3*b^2*Sin[c + d*x])/(2*(1 - Sin 
[c + d*x]^2))))/d
 

Defintions of rubi rules used

rule 27
Int[(a_)*(Fx_), x_Symbol] :> Simp[a   Int[Fx, x], x] /; FreeQ[a, x] &&  !Ma 
tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
 

rule 219
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))* 
ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (Gt 
Q[a, 0] || LtQ[b, 0])
 

rule 244
Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_.), x_Symbol] :> Int[Expand 
Integrand[(c*x)^m*(a + b*x^2)^p, x], x] /; FreeQ[{a, b, c, m}, x] && IGtQ[p 
, 0]
 

rule 298
Int[((a_) + (b_.)*(x_)^2)^(p_)*((c_) + (d_.)*(x_)^2), x_Symbol] :> Simp[(-( 
b*c - a*d))*x*((a + b*x^2)^(p + 1)/(2*a*b*(p + 1))), x] - Simp[(a*d - b*c*( 
2*p + 3))/(2*a*b*(p + 1))   Int[(a + b*x^2)^(p + 1), x], x] /; FreeQ[{a, b, 
 c, d, p}, x] && NeQ[b*c - a*d, 0] && (LtQ[p, -1] || ILtQ[1/2 + p, 0])
 

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 3991
Int[sec[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n 
_), x_Symbol] :> Module[{k}, Int[Sec[e + f*x]^m*Sum[Binomial[n, 2*k]*a^(n - 
 2*k)*b^(2*k)*Tan[e + f*x]^(2*k), {k, 0, n/2}], x] + Int[Sec[e + f*x]^m*Tan 
[e + f*x]*Sum[Binomial[n, 2*k + 1]*a^(n - 2*k - 1)*b^(2*k + 1)*Tan[e + f*x] 
^(2*k), {k, 0, (n - 1)/2}], x]] /; FreeQ[{a, b, e, f}, x] && NeQ[a^2 + b^2, 
 0] && IntegerQ[(m - 1)/2] && IGtQ[n, 0]
 

rule 4159
Int[sec[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]^(n_ 
))^(p_.), x_Symbol] :> With[{ff = FreeFactors[Sin[e + f*x], x]}, Simp[ff/f 
  Subst[Int[ExpandToSum[b*(ff*x)^n + a*(1 - ff^2*x^2)^(n/2), x]^p/(1 - ff^2 
*x^2)^((m + n*p + 1)/2), x], x, Sin[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f} 
, x] && IntegerQ[(m - 1)/2] && IntegerQ[n/2] && IntegerQ[p]
 

rule 4861
Int[(u_)*(F_)[(c_.)*((a_.) + (b_.)*(x_))], x_Symbol] :> With[{d = FreeFacto 
rs[Cos[c*(a + b*x)], x]}, Simp[-(b*c)^(-1)   Subst[Int[SubstFor[1/x, Cos[c* 
(a + b*x)]/d, u, x], x], x, Cos[c*(a + b*x)]/d], x] /; FunctionOfQ[Cos[c*(a 
 + b*x)]/d, u, x]] /; FreeQ[{a, b, c}, x] && (EqQ[F, Tan] || EqQ[F, tan])
 
Maple [A] (verified)

Time = 2.41 (sec) , antiderivative size = 146, normalized size of antiderivative = 1.62

method result size
derivativedivides \(\frac {b^{3} \left (\frac {\sin \left (d x +c \right )^{4}}{3 \cos \left (d x +c \right )^{3}}-\frac {\sin \left (d x +c \right )^{4}}{3 \cos \left (d x +c \right )}-\frac {\left (2+\sin \left (d x +c \right )^{2}\right ) \cos \left (d x +c \right )}{3}\right )+3 a \,b^{2} \left (\frac {\sin \left (d x +c \right )^{3}}{2 \cos \left (d x +c \right )^{2}}+\frac {\sin \left (d x +c \right )}{2}-\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+\frac {3 a^{2} b}{\cos \left (d x +c \right )}+a^{3} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}\) \(146\)
default \(\frac {b^{3} \left (\frac {\sin \left (d x +c \right )^{4}}{3 \cos \left (d x +c \right )^{3}}-\frac {\sin \left (d x +c \right )^{4}}{3 \cos \left (d x +c \right )}-\frac {\left (2+\sin \left (d x +c \right )^{2}\right ) \cos \left (d x +c \right )}{3}\right )+3 a \,b^{2} \left (\frac {\sin \left (d x +c \right )^{3}}{2 \cos \left (d x +c \right )^{2}}+\frac {\sin \left (d x +c \right )}{2}-\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+\frac {3 a^{2} b}{\cos \left (d x +c \right )}+a^{3} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}\) \(146\)
risch \(-\frac {b \,{\mathrm e}^{i \left (d x +c \right )} \left (9 i a b \,{\mathrm e}^{4 i \left (d x +c \right )}-18 a^{2} {\mathrm e}^{4 i \left (d x +c \right )}+6 b^{2} {\mathrm e}^{4 i \left (d x +c \right )}-36 a^{2} {\mathrm e}^{2 i \left (d x +c \right )}+4 b^{2} {\mathrm e}^{2 i \left (d x +c \right )}-9 i a b -18 a^{2}+6 b^{2}\right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3}}+\frac {a^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{d}-\frac {3 a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) b^{2}}{2 d}-\frac {a^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{d}+\frac {3 a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) b^{2}}{2 d}\) \(213\)

Input:

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

Output:

1/d*(b^3*(1/3*sin(d*x+c)^4/cos(d*x+c)^3-1/3*sin(d*x+c)^4/cos(d*x+c)-1/3*(2 
+sin(d*x+c)^2)*cos(d*x+c))+3*a*b^2*(1/2*sin(d*x+c)^3/cos(d*x+c)^2+1/2*sin( 
d*x+c)-1/2*ln(sec(d*x+c)+tan(d*x+c)))+3*a^2*b/cos(d*x+c)+a^3*ln(sec(d*x+c) 
+tan(d*x+c)))
 

Fricas [A] (verification not implemented)

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

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

Output:

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

Sympy [F]

\[ \int \sec (c+d x) (a+b \tan (c+d x))^3 \, dx=\int \left (a + b \tan {\left (c + d x \right )}\right )^{3} \sec {\left (c + d x \right )}\, dx \] Input:

integrate(sec(d*x+c)*(a+b*tan(d*x+c))**3,x)
 

Output:

Integral((a + b*tan(c + d*x))**3*sec(c + d*x), x)
 

Maxima [A] (verification not implemented)

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

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

Output:

-1/12*(9*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)) - 12*a^3*log(sec(d*x + c) + tan(d*x + c)) - 36* 
a^2*b/cos(d*x + c) + 4*(3*cos(d*x + c)^2 - 1)*b^3/cos(d*x + c)^3)/d
 

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 171 vs. \(2 (84) = 168\).

Time = 0.28 (sec) , antiderivative size = 171, normalized size of antiderivative = 1.90 \[ \int \sec (c+d x) (a+b \tan (c+d x))^3 \, dx=\frac {3 \, {\left (2 \, a^{3} - 3 \, a b^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 3 \, {\left (2 \, a^{3} - 3 \, a b^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) + \frac {2 \, {\left (9 \, a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 18 \, a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} + 36 \, a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 12 \, b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 9 \, a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 18 \, a^{2} b + 4 \, b^{3}\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{3}}}{6 \, d} \] Input:

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

Output:

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

Mupad [B] (verification not implemented)

Time = 2.64 (sec) , antiderivative size = 160, normalized size of antiderivative = 1.78 \[ \int \sec (c+d x) (a+b \tan (c+d x))^3 \, dx=-\frac {\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,\left (3\,a\,b^2-2\,a^3\right )}{d}-\frac {6\,a^2\,b-{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\left (12\,a^2\,b-4\,b^3\right )-\frac {4\,b^3}{3}+3\,a\,b^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )+6\,a^2\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4-3\,a\,b^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6-3\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4+3\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-1\right )} \] Input:

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

Output:

- (atanh(tan(c/2 + (d*x)/2))*(3*a*b^2 - 2*a^3))/d - (6*a^2*b - tan(c/2 + ( 
d*x)/2)^2*(12*a^2*b - 4*b^3) - (4*b^3)/3 + 3*a*b^2*tan(c/2 + (d*x)/2) + 6* 
a^2*b*tan(c/2 + (d*x)/2)^4 - 3*a*b^2*tan(c/2 + (d*x)/2)^5)/(d*(3*tan(c/2 + 
 (d*x)/2)^2 - 3*tan(c/2 + (d*x)/2)^4 + tan(c/2 + (d*x)/2)^6 - 1))
 

Reduce [B] (verification not implemented)

Time = 0.18 (sec) , antiderivative size = 364, normalized size of antiderivative = 4.04 \[ \int \sec (c+d x) (a+b \tan (c+d x))^3 \, dx=\frac {-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^{3}+9 \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^{2}+6 \cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) a^{3}-9 \cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) a \,b^{2}+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^{3}-9 \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^{2}-6 \cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) a^{3}+9 \cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) a \,b^{2}-18 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{2} a^{2} b +4 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{2} b^{3}-9 \cos \left (d x +c \right ) \sin \left (d x +c \right ) a \,b^{2}+18 \cos \left (d x +c \right ) a^{2} b -4 \cos \left (d x +c \right ) b^{3}+18 \sin \left (d x +c \right )^{2} a^{2} b -6 \sin \left (d x +c \right )^{2} b^{3}-18 a^{2} b +4 b^{3}}{6 \cos \left (d x +c \right ) d \left (\sin \left (d x +c \right )^{2}-1\right )} \] Input:

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

Output:

( - 6*cos(c + d*x)*log(tan((c + d*x)/2) - 1)*sin(c + d*x)**2*a**3 + 9*cos( 
c + d*x)*log(tan((c + d*x)/2) - 1)*sin(c + d*x)**2*a*b**2 + 6*cos(c + d*x) 
*log(tan((c + d*x)/2) - 1)*a**3 - 9*cos(c + d*x)*log(tan((c + d*x)/2) - 1) 
*a*b**2 + 6*cos(c + d*x)*log(tan((c + d*x)/2) + 1)*sin(c + d*x)**2*a**3 - 
9*cos(c + d*x)*log(tan((c + d*x)/2) + 1)*sin(c + d*x)**2*a*b**2 - 6*cos(c 
+ d*x)*log(tan((c + d*x)/2) + 1)*a**3 + 9*cos(c + d*x)*log(tan((c + d*x)/2 
) + 1)*a*b**2 - 18*cos(c + d*x)*sin(c + d*x)**2*a**2*b + 4*cos(c + d*x)*si 
n(c + d*x)**2*b**3 - 9*cos(c + d*x)*sin(c + d*x)*a*b**2 + 18*cos(c + d*x)* 
a**2*b - 4*cos(c + d*x)*b**3 + 18*sin(c + d*x)**2*a**2*b - 6*sin(c + d*x)* 
*2*b**3 - 18*a**2*b + 4*b**3)/(6*cos(c + d*x)*d*(sin(c + d*x)**2 - 1))