### 3.1044 $$\int \frac{1+\sinh ^2(x)}{1+\cosh (x)+\sinh (x)} \, dx$$

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

[Out]

Log[1 - Tanh[x/2]]/4 + (3*Log[1 + Tanh[x/2]])/4 + 1/(2*(1 - Tanh[x/2])) - 1/(2*(1 + Tanh[x/2])^2) + (1 + Tanh[
x/2])^(-1)

________________________________________________________________________________________

Rubi [A]  time = 0.200526, antiderivative size = 69, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 3, integrand size = 15, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.2, Rules used = {4397, 12, 894} $\frac{1}{2 \left (1-\tanh \left (\frac{x}{2}\right )\right )}+\frac{1}{\tanh \left (\frac{x}{2}\right )+1}-\frac{1}{2 \left (\tanh \left (\frac{x}{2}\right )+1\right )^2}+\frac{1}{4} \log \left (1-\tanh \left (\frac{x}{2}\right )\right )+\frac{3}{4} \log \left (\tanh \left (\frac{x}{2}\right )+1\right )$

Antiderivative was successfully veriﬁed.

[In]

Int[(1 + Sinh[x]^2)/(1 + Cosh[x] + Sinh[x]),x]

[Out]

Log[1 - Tanh[x/2]]/4 + (3*Log[1 + Tanh[x/2]])/4 + 1/(2*(1 - Tanh[x/2])) - 1/(2*(1 + Tanh[x/2])^2) + (1 + Tanh[
x/2])^(-1)

Rule 4397

Int[u_, x_Symbol] :> Int[TrigSimplify[u], x] /; TrigSimplifyQ[u]

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 894

