\(\int \frac {\sec ^2(x) (a+b \tan (x))^3}{c+d \tan (x)} \, dx\) [703]

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

Optimal result

Integrand size = 21, antiderivative size = 78 \[ \int \frac {\sec ^2(x) (a+b \tan (x))^3}{c+d \tan (x)} \, dx=-\frac {(b c-a d)^3 \log (c+d \tan (x))}{d^4}+\frac {b (b c-a d)^2 \tan (x)}{d^3}-\frac {(b c-a d) (a+b \tan (x))^2}{2 d^2}+\frac {(a+b \tan (x))^3}{3 d} \]

[Out]

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

Rubi [A] (verified)

Time = 0.16 (sec) , antiderivative size = 78, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.095, Rules used = {4427, 45} \[ \int \frac {\sec ^2(x) (a+b \tan (x))^3}{c+d \tan (x)} \, dx=-\frac {(b c-a d)^3 \log (c+d \tan (x))}{d^4}+\frac {b \tan (x) (b c-a d)^2}{d^3}-\frac {(b c-a d) (a+b \tan (x))^2}{2 d^2}+\frac {(a+b \tan (x))^3}{3 d} \]

[In]

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

[Out]

-(((b*c - a*d)^3*Log[c + d*Tan[x]])/d^4) + (b*(b*c - a*d)^2*Tan[x])/d^3 - ((b*c - a*d)*(a + b*Tan[x])^2)/(2*d^
2) + (a + b*Tan[x])^3/(3*d)

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 4427

Int[(u_)*(F_)[(c_.)*((a_.) + (b_.)*(x_))]^2, x_Symbol] :> With[{d = FreeFactors[Tan[c*(a + b*x)], x]}, Dist[d/
(b*c), Subst[Int[SubstFor[1, Tan[c*(a + b*x)]/d, u, x], x], x, Tan[c*(a + b*x)]/d], x] /; FunctionOfQ[Tan[c*(a
 + b*x)]/d, u, x, True]] /; FreeQ[{a, b, c}, x] && NonsumQ[u] && (EqQ[F, Sec] || EqQ[F, sec])

