3.11.54 \(\int \frac {\cosh ^2(a+b x)-\sinh ^2(a+b x)}{\cosh ^2(a+b x)+\sinh ^2(a+b x)} \, dx\) [1054]

Optimal. Leaf size=11 \[ \frac {\text {ArcTan}(\tanh (a+b x))}{b} \]

[Out]

arctan(tanh(b*x+a))/b

________________________________________________________________________________________

Rubi [A]
time = 0.04, antiderivative size = 11, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 39, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.051, Rules used = {4465, 209} \begin {gather*} \frac {\text {ArcTan}(\tanh (a+b x))}{b} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(Cosh[a + b*x]^2 - Sinh[a + b*x]^2)/(Cosh[a + b*x]^2 + Sinh[a + b*x]^2),x]

[Out]

ArcTan[Tanh[a + b*x]]/b

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

Rule 4465

Int[(u_.)*((a_.) + cos[(d_.) + (e_.)*(x_)]^2*(b_.) + (c_.)*sin[(d_.) + (e_.)*(x_)]^2)^(p_.), x_Symbol] :> Dist
[(a + c)^p, Int[ActivateTrig[u], x], x] /; FreeQ[{a, b, c, d, e, p}, x] && EqQ[b - c, 0]

Rubi steps

\begin {align*} \int \frac {\cosh ^2(a+b x)-\sinh ^2(a+b x)}{\cosh ^2(a+b x)+\sinh ^2(a+b x)} \, dx &=\int \frac {1}{\cosh ^2(a+b x)+\sinh ^2(a+b x)} \, dx\\ &=\frac {\text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tanh (a+b x)\right )}{b}\\ &=\frac {\tan ^{-1}(\tanh (a+b x))}{b}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.00, size = 17, normalized size = 1.55 \begin {gather*} \frac {\text {ArcTan}(\sinh (2 a+2 b x))}{2 b} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(Cosh[a + b*x]^2 - Sinh[a + b*x]^2)/(Cosh[a + b*x]^2 + Sinh[a + b*x]^2),x]

[Out]

ArcTan[Sinh[2*a + 2*b*x]]/(2*b)

________________________________________________________________________________________

Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(85\) vs. \(2(11)=22\).
time = 4.54, size = 86, normalized size = 7.82

