3.9.38 \(\int \frac {\sinh ^2(x)}{a \cosh ^2(x)+b \sinh ^2(x)} \, dx\) [838]

3.9.38.1 Optimal result
3.9.38.2 Mathematica [A] (verified)
3.9.38.3 Rubi [A] (verified)
3.9.38.4 Maple [B] (verified)
3.9.38.5 Fricas [A] (verification not implemented)
3.9.38.6 Sympy [B] (verification not implemented)
3.9.38.7 Maxima [B] (verification not implemented)
3.9.38.8 Giac [A] (verification not implemented)
3.9.38.9 Mupad [B] (verification not implemented)

3.9.38.1 Optimal result

Integrand size = 20, antiderivative size = 39 \[ \int \frac {\sinh ^2(x)}{a \cosh ^2(x)+b \sinh ^2(x)} \, dx=\frac {x}{a+b}-\frac {\sqrt {a} \arctan \left (\frac {\sqrt {b} \tanh (x)}{\sqrt {a}}\right )}{\sqrt {b} (a+b)} \]

output
x/(a+b)-arctan(b^(1/2)*tanh(x)/a^(1/2))*a^(1/2)/(a+b)/b^(1/2)
 
3.9.38.2 Mathematica [A] (verified)

Time = 0.31 (sec) , antiderivative size = 34, normalized size of antiderivative = 0.87 \[ \int \frac {\sinh ^2(x)}{a \cosh ^2(x)+b \sinh ^2(x)} \, dx=\frac {x-\frac {\sqrt {a} \arctan \left (\frac {\sqrt {b} \tanh (x)}{\sqrt {a}}\right )}{\sqrt {b}}}{a+b} \]

input
Integrate[Sinh[x]^2/(a*Cosh[x]^2 + b*Sinh[x]^2),x]
 
output
(x - (Sqrt[a]*ArcTan[(Sqrt[b]*Tanh[x])/Sqrt[a]])/Sqrt[b])/(a + b)
 
3.9.38.3 Rubi [A] (verified)

Time = 0.30 (sec) , antiderivative size = 41, normalized size of antiderivative = 1.05, number of steps used = 8, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.350, Rules used = {3042, 25, 4889, 25, 383, 218, 219}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

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

\(\Big \downarrow \) 3042

\(\displaystyle \int -\frac {\sin (i x)^2}{a \cos (i x)^2-b \sin (i x)^2}dx\)

\(\Big \downarrow \) 25

\(\displaystyle -\int \frac {\sin (i x)^2}{a \cos (i x)^2-b \sin (i x)^2}dx\)

\(\Big \downarrow \) 4889

\(\displaystyle -\int -\frac {\tanh ^2(x)}{\left (1-\tanh ^2(x)\right ) \left (b \tanh ^2(x)+a\right )}d\tanh (x)\)

\(\Big \downarrow \) 25

\(\displaystyle \int \frac {\tanh ^2(x)}{\left (1-\tanh ^2(x)\right ) \left (a+b \tanh ^2(x)\right )}d\tanh (x)\)

\(\Big \downarrow \) 383

\(\displaystyle \frac {\int \frac {1}{1-\tanh ^2(x)}d\tanh (x)}{a+b}-\frac {a \int \frac {1}{b \tanh ^2(x)+a}d\tanh (x)}{a+b}\)

\(\Big \downarrow \) 218

\(\displaystyle \frac {\int \frac {1}{1-\tanh ^2(x)}d\tanh (x)}{a+b}-\frac {\sqrt {a} \arctan \left (\frac {\sqrt {b} \tanh (x)}{\sqrt {a}}\right )}{\sqrt {b} (a+b)}\)

\(\Big \downarrow \) 219

\(\displaystyle \frac {\text {arctanh}(\tanh (x))}{a+b}-\frac {\sqrt {a} \arctan \left (\frac {\sqrt {b} \tanh (x)}{\sqrt {a}}\right )}{\sqrt {b} (a+b)}\)

input
Int[Sinh[x]^2/(a*Cosh[x]^2 + b*Sinh[x]^2),x]
 
output
-((Sqrt[a]*ArcTan[(Sqrt[b]*Tanh[x])/Sqrt[a]])/(Sqrt[b]*(a + b))) + ArcTanh 
[Tanh[x]]/(a + b)
 

3.9.38.3.1 Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

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

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

rule 383
Int[((e_.)*(x_))^(m_.)/(((a_) + (b_.)*(x_)^2)*((c_) + (d_.)*(x_)^2)), x_Sym 
bol] :> Simp[(-a)*(e^2/(b*c - a*d))   Int[(e*x)^(m - 2)/(a + b*x^2), x], x] 
 + Simp[c*(e^2/(b*c - a*d))   Int[(e*x)^(m - 2)/(c + d*x^2), x], x] /; Free 
