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]

(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]]

________________________________________________________________________________________

Rubi [A]  time = 0.0887961, antiderivative size = 46, normalized size of antiderivative = 1., 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 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])

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 31

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

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

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.227092, size = 32, normalized size = 0.7 \[ -\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]]

________________________________________________________________________________________

Maple [A]  time = 0.108, size = 24, normalized size = 0.5 \begin{align*} \ln \left ( 1+\tan \left ( x \right ) \right ) +{\frac{2\,\sqrt{3}}{3}\arctan \left ({\frac{ \left ( -1+2\,\tan \left ( x \right ) \right ) \sqrt{3}}{3}} \right ) } \end{align*}

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]

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

________________________________________________________________________________________

Maxima [A]  time = 1.46102, size = 31, normalized size = 0.67 \begin{align*} \frac{2}{3} \, \sqrt{3} \arctan \left (\frac{1}{3} \, \sqrt{3}{\left (2 \, \tan \left (x\right ) - 1\right )}\right ) + \log \left (\tan \left (x\right ) + 1\right ) \end{align*}

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)

________________________________________________________________________________________

Fricas [A]  time = 2.40297, size = 174, normalized size = 3.78 \begin{align*} \frac{1}{3} \, \sqrt{3} \arctan \left (\frac{4 \, \sqrt{3} \cos \left (x\right ) \sin \left (x\right ) - \sqrt{3}}{3 \,{\left (2 \, \cos \left (x\right )^{2} - 1\right )}}\right ) - \frac{1}{2} \, \log \left (\cos \left (x\right )^{2}\right ) + \frac{1}{2} \, \log \left (2 \, \cos \left (x\right ) \sin \left (x\right ) + 1\right ) \end{align*}

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)

________________________________________________________________________________________

Sympy [A]  time = 8.21175, size = 41, normalized size = 0.89 \begin{align*} \frac{2 \sqrt{3} \left (\operatorname{atan}{\left (\frac{2 \sqrt{3} \left (\tan{\left (x \right )} - \frac{1}{2}\right )}{3} \right )} + \pi \left \lfloor{\frac{x - \frac{\pi }{2}}{\pi }}\right \rfloor \right )}{3} + \log{\left (\tan{\left (x \right )} + 1 \right )} \end{align*}

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)

________________________________________________________________________________________

Giac [A]  time = 1.10334, size = 32, normalized size = 0.7 \begin{align*} \frac{2}{3} \, \sqrt{3} \arctan \left (\frac{1}{3} \, \sqrt{3}{\left (2 \, \tan \left (x\right ) - 1\right )}\right ) + \log \left ({\left | \tan \left (x\right ) + 1 \right |}\right ) \end{align*}

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