3.706 \(\int \frac {\sec ^2(x) (2+\tan ^2(x))}{1+\tan ^3(x)} \, dx\)

Optimal. Leaf size=46 \[ \frac {2 x}{\sqrt {3}}+\log (\tan (x)+1)+\frac {2 \tan ^{-1}\left (\frac {1-2 \cos ^2(x)}{-2 \sin (x) \cos (x)+\sqrt {3}+2}\right )}{\sqrt {3}} \]

[Out]

ln(1+tan(x))+2/3*x*3^(1/2)+2/3*arctan((1-2*cos(x)^2)/(2-2*cos(x)*sin(x)+3^(1/2)))*3^(1/2)

________________________________________________________________________________________

Rubi [A]  time = 0.09, antiderivative size = 46, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.263, Rules used = {4342, 1863, 31, 618, 204} \[ \frac {2 x}{\sqrt {3}}+\log (\tan (x)+1)+\frac {2 \tan ^{-1}\left (\frac {1-2 \cos ^2(x)}{-2 \sin (x) \cos (x)+\sqrt {3}+2}\right )}{\sqrt {3}} \]

Antiderivative was successfully verified.

[In]

Int[(Sec[x]^2*(2 + Tan[x]^2))/(1 + Tan[x]^3),x]

[Out]

(2*x)/Sqrt[3] + (2*ArcTan[(1 - 2*Cos[x]^2)/(2 + Sqrt[3] - 2*Cos[x]*Sin[x])])/Sqrt[3] + Log[1 + Tan[x]]

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 204

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

Rule 618

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 1863

Int[(P2_)/((a_) + (b_.)*(x_)^3), x_Symbol] :> With[{A = Coeff[P2, x, 0], B = Coeff[P2, x, 1], C = Coeff[P2, x,
 2]}, With[{q = a^(1/3)/b^(1/3)}, Dist[C/b, Int[1/(q + x), x], x] + Dist[(B + C*q)/b, Int[1/(q^2 - q*x + x^2),
 x], x]] /; EqQ[A*b^(2/3) - a^(1/3)*b^(1/3)*B - 2*a^(2/3)*C, 0]] /; FreeQ[{a, b}, x] && PolyQ[P2, x, 2]

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) \left (2+\tan ^2(x)\right )}{1+\tan ^3(x)} \, dx &=\operatorname {Subst}\left (\int \frac {2+x^2}{1+x^3} \, dx,x,\tan (x)\right )\\ &=\operatorname {Subst}\left (\int \frac {1}{1+x} \, dx,x,\tan (x)\right )+\operatorname {Subst}\left (\int \frac {1}{1-x+x^2} \, dx,x,\tan (x)\right )\\ &=\log (1+\tan (x))-2 \operatorname {Subst}\left (\int \frac {1}{-3-x^2} \, dx,x,-1+2 \tan (x)\right )\\ &=\frac {2 x}{\sqrt {3}}+\frac {2 \tan ^{-1}\left (\frac {1-2 \cos ^2(x)}{2+\sqrt {3}-2 \cos (x) \sin (x)}\right )}{\sqrt {3}}+\log (1+\tan (x))\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.22, size = 32, normalized size = 0.70 \[ -\frac {2 \tan ^{-1}\left (\frac {1-2 \tan (x)}{\sqrt {3}}\right )}{\sqrt {3}}-\log (\cos (x))+\log (\sin (x)+\cos (x)) \]

Antiderivative was successfully verified.

[In]

Integrate[(Sec[x]^2*(2 + Tan[x]^2))/(1 + Tan[x]^3),x]

[Out]

(-2*ArcTan[(1 - 2*Tan[x])/Sqrt[3]])/Sqrt[3] - Log[Cos[x]] + Log[Cos[x] + Sin[x]]

________________________________________________________________________________________