Q[{a, b, c, d, e, m}, x] && NeQ[b*c - a*d, 0] && LeQ[2, m, 3]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4889
Int[u_, x_Symbol] :> With[{v = FunctionOfTrig[u, x]}, With[{d = FreeFactors 
[Tan[v], x]}, Simp[d/Coefficient[v, x, 1]   Subst[Int[SubstFor[1/(1 + d^2*x 
^2), Tan[v]/d, u, x], x], x, Tan[v]/d], x]] /;  !FalseQ[v] && FunctionOfQ[N 
onfreeFactors[Tan[v], x], u, x]] /; InverseFunctionFreeQ[u, x] &&  !MatchQ[ 
u, (v_.)*((c_.)*tan[w_]^(n_.)*tan[z_]^(n_.))^(p_.) /; FreeQ[{c, p}, x] && I 
ntegerQ[n] && LinearQ[w, x] && EqQ[z, 2*w]]
 
3.9.38.4 Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(91\) vs. \(2(31)=62\).

Time = 0.18 (sec) , antiderivative size = 92, normalized size of antiderivative = 2.36

method result size
risch \(\frac {x}{a +b}+\frac {\sqrt {-a b}\, \ln \left ({\mathrm e}^{2 x}-\frac {-a +2 \sqrt {-a b}+b}{a +b}\right )}{2 b \left (a +b \right )}-\frac {\sqrt {-a b}\, \ln \left ({\mathrm e}^{2 x}+\frac {a +2 \sqrt {-a b}-b}{a +b}\right )}{2 b \left (a +b \right )}\) \(92\)
default \(\frac {8 a^{2} \left (-\frac {\left (-a +\sqrt {b \left (a +b \right )}-b \right ) \operatorname {arctanh}\left (\frac {a \tanh \left (\frac {x}{2}\right )}{\sqrt {\left (2 \sqrt {b \left (a +b \right )}-a -2 b \right ) a}}\right )}{2 a \sqrt {b \left (a +b \right )}\, \sqrt {\left (2 \sqrt {b \left (a +b \right )}-a -2 b \right ) a}}+\frac {\left (a +\sqrt {b \left (a +b \right )}+b \right ) \arctan \left (\frac {a \tanh \left (\frac {x}{2}\right )}{\sqrt {\left (2 \sqrt {b \left (a +b \right )}+a +2 b \right ) a}}\right )}{2 a \sqrt {b \left (a +b \right )}\, \sqrt {\left (2 \sqrt {b \left (a +b \right )}+a +2 b \right ) a}}\right )}{4 a +4 b}+\frac {8 \ln \left (1+\tanh \left (\frac {x}{2}\right )\right )}{8 a +8 b}-\frac {8 \ln \left (\tanh \left (\frac {x}{2}\right )-1\right )}{8 a +8 b}\) \(191\)

input
int(sinh(x)^2/(a*cosh(x)^2+b*sinh(x)^2),x,method=_RETURNVERBOSE)
 
output
x/(a+b)+1/2/b*(-a*b)^(1/2)/(a+b)*ln(exp(2*x)-(-a+2*(-a*b)^(1/2)+b)/(a+b))- 
1/2/b*(-a*b)^(1/2)/(a+b)*ln(exp(2*x)+(a+2*(-a*b)^(1/2)-b)/(a+b))
 
3.9.38.5 Fricas [A] (verification not implemented)

Time = 0.30 (sec) , antiderivative size = 367, normalized size of antiderivative = 9.41 \[ \int \frac {\sinh ^2(x)}{a \cosh ^2(x)+b \sinh ^2(x)} \, dx=\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 ] \]

input
integrate(sinh(x)^2/(a*cosh(x)^2+b*sinh(x)^2),x, algorithm="fricas")
 
output
[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)*cosh(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 
)]
 
3.9.38.6 Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 202 vs. \(2 (32) = 64\).

Time = 0.59 (sec) , antiderivative size = 202, normalized size of antiderivative = 5.18 \[ \int \frac {\sinh ^2(x)}{a \cosh ^2(x)+b \sinh ^2(x)} \, dx=\begin {cases} \tilde {\infty } x & \text {for}\: a = 0 \wedge 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 {x - \frac {\sinh {\left (x \right )}}{\cosh {\left (x \right )}}}{a} & \text {for}\: b = 0 \\\frac {2 x \sqrt {- \frac {b}{a}}}{2 a \sqrt {- \frac {b}{a}} + 2 b \sqrt {- \frac {b}{a}}} + \frac {\log {\left (- \sqrt {- \frac {b}{a}} \sinh {\left (x \right )} + \cosh {\left (x \right )} \right )}}{2 a \sqrt {- \frac {b}{a}} + 2 b \sqrt {- \frac {b}{a}}} - \frac {\log {\left (\sqrt {- \frac {b}{a}} \sinh {\left (x \right )} + \cosh {\left (x \right )} \right )}}{2 a \sqrt {- \frac {b}{a}} + 2 b \sqrt {- \frac {b}{a}}} & \text {otherwise} \end {cases} \]