Rubi steps \begin{align*} \text {integral}& = \text {Subst}\left (\int \frac {(a+b x)^3}{c+d x} \, dx,x,\tan (x)\right ) \\ & = \text {Subst}\left (\int \left (\frac {b (b c-a d)^2}{d^3}-\frac {b (b c-a d) (a+b x)}{d^2}+\frac {b (a+b x)^2}{d}+\frac {(-b c+a d)^3}{d^3 (c+d x)}\right ) \, dx,x,\tan (x)\right ) \\ & = -\frac {(b c-a d)^3 \log (c+d \tan (x))}{d^4}+\frac {b (b c-a d)^2 \tan (x)}{d^3}-\frac {(b c-a d) (a+b \tan (x))^2}{2 d^2}+\frac {(a+b \tan (x))^3}{3 d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.46 (sec) , antiderivative size = 122, normalized size of antiderivative = 1.56 \[ \int \frac {\sec ^2(x) (a+b \tan (x))^3}{c+d \tan (x)} \, dx=\frac {(c \cos (x)+d \sin (x)) (a+b \tan (x))^3 \left (-6 (b c-a d)^3 \cos ^2(x) \log (c+d \tan (x))+6 b^3 c^2 d \cos (x) \sin (x)+b d^2 \left (9 a (-b c+a d) \sin (2 x)+b \left (-3 b c+9 a d+2 b d \sin ^2(x) \tan (x)\right )\right )\right )}{6 d^4 (a \cos (x)+b \sin (x))^3 (c+d \tan (x))} \]

[In]

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

[Out]

((c*Cos[x] + d*Sin[x])*(a + b*Tan[x])^3*(-6*(b*c - a*d)^3*Cos[x]^2*Log[c + d*Tan[x]] + 6*b^3*c^2*d*Cos[x]*Sin[
x] + b*d^2*(9*a*(-(b*c) + a*d)*Sin[2*x] + b*(-3*b*c + 9*a*d + 2*b*d*Sin[x]^2*Tan[x]))))/(6*d^4*(a*Cos[x] + b*S
in[x])^3*(c + d*Tan[x]))

Maple [A] (verified)

Time = 3.90 (sec) , antiderivative size = 116, normalized size of antiderivative = 1.49

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

[In]

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

[Out]

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 201 vs. \(2 (74) = 148\).

Time = 0.30 (sec) , antiderivative size = 201, normalized size of antiderivative = 2.58 \[ \int \frac {\sec ^2(x) (a+b \tan (x))^3}{c+d \tan (x)} \, dx=-\frac {3 \, {\left (b^{3} c^{3} - 3 \, a b^{2} c^{2} d + 3 \, a^{2} b c d^{2} - a^{3} d^{3}\right )} \cos \left (x\right )^{3} \log \left (2 \, c d \cos \left (x\right ) \sin \left (x\right ) + {\left (c^{2} - d^{2}\right )} \cos \left (x\right )^{2} + d^{2}\right ) - 3 \, {\left (b^{3} c^{3} - 3 \, a b^{2} c^{2} d + 3 \, a^{2} b c d^{2} - a^{3} d^{3}\right )} \cos \left (x\right )^{3} \log \left (\cos \left (x\right )^{2}\right ) + 3 \, {\left (b^{3} c d^{2} - 3 \, a b^{2} d^{3}\right )} \cos \left (x\right ) - 2 \, {\left (b^{3} d^{3} + {\left (3 \, b^{3} c^{2} d - 9 \, a b^{2} c d^{2} + {\left (9 \, a^{2} b - b^{3}\right )} d^{3}\right )} \cos \left (x\right )^{2}\right )} \sin \left (x\right )}{6 \, d^{4} \cos \left (x\right )^{3}} \]

[In]

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

[Out]

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

Sympy [A] (verification not implemented)

Time = 2.84 (sec) , antiderivative size = 95, normalized size of antiderivative = 1.22 \[ \int \frac {\sec ^2(x) (a+b \tan (x))^3}{c+d \tan (x)} \, dx=\frac {b^{3} \tan ^{3}{\left (x \right )}}{3 d} + \frac {\left (3 a b^{2} d - b^{3} c\right ) \tan ^{2}{\left (x \right )}}{2 d^{2}} + \frac {\left (a d - b c\right )^{3} \left (\begin {cases} \frac {\tan {\left (x \right )}}{c} & \text {for}\: d = 0 \\\frac {\log {\left (c + d \tan {\left (x \right )} \right )}}{d} & \text {otherwise} \end {cases}\right )}{d^{3}} + \frac {\left (3 a^{2} b d^{2} - 3 a b^{2} c d + b^{3} c^{2}\right ) \tan {\left (x \right )}}{d^{3}} \]

[In]

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

[Out]

b**3*tan(x)**3/(3*d) + (3*a*b**2*d - b**3*c)*tan(x)**2/(2*d**2) + (a*d - b*c)**3*Piecewise((tan(x)/c, Eq(d, 0)
), (log(c + d*tan(x))/d, True))/d**3 + (3*a**2*b*d**2 - 3*a*b**2*c*d + b**3*c**2)*tan(x)/d**3

Maxima [A] (verification not implemented)

none

Time = 0.21 (sec) , antiderivative size = 118, normalized size of antiderivative = 1.51 \[ \int \frac {\sec ^2(x) (a+b \tan (x))^3}{c+d \tan (x)} \, dx=\frac {2 \, b^{3} d^{2} \tan \left (x\right )^{3} - 3 \, {\left (b^{3} c d - 3 \, a b^{2} d^{2}\right )} \tan \left (x\right )^{2} + 6 \, {\left (b^{3} c^{2} - 3 \, a b^{2} c d + 3 \, a^{2} b d^{2}\right )} \tan \left (x\right )}{6 \, d^{3}} - \frac {{\left (b^{3} c^{3} - 3 \, a b^{2} c^{2} d + 3 \, a^{2} b c d^{2} - a^{3} d^{3}\right )} \log \left (d \tan \left (x\right ) + c\right )}{d^{4}} \]

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 123, normalized size of antiderivative = 1.58 \[ \int \frac {\sec ^2(x) (a+b \tan (x))^3}{c+d \tan (x)} \, dx=\frac {2 \, b^{3} d^{2} \tan \left (x\right )^{3} - 3 \, b^{3} c d \tan \left (x\right )^{2} + 9 \, a b^{2} d^{2} \tan \left (x\right )^{2} + 6 \, b^{3} c^{2} \tan \left (x\right ) - 18 \, a b^{2} c d \tan \left (x\right ) + 18 \, a^{2} b d^{2} \tan \left (x\right )}{6 \, d^{3}} - \frac {{\left (b^{3} c^{3} - 3 \, a b^{2} c^{2} d + 3 \, a^{2} b c d^{2} - a^{3} d^{3}\right )} \log \left ({\left | d \tan \left (x\right ) + c \right |}\right )}{d^{4}} \]

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 28.90 (sec) , antiderivative size = 122, normalized size of antiderivative = 1.56 \[ \int \frac {\sec ^2(x) (a+b \tan (x))^3}{c+d \tan (x)} \, dx=\mathrm {tan}\left (x\right )\,\left (\frac {3\,a^2\,b}{d}-\frac {c\,\left (\frac {3\,a\,b^2}{d}-\frac {b^3\,c}{d^2}\right )}{d}\right )+{\mathrm {tan}\left (x\right )}^2\,\left (\frac {3\,a\,b^2}{2\,d}-\frac {b^3\,c}{2\,d^2}\right )+\frac {b^3\,{\mathrm {tan}\left (x\right )}^3}{3\,d}+\frac {\ln \left (c+d\,\mathrm {tan}\left (x\right )\right )\,\left (a^3\,d^3-3\,a^2\,b\,c\,d^2+3\,a\,b^2\,c^2\,d-b^3\,c^3\right )}{d^4} \]

[In]

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

[Out]

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