Int[((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_))^(n_)*((a_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIn
tegrand[(d + e*x)^m*(f + g*x)^n*(a + c*x^2)^p, x], x] /; FreeQ[{a, c, d, e, f, g}, x] && NeQ[e*f - d*g, 0] &&
NeQ[c*d^2 + a*e^2, 0] && IntegerQ[p] && ((EqQ[p, 1] && IntegersQ[m, n]) || (ILtQ[m, 0] && ILtQ[n, 0]))

Rubi steps

\begin{align*} \int \frac{1+\sinh ^2(x)}{1+\cosh (x)+\sinh (x)} \, dx &=\int \frac{\cosh ^2(x)}{1+\cosh (x)+\sinh (x)} \, dx\\ &=2 \operatorname{Subst}\left (\int \frac{\left (1+x^2\right )^2}{2 (1-x)^2 (1+x)^3} \, dx,x,\tanh \left (\frac{x}{2}\right )\right )\\ &=\operatorname{Subst}\left (\int \frac{\left (1+x^2\right )^2}{(1-x)^2 (1+x)^3} \, dx,x,\tanh \left (\frac{x}{2}\right )\right )\\ &=\operatorname{Subst}\left (\int \left (\frac{1}{2 (-1+x)^2}+\frac{1}{4 (-1+x)}+\frac{1}{(1+x)^3}-\frac{1}{(1+x)^2}+\frac{3}{4 (1+x)}\right ) \, dx,x,\tanh \left (\frac{x}{2}\right )\right )\\ &=\frac{1}{4} \log \left (1-\tanh \left (\frac{x}{2}\right )\right )+\frac{3}{4} \log \left (1+\tanh \left (\frac{x}{2}\right )\right )+\frac{1}{2 \left (1-\tanh \left (\frac{x}{2}\right )\right )}-\frac{1}{2 \left (1+\tanh \left (\frac{x}{2}\right )\right )^2}+\frac{1}{1+\tanh \left (\frac{x}{2}\right )}\\ \end{align*}

Mathematica [A]  time = 0.0344364, size = 37, normalized size = 0.54 $\frac{x}{4}+\frac{1}{8} \sinh (2 x)+\frac{\cosh (x)}{2}-\frac{1}{8} \cosh (2 x)-\log \left (\cosh \left (\frac{x}{2}\right )\right )$

Antiderivative was successfully veriﬁed.

[In]

Integrate[(1 + Sinh[x]^2)/(1 + Cosh[x] + Sinh[x]),x]

[Out]

x/4 + Cosh[x]/2 - Cosh[2*x]/8 - Log[Cosh[x/2]] + Sinh[2*x]/8

________________________________________________________________________________________

Maple [A]  time = 0.039, size = 48, normalized size = 0.7 \begin{align*} -{\frac{1}{2} \left ( \tanh \left ({\frac{x}{2}} \right ) +1 \right ) ^{-2}}+ \left ( \tanh \left ({\frac{x}{2}} \right ) +1 \right ) ^{-1}+{\frac{3}{4}\ln \left ( \tanh \left ({\frac{x}{2}} \right ) +1 \right ) }-{\frac{1}{2} \left ( \tanh \left ({\frac{x}{2}} \right ) -1 \right ) ^{-1}}+{\frac{1}{4}\ln \left ( \tanh \left ({\frac{x}{2}} \right ) -1 \right ) } \end{align*}

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

[In]

int((1+sinh(x)^2)/(1+cosh(x)+sinh(x)),x)

[Out]

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

________________________________________________________________________________________

Maxima [A]  time = 1.05191, size = 39, normalized size = 0.57 \begin{align*} -\frac{1}{4} \, x + \frac{1}{4} \, e^{\left (-x\right )} - \frac{1}{8} \, e^{\left (-2 \, x\right )} + \frac{1}{4} \, e^{x} - \log \left (e^{\left (-x\right )} + 1\right ) \end{align*}

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

[In]

integrate((1+sinh(x)^2)/(1+cosh(x)+sinh(x)),x, algorithm="maxima")

[Out]

-1/4*x + 1/4*e^(-x) - 1/8*e^(-2*x) + 1/4*e^x - log(e^(-x) + 1)

________________________________________________________________________________________

Fricas [A]  time = 2.03597, size = 346, normalized size = 5.01 \begin{align*} \frac{6 \, x \cosh \left (x\right )^{2} + 2 \, \cosh \left (x\right )^{3} + 6 \,{\left (x + \cosh \left (x\right )\right )} \sinh \left (x\right )^{2} + 2 \, \sinh \left (x\right )^{3} - 8 \,{\left (\cosh \left (x\right )^{2} + 2 \, \cosh \left (x\right ) \sinh \left (x\right ) + \sinh \left (x\right )^{2}\right )} \log \left (\cosh \left (x\right ) + \sinh \left (x\right ) + 1\right ) + 2 \,{\left (6 \, x \cosh \left (x\right ) + 3 \, \cosh \left (x\right )^{2} + 1\right )} \sinh \left (x\right ) + 2 \, \cosh \left (x\right ) - 1}{8 \,{\left (\cosh \left (x\right )^{2} + 2 \, \cosh \left (x\right ) \sinh \left (x\right ) + \sinh \left (x\right )^{2}\right )}} \end{align*}

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

[In]

integrate((1+sinh(x)^2)/(1+cosh(x)+sinh(x)),x, algorithm="fricas")

[Out]

1/8*(6*x*cosh(x)^2 + 2*cosh(x)^3 + 6*(x + cosh(x))*sinh(x)^2 + 2*sinh(x)^3 - 8*(cosh(x)^2 + 2*cosh(x)*sinh(x)
+ sinh(x)^2)*log(cosh(x) + sinh(x) + 1) + 2*(6*x*cosh(x) + 3*cosh(x)^2 + 1)*sinh(x) + 2*cosh(x) - 1)/(cosh(x)^
2 + 2*cosh(x)*sinh(x) + sinh(x)^2)

________________________________________________________________________________________

Sympy [B]  time = 1.41054, size = 382, normalized size = 5.54 \begin{align*} - \frac{x \tanh ^{3}{\left (\frac{x}{2} \right )}}{4 \tanh ^{3}{\left (\frac{x}{2} \right )} + 4 \tanh ^{2}{\left (\frac{x}{2} \right )} - 4 \tanh{\left (\frac{x}{2} \right )} - 4} - \frac{x \tanh ^{2}{\left (\frac{x}{2} \right )}}{4 \tanh ^{3}{\left (\frac{x}{2} \right )} + 4 \tanh ^{2}{\left (\frac{x}{2} \right )} - 4 \tanh{\left (\frac{x}{2} \right )} - 4} + \frac{x \tanh{\left (\frac{x}{2} \right )}}{4 \tanh ^{3}{\left (\frac{x}{2} \right )} + 4 \tanh ^{2}{\left (\frac{x}{2} \right )} - 4 \tanh{\left (\frac{x}{2} \right )} - 4} + \frac{x}{4 \tanh ^{3}{\left (\frac{x}{2} \right )} + 4 \tanh ^{2}{\left (\frac{x}{2} \right )} - 4 \tanh{\left (\frac{x}{2} \right )} - 4} + \frac{4 \log{\left (\tanh{\left (\frac{x}{2} \right )} + 1 \right )} \tanh ^{3}{\left (\frac{x}{2} \right )}}{4 \tanh ^{3}{\left (\frac{x}{2} \right )} + 4 \tanh ^{2}{\left (\frac{x}{2} \right )} - 4 \tanh{\left (\frac{x}{2} \right )} - 4} + \frac{4 \log{\left (\tanh{\left (\frac{x}{2} \right )} + 1 \right )} \tanh ^{2}{\left (\frac{x}{2} \right )}}{4 \tanh ^{3}{\left (\frac{x}{2} \right )} + 4 \tanh ^{2}{\left (\frac{x}{2} \right )} - 4 \tanh{\left (\frac{x}{2} \right )} - 4} - \frac{4 \log{\left (\tanh{\left (\frac{x}{2} \right )} + 1 \right )} \tanh{\left (\frac{x}{2} \right )}}{4 \tanh ^{3}{\left (\frac{x}{2} \right )} + 4 \tanh ^{2}{\left (\frac{x}{2} \right )} - 4 \tanh{\left (\frac{x}{2} \right )} - 4} - \frac{4 \log{\left (\tanh{\left (\frac{x}{2} \right )} + 1 \right )}}{4 \tanh ^{3}{\left (\frac{x}{2} \right )} + 4 \tanh ^{2}{\left (\frac{x}{2} \right )} - 4 \tanh{\left (\frac{x}{2} \right )} - 4} - \frac{6 \tanh ^{3}{\left (\frac{x}{2} \right )}}{4 \tanh ^{3}{\left (\frac{x}{2} \right )} + 4 \tanh ^{2}{\left (\frac{x}{2} \right )} - 4 \tanh{\left (\frac{x}{2} \right )} - 4} - \frac{4 \tanh ^{2}{\left (\frac{x}{2} \right )}}{4 \tanh ^{3}{\left (\frac{x}{2} \right )} + 4 \tanh ^{2}{\left (\frac{x}{2} \right )} - 4 \tanh{\left (\frac{x}{2} \right )} - 4} + \frac{2}{4 \tanh ^{3}{\left (\frac{x}{2} \right )} + 4 \tanh ^{2}{\left (\frac{x}{2} \right )} - 4 \tanh{\left (\frac{x}{2} \right )} - 4} \end{align*}

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

[In]

integrate((1+sinh(x)**2)/(1+cosh(x)+sinh(x)),x)

[Out]

-x*tanh(x/2)**3/(4*tanh(x/2)**3 + 4*tanh(x/2)**2 - 4*tanh(x/2) - 4) - x*tanh(x/2)**2/(4*tanh(x/2)**3 + 4*tanh(
x/2)**2 - 4*tanh(x/2) - 4) + x*tanh(x/2)/(4*tanh(x/2)**3 + 4*tanh(x/2)**2 - 4*tanh(x/2) - 4) + x/(4*tanh(x/2)*
*3 + 4*tanh(x/2)**2 - 4*tanh(x/2) - 4) + 4*log(tanh(x/2) + 1)*tanh(x/2)**3/(4*tanh(x/2)**3 + 4*tanh(x/2)**2 -
4*tanh(x/2) - 4) + 4*log(tanh(x/2) + 1)*tanh(x/2)**2/(4*tanh(x/2)**3 + 4*tanh(x/2)**2 - 4*tanh(x/2) - 4) - 4*l
og(tanh(x/2) + 1)*tanh(x/2)/(4*tanh(x/2)**3 + 4*tanh(x/2)**2 - 4*tanh(x/2) - 4) - 4*log(tanh(x/2) + 1)/(4*tanh
(x/2)**3 + 4*tanh(x/2)**2 - 4*tanh(x/2) - 4) - 6*tanh(x/2)**3/(4*tanh(x/2)**3 + 4*tanh(x/2)**2 - 4*tanh(x/2) -
4) - 4*tanh(x/2)**2/(4*tanh(x/2)**3 + 4*tanh(x/2)**2 - 4*tanh(x/2) - 4) + 2/(4*tanh(x/2)**3 + 4*tanh(x/2)**2
- 4*tanh(x/2) - 4)

________________________________________________________________________________________

Giac [A]  time = 1.12233, size = 36, normalized size = 0.52 \begin{align*} \frac{1}{8} \,{\left (2 \, e^{x} - 1\right )} e^{\left (-2 \, x\right )} + \frac{3}{4} \, x + \frac{1}{4} \, e^{x} - \log \left (e^{x} + 1\right ) \end{align*}

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

[In]

integrate((1+sinh(x)^2)/(1+cosh(x)+sinh(x)),x, algorithm="giac")

[Out]

1/8*(2*e^x - 1)*e^(-2*x) + 3/4*x + 1/4*e^x - log(e^x + 1)