method result size
risch \(\frac {i \ln \left ({\mathrm e}^{2 b x +2 a}+i\right )}{2 b}-\frac {i \ln \left ({\mathrm e}^{2 b x +2 a}-i\right )}{2 b}\) \(40\)
derivativedivides \(\frac {-\frac {\left (-2+\sqrt {2}\right ) \sqrt {2}\, \arctan \left (\frac {2 \tanh \left (\frac {b x}{2}+\frac {a}{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 {b x}{2}+\frac {a}{2}\right )}{2+2 \sqrt {2}}\right )}{2+2 \sqrt {2}}}{b}\) \(86\)
default \(\frac {-\frac {\left (-2+\sqrt {2}\right ) \sqrt {2}\, \arctan \left (\frac {2 \tanh \left (\frac {b x}{2}+\frac {a}{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 {b x}{2}+\frac {a}{2}\right )}{2+2 \sqrt {2}}\right )}{2+2 \sqrt {2}}}{b}\) \(86\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((cosh(b*x+a)^2-sinh(b*x+a)^2)/(cosh(b*x+a)^2+sinh(b*x+a)^2),x,method=_RETURNVERBOSE)

[Out]

1/b*(-(-2+2^(1/2))*2^(1/2)/(-2+2*2^(1/2))*arctan(2*tanh(1/2*b*x+1/2*a)/(-2+2*2^(1/2)))-(2+2^(1/2))*2^(1/2)/(2+
2*2^(1/2))*arctan(2*tanh(1/2*b*x+1/2*a)/(2+2*2^(1/2))))

________________________________________________________________________________________

Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 49 vs. \(2 (11) = 22\).
time = 0.48, size = 49, normalized size = 4.45 \begin {gather*} \frac {\arctan \left (\frac {1}{2} \, \sqrt {2} {\left (\sqrt {2} + 2 \, e^{\left (-b x - a\right )}\right )}\right ) - \arctan \left (-\frac {1}{2} \, \sqrt {2} {\left (\sqrt {2} - 2 \, e^{\left (-b x - a\right )}\right )}\right )}{b} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((cosh(b*x+a)^2-sinh(b*x+a)^2)/(cosh(b*x+a)^2+sinh(b*x+a)^2),x, algorithm="maxima")

[Out]

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

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 38 vs. \(2 (11) = 22\).
time = 0.34, size = 38, normalized size = 3.45 \begin {gather*} -\frac {\arctan \left (-\frac {\cosh \left (b x + a\right ) + \sinh \left (b x + a\right )}{\cosh \left (b x + a\right ) - \sinh \left (b x + a\right )}\right )}{b} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((cosh(b*x+a)^2-sinh(b*x+a)^2)/(cosh(b*x+a)^2+sinh(b*x+a)^2),x, algorithm="fricas")

[Out]

-arctan(-(cosh(b*x + a) + sinh(b*x + a))/(cosh(b*x + a) - sinh(b*x + a)))/b

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 275 vs. \(2 (8) = 16\).
time = 0.57, size = 275, normalized size = 25.00 \begin {gather*} \begin {cases} \frac {x \left (- \sinh ^{2}{\left (a \right )} + \cosh ^{2}{\left (a \right )}\right )}{\sinh ^{2}{\left (a \right )} + \cosh ^{2}{\left (a \right )}} & \text {for}\: b = 0 \\\frac {\log {\left (- e^{- b x} \right )} \sinh ^{2}{\left (b x + \log {\left (- e^{- b x} \right )} \right )}}{b \sinh ^{2}{\left (b x + \log {\left (- e^{- b x} \right )} \right )} + b \cosh ^{2}{\left (b x + \log {\left (- e^{- b x} \right )} \right )}} - \frac {\log {\left (- e^{- b x} \right )} \cosh ^{2}{\left (b x + \log {\left (- e^{- b x} \right )} \right )}}{b \sinh ^{2}{\left (b x + \log {\left (- e^{- b x} \right )} \right )} + b \cosh ^{2}{\left (b x + \log {\left (- e^{- b x} \right )} \right )}} & \text {for}\: a = \log {\left (- e^{- b x} \right )} \\- \frac {x \sinh ^{2}{\left (b x + \log {\left (e^{- b x} \right )} \right )}}{\sinh ^{2}{\left (b x + \log {\left (e^{- b x} \right )} \right )} + \cosh ^{2}{\left (b x + \log {\left (e^{- b x} \right )} \right )}} + \frac {x \cosh ^{2}{\left (b x + \log {\left (e^{- b x} \right )} \right )}}{\sinh ^{2}{\left (b x + \log {\left (e^{- b x} \right )} \right )} + \cosh ^{2}{\left (b x + \log {\left (e^{- b x} \right )} \right )}} & \text {for}\: a = \log {\left (e^{- b x} \right )} \\- \frac {\operatorname {atan}{\left (\frac {\cosh {\left (a + b x \right )}}{\sinh {\left (a + b x \right )}} \right )}}{b} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((cosh(b*x+a)**2-sinh(b*x+a)**2)/(cosh(b*x+a)**2+sinh(b*x+a)**2),x)

[Out]

Piecewise((x*(-sinh(a)**2 + cosh(a)**2)/(sinh(a)**2 + cosh(a)**2), Eq(b, 0)), (log(-exp(-b*x))*sinh(b*x + log(
-exp(-b*x)))**2/(b*sinh(b*x + log(-exp(-b*x)))**2 + b*cosh(b*x + log(-exp(-b*x)))**2) - log(-exp(-b*x))*cosh(b
*x + log(-exp(-b*x)))**2/(b*sinh(b*x + log(-exp(-b*x)))**2 + b*cosh(b*x + log(-exp(-b*x)))**2), Eq(a, log(-exp
(-b*x)))), (-x*sinh(b*x + log(exp(-b*x)))**2/(sinh(b*x + log(exp(-b*x)))**2 + cosh(b*x + log(exp(-b*x)))**2) +
 x*cosh(b*x + log(exp(-b*x)))**2/(sinh(b*x + log(exp(-b*x)))**2 + cosh(b*x + log(exp(-b*x)))**2), Eq(a, log(ex
p(-b*x)))), (-atan(cosh(a + b*x)/sinh(a + b*x))/b, True))

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 44 vs. \(2 (11) = 22\).
time = 0.42, size = 44, normalized size = 4.00 \begin {gather*} -\frac {\arctan \left (\frac {1}{2} \, \sqrt {2} {\left (\sqrt {2} + 2 \, e^{\left (b x + a\right )}\right )}\right ) - \arctan \left (-\frac {1}{2} \, \sqrt {2} {\left (\sqrt {2} - 2 \, e^{\left (b x + a\right )}\right )}\right )}{b} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((cosh(b*x+a)^2-sinh(b*x+a)^2)/(cosh(b*x+a)^2+sinh(b*x+a)^2),x, algorithm="giac")

[Out]

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

________________________________________________________________________________________

Mupad [B]
time = 0.09, size = 25, normalized size = 2.27 \begin {gather*} \frac {\mathrm {atan}\left (\frac {{\mathrm {e}}^{2\,a}\,{\mathrm {e}}^{2\,b\,x}\,\sqrt {b^2}}{b}\right )}{\sqrt {b^2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((cosh(a + b*x)^2 - sinh(a + b*x)^2)/(cosh(a + b*x)^2 + sinh(a + b*x)^2),x)

[Out]

atan((exp(2*a)*exp(2*b*x)*(b^2)^(1/2))/b)/(b^2)^(1/2)

________________________________________________________________________________________