### 3.995 $$\int \frac{\text{sech}^2(x) (2+\tanh ^2(x))}{1+\tanh ^3(x)} \, dx$$

Optimal. Leaf size=26 $\log (\tanh (x)+1)-\frac{2 \tan ^{-1}\left (\frac{1-2 \tanh (x)}{\sqrt{3}}\right )}{\sqrt{3}}$

[Out]

(-2*ArcTan[(1 - 2*Tanh[x])/Sqrt[3]])/Sqrt[3] + Log[1 + Tanh[x]]

________________________________________________________________________________________

Rubi [A]  time = 0.0906898, antiderivative size = 26, 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} $\log (\tanh (x)+1)-\frac{2 \tan ^{-1}\left (\frac{1-2 \tanh (x)}{\sqrt{3}}\right )}{\sqrt{3}}$

Antiderivative was successfully veriﬁed.

[In]

Int[(Sech[x]^2*(2 + Tanh[x]^2))/(1 + Tanh[x]^3),x]

[Out]

(-2*ArcTan[(1 - 2*Tanh[x])/Sqrt[3]])/Sqrt[3] + Log[1 + Tanh[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{\text{sech}^2(x) \left (2+\tanh ^2(x)\right )}{1+\tanh ^3(x)} \, dx &=\operatorname{Subst}\left (\int \frac{2+x^2}{1+x^3} \, dx,x,\tanh (x)\right )\\ &=\operatorname{Subst}\left (\int \frac{1}{1+x} \, dx,x,\tanh (x)\right )+\operatorname{Subst}\left (\int \frac{1}{1-x+x^2} \, dx,x,\tanh (x)\right )\\ &=\log (1+\tanh (x))-2 \operatorname{Subst}\left (\int \frac{1}{-3-x^2} \, dx,x,-1+2 \tanh (x)\right )\\ &=-\frac{2 \tan ^{-1}\left (\frac{1-2 \tanh (x)}{\sqrt{3}}\right )}{\sqrt{3}}+\log (1+\tanh (x))\\ \end{align*}

Mathematica [A]  time = 0.218905, size = 27, normalized size = 1.04 $x+\frac{2 \tan ^{-1}\left (\frac{2 \tanh (x)-1}{\sqrt{3}}\right )}{\sqrt{3}}-\log (\cosh (x))$

Antiderivative was successfully veriﬁed.

[In]

Integrate[(Sech[x]^2*(2 + Tanh[x]^2))/(1 + Tanh[x]^3),x]

[Out]

x + (2*ArcTan[(-1 + 2*Tanh[x])/Sqrt[3]])/Sqrt[3] - Log[Cosh[x]]

________________________________________________________________________________________

Maple [C]  time = 0.075, size = 78, normalized size = 3. \begin{align*} 2\,\ln \left ( \tanh \left ( x/2 \right ) +1 \right ) +{\frac{i}{3}}\sqrt{3}\ln \left ( \left ( \tanh \left ({\frac{x}{2}} \right ) \right ) ^{2}+ \left ( -i\sqrt{3}-1 \right ) \tanh \left ({\frac{x}{2}} \right ) +1 \right ) -{\frac{i}{3}}\sqrt{3}\ln \left ( \left ( \tanh \left ({\frac{x}{2}} \right ) \right ) ^{2}+ \left ( i\sqrt{3}-1 \right ) \tanh \left ({\frac{x}{2}} \right ) +1 \right ) -\ln \left ( \left ( \tanh \left ({\frac{x}{2}} \right ) \right ) ^{2}+1 \right ) \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

int(sech(x)^2*(2+tanh(x)^2)/(1+tanh(x)^3),x)

[Out]

2*ln(tanh(1/2*x)+1)+1/3*I*3^(1/2)*ln(tanh(1/2*x)^2+(-I*3^(1/2)-1)*tanh(1/2*x)+1)-1/3*I*3^(1/2)*ln(tanh(1/2*x)^
2+(I*3^(1/2)-1)*tanh(1/2*x)+1)-ln(tanh(1/2*x)^2+1)

________________________________________________________________________________________

Maxima [B]  time = 1.62797, size = 165, normalized size = 6.35 \begin{align*} \frac{2}{3} \, \sqrt{3} \arctan \left (\frac{1}{6} \cdot 3^{\frac{3}{4}} \sqrt{2}{\left (2 \, \sqrt{3} e^{\left (-x\right )} + 3^{\frac{1}{4}} \sqrt{2}\right )}\right ) - \frac{2}{3} \, \sqrt{3} \arctan \left (\frac{1}{6} \cdot 3^{\frac{3}{4}} \sqrt{2}{\left (2 \, \sqrt{3} e^{\left (-x\right )} - 3^{\frac{1}{4}} \sqrt{2}\right )}\right ) + \frac{1}{3} \, \log \left (\tanh \left (x\right )^{3} + 1\right ) - \frac{1}{3} \, \log \left (3^{\frac{1}{4}} \sqrt{2} e^{\left (-x\right )} + \sqrt{3} e^{\left (-2 \, x\right )} + 1\right ) - \frac{1}{3} \, \log \left (-3^{\frac{1}{4}} \sqrt{2} e^{\left (-x\right )} + \sqrt{3} e^{\left (-2 \, x\right )} + 1\right ) \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

2/3*sqrt(3)*arctan(1/6*3^(3/4)*sqrt(2)*(2*sqrt(3)*e^(-x) + 3^(1/4)*sqrt(2))) - 2/3*sqrt(3)*arctan(1/6*3^(3/4)*
sqrt(2)*(2*sqrt(3)*e^(-x) - 3^(1/4)*sqrt(2))) + 1/3*log(tanh(x)^3 + 1) - 1/3*log(3^(1/4)*sqrt(2)*e^(-x) + sqrt
(3)*e^(-2*x) + 1) - 1/3*log(-3^(1/4)*sqrt(2)*e^(-x) + sqrt(3)*e^(-2*x) + 1)

________________________________________________________________________________________

Fricas [B]  time = 2.441, size = 170, normalized size = 6.54 \begin{align*} -\frac{2}{3} \, \sqrt{3} \arctan \left (-\frac{\sqrt{3} \cosh \left (x\right ) + \sqrt{3} \sinh \left (x\right )}{3 \,{\left (\cosh \left (x\right ) - \sinh \left (x\right )\right )}}\right ) + 2 \, x - \log \left (\frac{2 \, \cosh \left (x\right )}{\cosh \left (x\right ) - \sinh \left (x\right )}\right ) \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{\left (\tanh ^{2}{\left (x \right )} + 2\right ) \operatorname{sech}^{2}{\left (x \right )}}{\left (\tanh{\left (x \right )} + 1\right ) \left (\tanh ^{2}{\left (x \right )} - \tanh{\left (x \right )} + 1\right )}\, dx \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate(sech(x)**2*(2+tanh(x)**2)/(1+tanh(x)**3),x)

[Out]

Integral((tanh(x)**2 + 2)*sech(x)**2/((tanh(x) + 1)*(tanh(x)**2 - tanh(x) + 1)), x)

________________________________________________________________________________________

Giac [A]  time = 1.22031, size = 38, normalized size = 1.46 \begin{align*} \frac{2}{3} \, \sqrt{3} \arctan \left (\frac{1}{3} \, \sqrt{3} e^{\left (2 \, x\right )}\right ) + 2 \, x - \log \left (e^{\left (2 \, x\right )} + 1\right ) \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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