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

Optimal. Leaf size=78 \[ -\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} \]

[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]  time = 0.15, antiderivative size = 78, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.095, Rules used = {4342, 43} \[ \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 {(b c-a d)^3 \log (c+d \tan (x))}{d^4}+\frac {(a+b \tan (x))^3}{3 d} \]

Antiderivative was successfully verified.

[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 43

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 4342

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*} \int \frac {\sec ^2(x) (a+b \tan (x))^3}{c+d \tan (x)} \, dx &=\operatorname {Subst}\left (\int \frac {(a+b x)^3}{c+d x} \, dx,x,\tan (x)\right )\\ &=\operatorname {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]  time = 0.96, size = 133, normalized size = 1.71 \[ \frac {(a+b \tan (x))^3 (c \cos (x)+d \sin (x)) \left (b d^2 (9 a \sin (2 x) (a d-b c)+b (9 a d-3 b c+2 b d \tan (x)))+6 \cos ^2(x) (b c-a d)^3 (\log (\cos (x))-\log (c \cos (x)+d \sin (x)))+b^3 (-d) \left (d^2-3 c^2\right ) \sin (2 x)\right )}{6 d^4 (c+d \tan (x)) (a \cos (x)+b \sin (x))^3} \]

Antiderivative was successfully verified.

[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[Cos[x]] - Log[c*Cos[x] + d*Sin[x]]) - b
^3*d*(-3*c^2 + d^2)*Sin[2*x] + b*d^2*(9*a*(-(b*c) + a*d)*Sin[2*x] + b*(-3*b*c + 9*a*d + 2*b*d*Tan[x]))))/(6*d^
4*(a*Cos[x] + b*Sin[x])^3*(c + d*Tan[x]))

________________________________________________________________________________________

fricas [B]  time = 2.11, size = 201, normalized size = 2.58 \[ -\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 \relax (x)^{3} \log \left (2 \, c d \cos \relax (x) \sin \relax (x) + {\left (c^{2} - d^{2}\right )} \cos \relax (x)^{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 \relax (x)^{3} \log \left (\cos \relax (x)^{2}\right ) + 3 \, {\left (b^{3} c d^{2} - 3 \, a b^{2} d^{3}\right )} \cos \relax (x) - 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 \relax (x)^{2}\right )} \sin \relax (x)}{6 \, d^{4} \cos \relax (x)^{3}} \]

Verification of antiderivative is not currently implemented for this CAS.

[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)

________________________________________________________________________________________

giac [A]  time = 0.15, size = 123, normalized size = 1.58 \[ \frac {2 \, b^{3} d^{2} \tan \relax (x)^{3} - 3 \, b^{3} c d \tan \relax (x)^{2} + 9 \, a b^{2} d^{2} \tan \relax (x)^{2} + 6 \, b^{3} c^{2} \tan \relax (x) - 18 \, a b^{2} c d \tan \relax (x) + 18 \, a^{2} b d^{2} \tan \relax (x)}{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 \relax (x) + c \right |}\right )}{d^{4}} \]

Verification of antiderivative is not currently implemented for this CAS.

[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

________________________________________________________________________________________

maple [A]  time = 0.16, size = 143, normalized size = 1.83 \[ \frac {b^{3} \left (\tan ^{3}\relax (x )\right )}{3 d}+\frac {3 b^{2} \left (\tan ^{2}\relax (x )\right ) a}{2 d}-\frac {b^{3} \left (\tan ^{2}\relax (x )\right ) c}{2 d^{2}}+\frac {3 b \,a^{2} \tan \relax (x )}{d}-\frac {3 b^{2} a c \tan \relax (x )}{d^{2}}+\frac {b^{3} c^{2} \tan \relax (x )}{d^{3}}+\frac {\ln \left (c +d \tan \relax (x )\right ) a^{3}}{d}-\frac {3 \ln \left (c +d \tan \relax (x )\right ) a^{2} b c}{d^{2}}+\frac {3 \ln \left (c +d \tan \relax (x )\right ) a \,b^{2} c^{2}}{d^{3}}-\frac {\ln \left (c +d \tan \relax (x )\right ) b^{3} c^{3}}{d^{4}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maxima [A]  time = 0.52, size = 118, normalized size = 1.51 \[ \frac {2 \, b^{3} d^{2} \tan \relax (x)^{3} - 3 \, {\left (b^{3} c d - 3 \, a b^{2} d^{2}\right )} \tan \relax (x)^{2} + 6 \, {\left (b^{3} c^{2} - 3 \, a b^{2} c d + 3 \, a^{2} b d^{2}\right )} \tan \relax (x)}{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 \relax (x) + c\right )}{d^{4}} \]

Verification of antiderivative is not currently implemented for this CAS.

[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

________________________________________________________________________________________

mupad [B]  time = 2.96, size = 122, normalized size = 1.56 \[ \mathrm {tan}\relax (x)\,\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}\relax (x)}^2\,\left (\frac {3\,a\,b^2}{2\,d}-\frac {b^3\,c}{2\,d^2}\right )+\frac {b^3\,{\mathrm {tan}\relax (x)}^3}{3\,d}+\frac {\ln \left (c+d\,\mathrm {tan}\relax (x)\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} \]

Verification of antiderivative is not currently implemented for this CAS.

[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

________________________________________________________________________________________

sympy [A]  time = 10.57, size = 95, normalized size = 1.22 \[ \frac {b^{3} \tan ^{3}{\relax (x )}}{3 d} + \frac {\left (3 a b^{2} d - b^{3} c\right ) \tan ^{2}{\relax (x )}}{2 d^{2}} + \frac {\left (a d - b c\right )^{3} \left (\begin {cases} \frac {\tan {\relax (x )}}{c} & \text {for}\: d = 0 \\\frac {\log {\left (c + d \tan {\relax (x )} \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 {\relax (x )}}{d^{3}} \]

Verification of antiderivative is not currently implemented for this CAS.

[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

________________________________________________________________________________________