\(\int \frac {1}{\cosh ^2(x)+\sinh ^2(x)} \, dx\) [808]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [C] (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 = 11, antiderivative size = 3 \[ \int \frac {1}{\cosh ^2(x)+\sinh ^2(x)} \, dx=\arctan (\tanh (x)) \]

[Out]

arctan(tanh(x))

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 3, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 1, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.091, Rules used = {209} \[ \int \frac {1}{\cosh ^2(x)+\sinh ^2(x)} \, dx=\arctan (\tanh (x)) \]

[In]

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

[Out]

ArcTan[Tanh[x]]

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

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

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(9\) vs. \(2(3)=6\).

Time = 0.00 (sec) , antiderivative size = 9, normalized size of antiderivative = 3.00 \[ \int \frac {1}{\cosh ^2(x)+\sinh ^2(x)} \, dx=\frac {1}{2} \arctan (\sinh (2 x)) \]

[In]

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

[Out]

ArcTan[Sinh[2*x]]/2

Maple [C] (verified)

Result contains complex when optimal does not.

Time = 1.05 (sec) , antiderivative size = 24, normalized size of antiderivative = 8.00

method result size
risch \(\frac {i \ln \left ({\mathrm e}^{2 x}+i\right )}{2}-\frac {i \ln \left ({\mathrm e}^{2 x}-i\right )}{2}\) \(24\)
default \(-\frac {\sqrt {2}\, \left (2+\sqrt {2}\right ) \arctan \left (\frac {2 \tanh \left (\frac {x}{2}\right )}{2+2 \sqrt {2}}\right )}{2+2 \sqrt {2}}-\frac {\left (-2+\sqrt {2}\right ) \sqrt {2}\, \arctan \left (\frac {2 \tanh \left (\frac {x}{2}\right )}{2 \sqrt {2}-2}\right )}{2 \sqrt {2}-2}\) \(72\)

[In]

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

[Out]

1/2*I*ln(exp(2*x)+I)-1/2*I*ln(exp(2*x)-I)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 19 vs. \(2 (3) = 6\).

Time = 0.26 (sec) , antiderivative size = 19, normalized size of antiderivative = 6.33 \[ \int \frac {1}{\cosh ^2(x)+\sinh ^2(x)} \, dx=-\arctan \left (-\frac {\cosh \left (x\right ) + \sinh \left (x\right )}{\cosh \left (x\right ) - \sinh \left (x\right )}\right ) \]

[In]

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

[Out]

-arctan(-(cosh(x) + sinh(x))/(cosh(x) - sinh(x)))

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 172 vs. \(2 (3) = 6\).

Time = 3.77 (sec) , antiderivative size = 172, normalized size of antiderivative = 57.33 \[ \int \frac {1}{\cosh ^2(x)+\sinh ^2(x)} \, dx=\frac {47321 \sqrt {3 - 2 \sqrt {2}} \operatorname {atan}{\left (\frac {\tanh {\left (\frac {x}{2} \right )}}{\sqrt {3 - 2 \sqrt {2}}} \right )}}{13860 \sqrt {2} + 19601} + \frac {33461 \sqrt {2} \sqrt {3 - 2 \sqrt {2}} \operatorname {atan}{\left (\frac {\tanh {\left (\frac {x}{2} \right )}}{\sqrt {3 - 2 \sqrt {2}}} \right )}}{13860 \sqrt {2} + 19601} - \frac {5741 \sqrt {2} \sqrt {2 \sqrt {2} + 3} \operatorname {atan}{\left (\frac {\tanh {\left (\frac {x}{2} \right )}}{\sqrt {2 \sqrt {2} + 3}} \right )}}{13860 \sqrt {2} + 19601} - \frac {8119 \sqrt {2 \sqrt {2} + 3} \operatorname {atan}{\left (\frac {\tanh {\left (\frac {x}{2} \right )}}{\sqrt {2 \sqrt {2} + 3}} \right )}}{13860 \sqrt {2} + 19601} \]

[In]

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

[Out]

47321*sqrt(3 - 2*sqrt(2))*atan(tanh(x/2)/sqrt(3 - 2*sqrt(2)))/(13860*sqrt(2) + 19601) + 33461*sqrt(2)*sqrt(3 -
 2*sqrt(2))*atan(tanh(x/2)/sqrt(3 - 2*sqrt(2)))/(13860*sqrt(2) + 19601) - 5741*sqrt(2)*sqrt(2*sqrt(2) + 3)*ata
n(tanh(x/2)/sqrt(2*sqrt(2) + 3))/(13860*sqrt(2) + 19601) - 8119*sqrt(2*sqrt(2) + 3)*atan(tanh(x/2)/sqrt(2*sqrt
(2) + 3))/(13860*sqrt(2) + 19601)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 35 vs. \(2 (3) = 6\).

Time = 0.28 (sec) , antiderivative size = 35, normalized size of antiderivative = 11.67 \[ \int \frac {1}{\cosh ^2(x)+\sinh ^2(x)} \, dx=\arctan \left (\frac {1}{2} \, \sqrt {2} {\left (\sqrt {2} + 2 \, e^{\left (-x\right )}\right )}\right ) - \arctan \left (-\frac {1}{2} \, \sqrt {2} {\left (\sqrt {2} - 2 \, e^{\left (-x\right )}\right )}\right ) \]

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 5, normalized size of antiderivative = 1.67 \[ \int \frac {1}{\cosh ^2(x)+\sinh ^2(x)} \, dx=\arctan \left (e^{\left (2 \, x\right )}\right ) \]

[In]

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

[Out]

arctan(e^(2*x))

Mupad [B] (verification not implemented)

Time = 0.05 (sec) , antiderivative size = 5, normalized size of antiderivative = 1.67 \[ \int \frac {1}{\cosh ^2(x)+\sinh ^2(x)} \, dx=\mathrm {atan}\left ({\mathrm {e}}^{2\,x}\right ) \]

[In]

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

[Out]

atan(exp(2*x))