\(\int \frac {\tanh ^2(x)}{i+\sinh (x)} \, dx\) [210]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 13, antiderivative size = 23 \[ \int \frac {\tanh ^2(x)}{i+\sinh (x)} \, dx=-\text {sech}(x)+\frac {\text {sech}^3(x)}{3}-\frac {1}{3} i \tanh ^3(x) \]

[Out]

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

Rubi [A] (verified)

Time = 0.05 (sec) , antiderivative size = 23, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.308, Rules used = {2785, 2687, 30, 2686} \[ \int \frac {\tanh ^2(x)}{i+\sinh (x)} \, dx=-\frac {1}{3} i \tanh ^3(x)+\frac {\text {sech}^3(x)}{3}-\text {sech}(x) \]

[In]

Int[Tanh[x]^2/(I + Sinh[x]),x]

[Out]

-Sech[x] + Sech[x]^3/3 - (I/3)*Tanh[x]^3

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rule 2686

Int[((a_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[a/f, Subst[
Int[(a*x)^(m - 1)*(-1 + x^2)^((n - 1)/2), x], x, Sec[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n -
1)/2] &&  !(IntegerQ[m/2] && LtQ[0, m, n + 1])

Rule 2687

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[1/f, Subst[Int[(b*x)
^n*(1 + x^2)^(m/2 - 1), x], x, Tan[e + f*x]], x] /; FreeQ[{b, e, f, n}, x] && IntegerQ[m/2] &&  !(IntegerQ[(n
- 1)/2] && LtQ[0, n, m - 1])

Rule 2785

Int[((g_.)*tan[(e_.) + (f_.)*(x_)])^(p_.)/((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Dist[1/a, Int[S
ec[e + f*x]^2*(g*Tan[e + f*x])^p, x], x] - Dist[1/(b*g), Int[Sec[e + f*x]*(g*Tan[e + f*x])^(p + 1), x], x] /;
FreeQ[{a, b, e, f, g, p}, x] && EqQ[a^2 - b^2, 0] && NeQ[p, -1]

Rubi steps \begin{align*} \text {integral}& = -\left (i \int \text {sech}^2(x) \tanh ^2(x) \, dx\right )+\int \text {sech}(x) \tanh ^3(x) \, dx \\ & = \text {Subst}\left (\int x^2 \, dx,x,i \tanh (x)\right )+\text {Subst}\left (\int \left (-1+x^2\right ) \, dx,x,\text {sech}(x)\right ) \\ & = -\text {sech}(x)+\frac {\text {sech}^3(x)}{3}-\frac {1}{3} i \tanh ^3(x) \\ \end{align*}

Mathematica [B] (verified)

Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(67\) vs. \(2(23)=46\).

Time = 0.09 (sec) , antiderivative size = 67, normalized size of antiderivative = 2.91 \[ \int \frac {\tanh ^2(x)}{i+\sinh (x)} \, dx=\frac {-3-\cosh (2 x)+\cosh (x) (5-5 i \sinh (x))+4 i \sinh (x)}{6 \left (\cosh \left (\frac {x}{2}\right )-i \sinh \left (\frac {x}{2}\right )\right )^3 \left (\cosh \left (\frac {x}{2}\right )+i \sinh \left (\frac {x}{2}\right )\right )} \]

[In]

Integrate[Tanh[x]^2/(I + Sinh[x]),x]

[Out]

(-3 - Cosh[2*x] + Cosh[x]*(5 - (5*I)*Sinh[x]) + (4*I)*Sinh[x])/(6*(Cosh[x/2] - I*Sinh[x/2])^3*(Cosh[x/2] + I*S
inh[x/2]))

Maple [A] (verified)

Time = 5.96 (sec) , antiderivative size = 37, normalized size of antiderivative = 1.61

method result size
risch \(-\frac {2 \left (3 i {\mathrm e}^{2 x}+3 \,{\mathrm e}^{3 x}+i-{\mathrm e}^{x}\right )}{3 \left ({\mathrm e}^{x}+i\right )^{3} \left ({\mathrm e}^{x}-i\right )}\) \(37\)
default \(\frac {i}{-2 i+2 \tanh \left (\frac {x}{2}\right )}-\frac {2 i}{3 \left (\tanh \left (\frac {x}{2}\right )+i\right )^{3}}-\frac {i}{2 \left (\tanh \left (\frac {x}{2}\right )+i\right )}+\frac {1}{\left (\tanh \left (\frac {x}{2}\right )+i\right )^{2}}\) \(47\)

[In]

int(tanh(x)^2/(I+sinh(x)),x,method=_RETURNVERBOSE)

[Out]

-2/3*(3*I*exp(x)^2+3*exp(x)^3+I-exp(x))/(exp(x)+I)^3/(exp(x)-I)

Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 38 vs. \(2 (17) = 34\).

Time = 0.33 (sec) , antiderivative size = 38, normalized size of antiderivative = 1.65 \[ \int \frac {\tanh ^2(x)}{i+\sinh (x)} \, dx=-\frac {2 \, {\left (3 \, e^{\left (3 \, x\right )} + 3 i \, e^{\left (2 \, x\right )} - e^{x} + i\right )}}{3 \, {\left (e^{\left (4 \, x\right )} + 2 i \, e^{\left (3 \, x\right )} + 2 i \, e^{x} - 1\right )}} \]

[In]

integrate(tanh(x)^2/(I+sinh(x)),x, algorithm="fricas")

[Out]

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

Sympy [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 46 vs. \(2 (17) = 34\).

Time = 0.07 (sec) , antiderivative size = 46, normalized size of antiderivative = 2.00 \[ \int \frac {\tanh ^2(x)}{i+\sinh (x)} \, dx=\frac {- 6 e^{3 x} - 6 i e^{2 x} + 2 e^{x} - 2 i}{3 e^{4 x} + 6 i e^{3 x} + 6 i e^{x} - 3} \]

[In]

integrate(tanh(x)**2/(I+sinh(x)),x)

[Out]

(-6*exp(3*x) - 6*I*exp(2*x) + 2*exp(x) - 2*I)/(3*exp(4*x) + 6*I*exp(3*x) + 6*I*exp(x) - 3)

Maxima [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 109 vs. \(2 (17) = 34\).

Time = 0.23 (sec) , antiderivative size = 109, normalized size of antiderivative = 4.74 \[ \int \frac {\tanh ^2(x)}{i+\sinh (x)} \, dx=\frac {2 \, e^{\left (-x\right )}}{-6 i \, e^{\left (-x\right )} - 6 i \, e^{\left (-3 \, x\right )} + 3 \, e^{\left (-4 \, x\right )} - 3} + \frac {6 i \, e^{\left (-2 \, x\right )}}{-6 i \, e^{\left (-x\right )} - 6 i \, e^{\left (-3 \, x\right )} + 3 \, e^{\left (-4 \, x\right )} - 3} - \frac {6 \, e^{\left (-3 \, x\right )}}{-6 i \, e^{\left (-x\right )} - 6 i \, e^{\left (-3 \, x\right )} + 3 \, e^{\left (-4 \, x\right )} - 3} + \frac {2 i}{-6 i \, e^{\left (-x\right )} - 6 i \, e^{\left (-3 \, x\right )} + 3 \, e^{\left (-4 \, x\right )} - 3} \]

[In]

integrate(tanh(x)^2/(I+sinh(x)),x, algorithm="maxima")

[Out]

2*e^(-x)/(-6*I*e^(-x) - 6*I*e^(-3*x) + 3*e^(-4*x) - 3) + 6*I*e^(-2*x)/(-6*I*e^(-x) - 6*I*e^(-3*x) + 3*e^(-4*x)
 - 3) - 6*e^(-3*x)/(-6*I*e^(-x) - 6*I*e^(-3*x) + 3*e^(-4*x) - 3) + 2*I/(-6*I*e^(-x) - 6*I*e^(-3*x) + 3*e^(-4*x
) - 3)

Giac [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 29, normalized size of antiderivative = 1.26 \[ \int \frac {\tanh ^2(x)}{i+\sinh (x)} \, dx=-\frac {1}{2 \, {\left (e^{x} - i\right )}} - \frac {9 \, e^{\left (2 \, x\right )} + 12 i \, e^{x} - 7}{6 \, {\left (e^{x} + i\right )}^{3}} \]

[In]

integrate(tanh(x)^2/(I+sinh(x)),x, algorithm="giac")

[Out]

-1/2/(e^x - I) - 1/6*(9*e^(2*x) + 12*I*e^x - 7)/(e^x + I)^3

Mupad [B] (verification not implemented)

Time = 1.40 (sec) , antiderivative size = 80, normalized size of antiderivative = 3.48 \[ \int \frac {\tanh ^2(x)}{i+\sinh (x)} \, dx=-\frac {\frac {{\mathrm {e}}^x}{2}+\frac {1}{6}{}\mathrm {i}}{{\mathrm {e}}^{2\,x}-1+{\mathrm {e}}^x\,2{}\mathrm {i}}-\frac {\frac {{\mathrm {e}}^{2\,x}}{2}-\frac {1}{2}+\frac {{\mathrm {e}}^x\,1{}\mathrm {i}}{3}}{{\mathrm {e}}^{2\,x}\,3{}\mathrm {i}+{\mathrm {e}}^{3\,x}-3\,{\mathrm {e}}^x-\mathrm {i}}-\frac {1}{2\,\left ({\mathrm {e}}^x-\mathrm {i}\right )}-\frac {1}{2\,\left ({\mathrm {e}}^x+1{}\mathrm {i}\right )} \]

[In]

int(tanh(x)^2/(sinh(x) + 1i),x)

[Out]

- (exp(x)/2 + 1i/6)/(exp(2*x) + exp(x)*2i - 1) - (exp(2*x)/2 + (exp(x)*1i)/3 - 1/2)/(exp(2*x)*3i + exp(3*x) -
3*exp(x) - 1i) - 1/(2*(exp(x) - 1i)) - 1/(2*(exp(x) + 1i))