### 3.838 $$\int \frac{\sinh ^2(x)}{a \cosh ^2(x)+b \sinh ^2(x)} \, dx$$

Optimal. Leaf size=39 $\frac{x}{a+b}-\frac{\sqrt{a} \tan ^{-1}\left (\frac{\sqrt{b} \tanh (x)}{\sqrt{a}}\right )}{\sqrt{b} (a+b)}$

[Out]

x/(a + b) - (Sqrt[a]*ArcTan[(Sqrt[b]*Tanh[x])/Sqrt[a]])/(Sqrt[b]*(a + b))

________________________________________________________________________________________

Rubi [A]  time = 0.151323, antiderivative size = 39, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 20, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.15, Rules used = {481, 207, 205} $\frac{x}{a+b}-\frac{\sqrt{a} \tan ^{-1}\left (\frac{\sqrt{b} \tanh (x)}{\sqrt{a}}\right )}{\sqrt{b} (a+b)}$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

x/(a + b) - (Sqrt[a]*ArcTan[(Sqrt[b]*Tanh[x])/Sqrt[a]])/(Sqrt[b]*(a + b))

Rule 481

Int[((e_.)*(x_))^(m_.)/(((a_) + (b_.)*(x_)^(n_))*((c_) + (d_.)*(x_)^(n_))), x_Symbol] :> -Dist[(a*e^n)/(b*c -
a*d), Int[(e*x)^(m - n)/(a + b*x^n), x], x] + Dist[(c*e^n)/(b*c - a*d), Int[(e*x)^(m - n)/(c + d*x^n), x], x]
/; FreeQ[{a, b, c, d, e, m}, x] && NeQ[b*c - a*d, 0] && IGtQ[n, 0] && LeQ[n, m, 2*n - 1]

Rule 207

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

Rule 205

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

Rubi steps

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

Mathematica [A]  time = 0.0946278, size = 34, normalized size = 0.87 $\frac{x-\frac{\sqrt{a} \tan ^{-1}\left (\frac{\sqrt{b} \tanh (x)}{\sqrt{a}}\right )}{\sqrt{b}}}{a+b}$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

(x - (Sqrt[a]*ArcTan[(Sqrt[b]*Tanh[x])/Sqrt[a]])/Sqrt[b])/(a + b)

________________________________________________________________________________________

Maple [B]  time = 0.045, size = 414, normalized size = 10.6 \begin{align*} 8\,{\frac{\ln \left ( \tanh \left ( x/2 \right ) +1 \right ) }{8\,a+8\,b}}-8\,{\frac{\ln \left ( \tanh \left ( x/2 \right ) -1 \right ) }{8\,a+8\,b}}+4\,{\frac{{a}^{2}}{ \left ( 4\,a+4\,b \right ) \sqrt{b \left ( a+b \right ) }\sqrt{ \left ( 2\,\sqrt{b \left ( a+b \right ) }+a+2\,b \right ) a}}\arctan \left ({\frac{a\tanh \left ( x/2 \right ) }{\sqrt{ \left ( 2\,\sqrt{b \left ( a+b \right ) }+a+2\,b \right ) a}}} \right ) }+4\,{\frac{a}{ \left ( 4\,a+4\,b \right ) \sqrt{ \left ( 2\,\sqrt{b \left ( a+b \right ) }+a+2\,b \right ) a}}\arctan \left ({\frac{a\tanh \left ( x/2 \right ) }{\sqrt{ \left ( 2\,\sqrt{b \left ( a+b \right ) }+a+2\,b \right ) a}}} \right ) }+4\,{\frac{ab}{ \left ( 4\,a+4\,b \right ) \sqrt{b \left ( a+b \right ) }\sqrt{ \left ( 2\,\sqrt{b \left ( a+b \right ) }+a+2\,b \right ) a}}\arctan \left ({\frac{a\tanh \left ( x/2 \right ) }{\sqrt{ \left ( 2\,\sqrt{b \left ( a+b \right ) }+a+2\,b \right ) a}}} \right ) }+4\,{\frac{{a}^{2}}{ \left ( 4\,a+4\,b \right ) \sqrt{b \left ( a+b \right ) }\sqrt{ \left ( 2\,\sqrt{b \left ( a+b \right ) }-a-2\,b \right ) a}}{\it Artanh} \left ({\frac{a\tanh \left ( x/2 \right ) }{\sqrt{ \left ( 2\,\sqrt{b \left ( a+b \right ) }-a-2\,b \right ) a}}} \right ) }-4\,{\frac{a}{ \left ( 4\,a+4\,b \right ) \sqrt{ \left ( 2\,\sqrt{b \left ( a+b \right ) }-a-2\,b \right ) a}}{\it Artanh} \left ({\frac{a\tanh \left ( x/2 \right ) }{\sqrt{ \left ( 2\,\sqrt{b \left ( a+b \right ) }-a-2\,b \right ) a}}} \right ) }+4\,{\frac{ab}{ \left ( 4\,a+4\,b \right ) \sqrt{b \left ( a+b \right ) }\sqrt{ \left ( 2\,\sqrt{b \left ( a+b \right ) }-a-2\,b \right ) a}}{\it Artanh} \left ({\frac{a\tanh \left ( x/2 \right ) }{\sqrt{ \left ( 2\,\sqrt{b \left ( a+b \right ) }-a-2\,b \right ) a}}} \right ) } \end{align*}

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

