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]

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

________________________________________________________________________________________

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

Antiderivative was successfully verified.

[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 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 {\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.22, 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 verified.

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

________________________________________________________________________________________

fricas [B]  time = 0.44, size = 50, normalized size = 1.92 \[ -\frac {2}{3} \, \sqrt {3} \arctan \left (-\frac {\sqrt {3} \cosh \relax (x) + \sqrt {3} \sinh \relax (x)}{3 \, {\left (\cosh \relax (x) - \sinh \relax (x)\right )}}\right ) + 2 \, x - \log \left (\frac {2 \, \cosh \relax (x)}{\cosh \relax (x) - \sinh \relax (x)}\right ) \]

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

________________________________________________________________________________________

giac [A]  time = 0.14, size = 28, normalized size = 1.08 \[ \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 ) \]

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

________________________________________________________________________________________

maple [C]  time = 0.26, size = 78, normalized size = 3.00 \[ \frac {i \sqrt {3}\, \ln \left (\tanh ^{2}\left (\frac {x}{2}\right )+\left (-i \sqrt {3}-1\right ) \tanh \left (\frac {x}{2}\right )+1\right )}{3}-\frac {i \sqrt {3}\, \ln \left (\tanh ^{2}\left (\frac {x}{2}\right )+\left (i \sqrt {3}-1\right ) \tanh \left (\frac {x}{2}\right )+1\right )}{3}+2 \ln \left (\tanh \left (\frac {x}{2}\right )+1\right )-\ln \left (\tanh ^{2}\left (\frac {x}{2}\right )+1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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)+2*ln(tanh(1/2*x)+1)-ln(tanh(1/2*x)^2+1)

________________________________________________________________________________________

maxima [B]  time = 0.41, size = 122, normalized size = 4.69 \[ \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 \relax (x)^{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 ) \]

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

________________________________________________________________________________________

mupad [B]  time = 0.50, size = 47, normalized size = 1.81 \[ 2\,x-\ln \left (768\,{\mathrm {e}}^{2\,x}+768\right )-\frac {2\,\sqrt {3}\,\mathrm {atan}\left (\frac {\frac {640\,\sqrt {3}}{3}-\frac {128\,\sqrt {3}\,{\mathrm {e}}^{2\,x}}{3}}{\frac {640\,{\mathrm {e}}^{2\,x}}{3}+128}\right )}{3} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

2*x - log(768*exp(2*x) + 768) - (2*3^(1/2)*atan(((640*3^(1/2))/3 - (128*3^(1/2)*exp(2*x))/3)/((640*exp(2*x))/3
 + 128)))/3

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {\left (\tanh ^{2}{\relax (x )} + 2\right ) \operatorname {sech}^{2}{\relax (x )}}{\left (\tanh {\relax (x )} + 1\right ) \left (\tanh ^{2}{\relax (x )} - \tanh {\relax (x )} + 1\right )}\, dx \]

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

________________________________________________________________________________________