input
integrate(sinh(x)**2/(a*cosh(x)**2+b*sinh(x)**2),x)
 
output
Piecewise((zoo*x, Eq(a, 0) & 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*cos 
h(x)**2) - sinh(x)*cosh(x)/(-2*b*sinh(x)**2 + 2*b*cosh(x)**2), Eq(a, -b)), 
 ((x - sinh(x)/cosh(x))/a, Eq(b, 0)), (2*x*sqrt(-b/a)/(2*a*sqrt(-b/a) + 2* 
b*sqrt(-b/a)) + log(-sqrt(-b/a)*sinh(x) + cosh(x))/(2*a*sqrt(-b/a) + 2*b*s 
qrt(-b/a)) - log(sqrt(-b/a)*sinh(x) + cosh(x))/(2*a*sqrt(-b/a) + 2*b*sqrt( 
-b/a)), True))
 
3.9.38.7 Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 74 vs. \(2 (31) = 62\).

Time = 0.30 (sec) , antiderivative size = 74, normalized size of antiderivative = 1.90 \[ \int \frac {\sinh ^2(x)}{a \cosh ^2(x)+b \sinh ^2(x)} \, dx=-\frac {{\left (a - b\right )} \arctan \left (\frac {{\left (a + b\right )} e^{\left (2 \, x\right )} + a - b}{2 \, \sqrt {a b}}\right )}{2 \, \sqrt {a b} {\left (a + b\right )}} + \frac {\arctan \left (\frac {{\left (a + b\right )} e^{\left (-2 \, x\right )} + a - b}{2 \, \sqrt {a b}}\right )}{2 \, \sqrt {a b}} + \frac {x}{a + b} \]

input
integrate(sinh(x)^2/(a*cosh(x)^2+b*sinh(x)^2),x, algorithm="maxima")
 
output
-1/2*(a - b)*arctan(1/2*((a + b)*e^(2*x) + a - b)/sqrt(a*b))/(sqrt(a*b)*(a 
 + b)) + 1/2*arctan(1/2*((a + b)*e^(-2*x) + a - b)/sqrt(a*b))/sqrt(a*b) + 
x/(a + b)
 
3.9.38.8 Giac [A] (verification not implemented)

Time = 0.27 (sec) , antiderivative size = 46, normalized size of antiderivative = 1.18 \[ \int \frac {\sinh ^2(x)}{a \cosh ^2(x)+b \sinh ^2(x)} \, dx=-\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} \]

input
integrate(sinh(x)^2/(a*cosh(x)^2+b*sinh(x)^2),x, algorithm="giac")
 
output
-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)
 
3.9.38.9 Mupad [B] (verification not implemented)

Time = 2.91 (sec) , antiderivative size = 209, normalized size of antiderivative = 5.36 \[ \int \frac {\sinh ^2(x)}{a \cosh ^2(x)+b \sinh ^2(x)} \, dx=\frac {x}{a+b}-\frac {\sqrt {a}\,\mathrm {atan}\left (\frac {\left ({\mathrm {e}}^{2\,x}\,\left (\frac {4\,a}{{\left (a+b\right )}^4}+\frac {\left (a^2-b^2\right )\,\left (a-b\right )}{{\left (a+b\right )}^3\,\sqrt {b\,{\left (a+b\right )}^2}\,\sqrt {a^2\,b+2\,a\,b^2+b^3}}\right )+\frac {\left (a-b\right )\,\left (a^2+2\,a\,b+b^2\right )}{{\left (a+b\right )}^3\,\sqrt {b\,{\left (a+b\right )}^2}\,\sqrt {a^2\,b+2\,a\,b^2+b^3}}\right )\,\left (a^2\,\sqrt {a^2\,b+2\,a\,b^2+b^3}+b^2\,\sqrt {a^2\,b+2\,a\,b^2+b^3}+2\,a\,b\,\sqrt {a^2\,b+2\,a\,b^2+b^3}\right )}{2\,\sqrt {a}}\right )}{\sqrt {a^2\,b+2\,a\,b^2+b^3}} \]

input
int(sinh(x)^2/(b*sinh(x)^2 + a*cosh(x)^2),x)
 
output
x/(a + b) - (a^(1/2)*atan(((exp(2*x)*((4*a)/(a + b)^4 + ((a^2 - b^2)*(a - 
b))/((a + b)^3*(b*(a + b)^2)^(1/2)*(2*a*b^2 + a^2*b + b^3)^(1/2))) + ((a - 
 b)*(2*a*b + a^2 + b^2))/((a + b)^3*(b*(a + b)^2)^(1/2)*(2*a*b^2 + a^2*b + 
 b^3)^(1/2)))*(a^2*(2*a*b^2 + a^2*b + b^3)^(1/2) + b^2*(2*a*b^2 + a^2*b + 
b^3)^(1/2) + 2*a*b*(2*a*b^2 + a^2*b + b^3)^(1/2)))/(2*a^(1/2))))/(2*a*b^2 
+ a^2*b + b^3)^(1/2)