[In]

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

[Out]

8/(8*a+8*b)*ln(tanh(1/2*x)+1)-8/(8*a+8*b)*ln(tanh(1/2*x)-1)+4*a^2/(4*a+4*b)/(b*(a+b))^(1/2)/((2*(b*(a+b))^(1/2
)+a+2*b)*a)^(1/2)*arctan(a*tanh(1/2*x)/((2*(b*(a+b))^(1/2)+a+2*b)*a)^(1/2))+4*a/(4*a+4*b)/((2*(b*(a+b))^(1/2)+
a+2*b)*a)^(1/2)*arctan(a*tanh(1/2*x)/((2*(b*(a+b))^(1/2)+a+2*b)*a)^(1/2))+4*a/(4*a+4*b)/(b*(a+b))^(1/2)/((2*(b
*(a+b))^(1/2)+a+2*b)*a)^(1/2)*arctan(a*tanh(1/2*x)/((2*(b*(a+b))^(1/2)+a+2*b)*a)^(1/2))*b+4*a^2/(4*a+4*b)/(b*(
a+b))^(1/2)/((2*(b*(a+b))^(1/2)-a-2*b)*a)^(1/2)*arctanh(a*tanh(1/2*x)/((2*(b*(a+b))^(1/2)-a-2*b)*a)^(1/2))-4*a
/(4*a+4*b)/((2*(b*(a+b))^(1/2)-a-2*b)*a)^(1/2)*arctanh(a*tanh(1/2*x)/((2*(b*(a+b))^(1/2)-a-2*b)*a)^(1/2))+4*a/
(4*a+4*b)/(b*(a+b))^(1/2)/((2*(b*(a+b))^(1/2)-a-2*b)*a)^(1/2)*arctanh(a*tanh(1/2*x)/((2*(b*(a+b))^(1/2)-a-2*b)
*a)^(1/2))*b

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

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

[In]

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

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [A]  time = 1.91539, size = 1007, normalized size = 25.82 \begin{align*} \left [\frac{\sqrt{-\frac{a}{b}} \log \left (\frac{{\left (a^{2} + 2 \, a b + b^{2}\right )} \cosh \left (x\right )^{4} + 4 \,{\left (a^{2} + 2 \, a b + b^{2}\right )} \cosh \left (x\right ) \sinh \left (x\right )^{3} +{\left (a^{2} + 2 \, a b + b^{2}\right )} \sinh \left (x\right )^{4} + 2 \,{\left (a^{2} - b^{2}\right )} \cosh \left (x\right )^{2} + 2 \,{\left (3 \,{\left (a^{2} + 2 \, a b + b^{2}\right )} \cosh \left (x\right )^{2} + a^{2} - b^{2}\right )} \sinh \left (x\right )^{2} + a^{2} - 6 \, a b + b^{2} + 4 \,{\left ({\left (a^{2} + 2 \, a b + b^{2}\right )} \cosh \left (x\right )^{3} +{\left (a^{2} - b^{2}\right )} \cosh \left (x\right )\right )} \sinh \left (x\right ) - 4 \,{\left ({\left (a b + b^{2}\right )} \cosh \left (x\right )^{2} + 2 \,{\left (a b + b^{2}\right )} \cosh \left (x\right ) \sinh \left (x\right ) +{\left (a b + b^{2}\right )} \sinh \left (x\right )^{2} + a b - b^{2}\right )} \sqrt{-\frac{a}{b}}}{{\left (a + b\right )} \cosh \left (x\right )^{4} + 4 \,{\left (a + b\right )} \cosh \left (x\right ) \sinh \left (x\right )^{3} +{\left (a + b\right )} \sinh \left (x\right )^{4} + 2 \,{\left (a - b\right )} \cosh \left (x\right )^{2} + 2 \,{\left (3 \,{\left (a + b\right )} \cosh \left (x\right )^{2} + a - b\right )} \sinh \left (x\right )^{2} + 4 \,{\left ({\left (a + b\right )} \cosh \left (x\right )^{3} +{\left (a - b\right )} \cosh \left (x\right )\right )} \sinh \left (x\right ) + a + b}\right ) + 2 \, x}{2 \,{\left (a + b\right )}}, -\frac{\sqrt{\frac{a}{b}} \arctan \left (\frac{{\left ({\left (a + b\right )} \cosh \left (x\right )^{2} + 2 \,{\left (a + b\right )} \cosh \left (x\right ) \sinh \left (x\right ) +{\left (a + b\right )} \sinh \left (x\right )^{2} + a - b\right )} \sqrt{\frac{a}{b}}}{2 \, a}\right ) - x}{a + b}\right ] \end{align*}

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

[In]

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

[Out]