fricas [A]  time = 2.51, size = 52, normalized size = 1.13 \[ \frac {1}{3} \, \sqrt {3} \arctan \left (\frac {4 \, \sqrt {3} \cos \relax (x) \sin \relax (x) - \sqrt {3}}{3 \, {\left (2 \, \cos \relax (x)^{2} - 1\right )}}\right ) - \frac {1}{2} \, \log \left (\cos \relax (x)^{2}\right ) + \frac {1}{2} \, \log \left (2 \, \cos \relax (x) \sin \relax (x) + 1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(x)^2*(2+tan(x)^2)/(1+tan(x)^3),x, algorithm="fricas")

[Out]

1/3*sqrt(3)*arctan(1/3*(4*sqrt(3)*cos(x)*sin(x) - sqrt(3))/(2*cos(x)^2 - 1)) - 1/2*log(cos(x)^2) + 1/2*log(2*c
os(x)*sin(x) + 1)

________________________________________________________________________________________

giac [A]  time = 0.16, size = 24, normalized size = 0.52 \[ \frac {2}{3} \, \sqrt {3} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, \tan \relax (x) - 1\right )}\right ) + \log \left ({\left | \tan \relax (x) + 1 \right |}\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(x)^2*(2+tan(x)^2)/(1+tan(x)^3),x, algorithm="giac")

[Out]

2/3*sqrt(3)*arctan(1/3*sqrt(3)*(2*tan(x) - 1)) + log(abs(tan(x) + 1))

________________________________________________________________________________________

maple [A]  time = 0.20, size = 24, normalized size = 0.52 \[ \frac {2 \sqrt {3}\, \arctan \left (\frac {\left (-1+2 \tan \relax (x )\right ) \sqrt {3}}{3}\right )}{3}+\ln \left (1+\tan \relax (x )\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sec(x)^2*(2+tan(x)^2)/(1+tan(x)^3),x)

[Out]

2/3*3^(1/2)*arctan(1/3*(-1+2*tan(x))*3^(1/2))+ln(1+tan(x))

________________________________________________________________________________________

maxima [A]  time = 0.41, size = 23, normalized size = 0.50 \[ \frac {2}{3} \, \sqrt {3} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, \tan \relax (x) - 1\right )}\right ) + \log \left (\tan \relax (x) + 1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(x)^2*(2+tan(x)^2)/(1+tan(x)^3),x, algorithm="maxima")

[Out]

2/3*sqrt(3)*arctan(1/3*sqrt(3)*(2*tan(x) - 1)) + log(tan(x) + 1)

________________________________________________________________________________________

mupad [B]  time = 2.97, size = 30, normalized size = 0.65 \[ \ln \left (\mathrm {tan}\relax (x)+1\right )-\frac {2\,\sqrt {3}\,\mathrm {atan}\left (\frac {\sqrt {3}-\sqrt {3}\,\mathrm {tan}\relax (x)}{\mathrm {tan}\relax (x)+1}\right )}{3} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((tan(x)^2 + 2)/(cos(x)^2*(tan(x)^3 + 1)),x)

[Out]

log(tan(x) + 1) - (2*3^(1/2)*atan((3^(1/2) - 3^(1/2)*tan(x))/(tan(x) + 1)))/3

________________________________________________________________________________________

sympy [A]  time = 9.25, size = 41, normalized size = 0.89 \[ \frac {2 \sqrt {3} \left (\operatorname {atan}{\left (\frac {2 \sqrt {3} \left (\tan {\relax (x )} - \frac {1}{2}\right )}{3} \right )} + \pi \left \lfloor {\frac {x - \frac {\pi }{2}}{\pi }}\right \rfloor \right )}{3} + \log {\left (\tan {\relax (x )} + 1 \right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(x)**2*(2+tan(x)**2)/(1+tan(x)**3),x)

[Out]

2*sqrt(3)*(atan(2*sqrt(3)*(tan(x) - 1/2)/3) + pi*floor((x - pi/2)/pi))/3 + log(tan(x) + 1)

________________________________________________________________________________________