[1/2*(sqrt(-a/b)*log(((a^2 + 2*a*b + b^2)*cosh(x)^4 + 4*(a^2 + 2*a*b + b^2)*cosh(x)*sinh(x)^3 + (a^2 + 2*a*b +
b^2)*sinh(x)^4 + 2*(a^2 - b^2)*cosh(x)^2 + 2*(3*(a^2 + 2*a*b + b^2)*cosh(x)^2 + a^2 - b^2)*sinh(x)^2 + a^2 -
6*a*b + b^2 + 4*((a^2 + 2*a*b + b^2)*cosh(x)^3 + (a^2 - b^2)*cosh(x))*sinh(x) - 4*((a*b + b^2)*cosh(x)^2 + 2*(
a*b + b^2)*cosh(x)*sinh(x) + (a*b + b^2)*sinh(x)^2 + a*b - b^2)*sqrt(-a/b))/((a + b)*cosh(x)^4 + 4*(a + b)*cos
h(x)*sinh(x)^3 + (a + b)*sinh(x)^4 + 2*(a - b)*cosh(x)^2 + 2*(3*(a + b)*cosh(x)^2 + a - b)*sinh(x)^2 + 4*((a +
b)*cosh(x)^3 + (a - b)*cosh(x))*sinh(x) + a + b)) + 2*x)/(a + b), -(sqrt(a/b)*arctan(1/2*((a + b)*cosh(x)^2 +
2*(a + b)*cosh(x)*sinh(x) + (a + b)*sinh(x)^2 + a - b)*sqrt(a/b)/a) - x)/(a + b)]

________________________________________________________________________________________

Sympy [A]  time = 2.82976, size = 258, normalized size = 6.62 \begin{align*} \begin{cases} \tilde{\infty } x & \text{for}\: a = 0 \wedge b = 0 \\\frac{x - \frac{\sinh{\left (x \right )}}{\cosh{\left (x \right )}}}{a} & \text{for}\: b = 0 \\\frac{x}{b} & \text{for}\: a = 0 \\- \frac{x \sinh ^{2}{\left (x \right )}}{- 2 b \sinh ^{2}{\left (x \right )} + 2 b \cosh ^{2}{\left (x \right )}} + \frac{x \cosh ^{2}{\left (x \right )}}{- 2 b \sinh ^{2}{\left (x \right )} + 2 b \cosh ^{2}{\left (x \right )}} - \frac{\sinh{\left (x \right )} \cosh{\left (x \right )}}{- 2 b \sinh ^{2}{\left (x \right )} + 2 b \cosh ^{2}{\left (x \right )}} & \text{for}\: a = - b \\\frac{2 i \sqrt{a} b x \sqrt{\frac{1}{b}}}{2 i a^{\frac{3}{2}} b \sqrt{\frac{1}{b}} + 2 i \sqrt{a} b^{2} \sqrt{\frac{1}{b}}} - \frac{a \log{\left (- i \sqrt{a} \sqrt{\frac{1}{b}} \cosh{\left (x \right )} + \sinh{\left (x \right )} \right )}}{2 i a^{\frac{3}{2}} b \sqrt{\frac{1}{b}} + 2 i \sqrt{a} b^{2} \sqrt{\frac{1}{b}}} + \frac{a \log{\left (i \sqrt{a} \sqrt{\frac{1}{b}} \cosh{\left (x \right )} + \sinh{\left (x \right )} \right )}}{2 i a^{\frac{3}{2}} b \sqrt{\frac{1}{b}} + 2 i \sqrt{a} b^{2} \sqrt{\frac{1}{b}}} & \text{otherwise} \end{cases} \end{align*}

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

[In]

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

[Out]

Piecewise((zoo*x, Eq(a, 0) & Eq(b, 0)), ((x - sinh(x)/cosh(x))/a, Eq(b, 0)), (x/b, Eq(a, 0)), (-x*sinh(x)**2/(
-2*b*sinh(x)**2 + 2*b*cosh(x)**2) + x*cosh(x)**2/(-2*b*sinh(x)**2 + 2*b*cosh(x)**2) - sinh(x)*cosh(x)/(-2*b*si
nh(x)**2 + 2*b*cosh(x)**2), Eq(a, -b)), (2*I*sqrt(a)*b*x*sqrt(1/b)/(2*I*a**(3/2)*b*sqrt(1/b) + 2*I*sqrt(a)*b**
2*sqrt(1/b)) - a*log(-I*sqrt(a)*sqrt(1/b)*cosh(x) + sinh(x))/(2*I*a**(3/2)*b*sqrt(1/b) + 2*I*sqrt(a)*b**2*sqrt
(1/b)) + a*log(I*sqrt(a)*sqrt(1/b)*cosh(x) + sinh(x))/(2*I*a**(3/2)*b*sqrt(1/b) + 2*I*sqrt(a)*b**2*sqrt(1/b)),
True))

________________________________________________________________________________________

Giac [A]  time = 1.15839, size = 62, normalized size = 1.59 \begin{align*} -\frac{a \arctan \left (\frac{a e^{\left (2 \, x\right )} + b e^{\left (2 \, x\right )} + a - b}{2 \, \sqrt{a b}}\right )}{\sqrt{a b}{\left (a + b\right )}} + \frac{x}{a + b} \end{align*}

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

[In]

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

[Out]

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