Integrand size = 13, antiderivative size = 84 \[ \int \frac {\sinh ^2(x)}{a+b \tanh (x)} \, dx=\frac {a \log (1-\tanh (x))}{4 (a+b)^2}-\frac {a \log (1+\tanh (x))}{4 (a-b)^2}+\frac {a^2 b \log (a+b \tanh (x))}{\left (a^2-b^2\right )^2}-\frac {\cosh ^2(x) (b-a \tanh (x))}{2 \left (a^2-b^2\right )} \]
1/4*a*ln(1-tanh(x))/(a+b)^2-1/4*a*ln(1+tanh(x))/(a-b)^2+a^2*b*ln(a+b*tanh( x))/(a^2-b^2)^2-1/2*cosh(x)^2*(b-a*tanh(x))/(a^2-b^2)
Time = 0.15 (sec) , antiderivative size = 73, normalized size of antiderivative = 0.87 \[ \int \frac {\sinh ^2(x)}{a+b \tanh (x)} \, dx=\frac {\left (-a^2 b+b^3\right ) \cosh (2 x)+a \left (-2 \left (a^2+b^2\right ) x+4 a b \log (a \cosh (x)+b \sinh (x))+\left (a^2-b^2\right ) \sinh (2 x)\right )}{4 (a-b)^2 (a+b)^2} \]
((-(a^2*b) + b^3)*Cosh[2*x] + a*(-2*(a^2 + b^2)*x + 4*a*b*Log[a*Cosh[x] + b*Sinh[x]] + (a^2 - b^2)*Sinh[2*x]))/(4*(a - b)^2*(a + b)^2)
Time = 0.39 (sec) , antiderivative size = 142, normalized size of antiderivative = 1.69, number of steps used = 8, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.538, Rules used = {3042, 25, 3999, 601, 27, 657, 2009}
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+b \tanh (x)} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int -\frac {\sin (i x)^2}{a-i b \tan (i x)}dx\) |
\(\Big \downarrow \) 25 |
\(\displaystyle -\int \frac {\sin (i x)^2}{a-i b \tan (i x)}dx\) |
\(\Big \downarrow \) 3999 |
\(\displaystyle b \int \frac {b^2 \tanh ^2(x)}{(a+b \tanh (x)) \left (b^2-b^2 \tanh ^2(x)\right )^2}d(b \tanh (x))\) |
\(\Big \downarrow \) 601 |
\(\displaystyle b \left (-\frac {\int \frac {a b^2 (a-b \tanh (x))}{\left (a^2-b^2\right ) (a+b \tanh (x)) \left (b^2-b^2 \tanh ^2(x)\right )}d(b \tanh (x))}{2 b^2}-\frac {\frac {b^2}{a^2-b^2}-\frac {a b \tanh (x)}{a^2-b^2}}{2 \left (b^2-b^2 \tanh ^2(x)\right )}\right )\) |
\(\Big \downarrow \) 27 |
\(\displaystyle b \left (-\frac {a \int \frac {a-b \tanh (x)}{(a+b \tanh (x)) \left (b^2-b^2 \tanh ^2(x)\right )}d(b \tanh (x))}{2 \left (a^2-b^2\right )}-\frac {\frac {b^2}{a^2-b^2}-\frac {a b \tanh (x)}{a^2-b^2}}{2 \left (b^2-b^2 \tanh ^2(x)\right )}\right )\) |
\(\Big \downarrow \) 657 |
\(\displaystyle b \left (-\frac {a \int \left (-\frac {2 a}{(a-b) (a+b) (a+b \tanh (x))}+\frac {a-b}{2 b (a+b) (b-b \tanh (x))}+\frac {a+b}{2 (a-b) b (\tanh (x) b+b)}\right )d(b \tanh (x))}{2 \left (a^2-b^2\right )}-\frac {\frac {b^2}{a^2-b^2}-\frac {a b \tanh (x)}{a^2-b^2}}{2 \left (b^2-b^2 \tanh ^2(x)\right )}\right )\) |
\(\Big \downarrow \) 2009 |
\(\displaystyle b \left (-\frac {\frac {b^2}{a^2-b^2}-\frac {a b \tanh (x)}{a^2-b^2}}{2 \left (b^2-b^2 \tanh ^2(x)\right )}-\frac {a \left (-\frac {2 a \log (a+b \tanh (x))}{a^2-b^2}-\frac {(a-b) \log (b-b \tanh (x))}{2 b (a+b)}+\frac {(a+b) \log (b \tanh (x)+b)}{2 b (a-b)}\right )}{2 \left (a^2-b^2\right )}\right )\) |
b*(-1/2*(a*(-1/2*((a - b)*Log[b - b*Tanh[x]])/(b*(a + b)) - (2*a*Log[a + b *Tanh[x]])/(a^2 - b^2) + ((a + b)*Log[b + b*Tanh[x]])/(2*(a - b)*b)))/(a^2 - b^2) - (b^2/(a^2 - b^2) - (a*b*Tanh[x])/(a^2 - b^2))/(2*(b^2 - b^2*Tanh [x]^2)))
3.1.82.3.1 Defintions of rubi rules used
Int[(a_)*(Fx_), x_Symbol] :> Simp[a Int[Fx, x], x] /; FreeQ[a, x] && !Ma tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
Int[(x_)^(m_)*((c_) + (d_.)*(x_))^(n_.)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbo l] :> With[{Qx = PolynomialQuotient[x^m*(c + d*x)^n, a + b*x^2, x], e = Coe ff[PolynomialRemainder[x^m*(c + d*x)^n, a + b*x^2, x], x, 0], f = Coeff[Pol ynomialRemainder[x^m*(c + d*x)^n, a + b*x^2, x], x, 1]}, Simp[(a*f - b*e*x) *((a + b*x^2)^(p + 1)/(2*a*b*(p + 1))), x] + Simp[1/(2*a*(p + 1)) Int[(c + d*x)^n*(a + b*x^2)^(p + 1)*ExpandToSum[(2*a*(p + 1)*Qx)/(c + d*x)^n + (e* (2*p + 3))/(c + d*x)^n, x], x], x]] /; FreeQ[{a, b, c, d}, x] && IGtQ[m, 1] && LtQ[p, -1] && ILtQ[n, 0] && NeQ[b*c^2 + a*d^2, 0]
Int[(((d_.) + (e_.)*(x_))^(m_.)*((f_.) + (g_.)*(x_))^(n_.))/((a_) + (c_.)*( x_)^2), x_Symbol] :> Int[ExpandIntegrand[(d + e*x)^m*((f + g*x)^n/(a + c*x^ 2)), x], x] /; FreeQ[{a, c, d, e, f, g, m}, x] && IntegersQ[n]
Int[sin[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_ ), x_Symbol] :> Simp[b/f Subst[Int[x^m*((a + x)^n/(b^2 + x^2)^(m/2 + 1)), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x] && IntegerQ[m/2]
Time = 0.56 (sec) , antiderivative size = 98, normalized size of antiderivative = 1.17
method | result | size |
risch | \(-\frac {a x}{2 \left (a +b \right )^{2}}+\frac {{\mathrm e}^{2 x}}{8 a +8 b}-\frac {{\mathrm e}^{-2 x}}{8 \left (a -b \right )}-\frac {2 a^{2} b x}{a^{4}-2 a^{2} b^{2}+b^{4}}+\frac {a^{2} b \ln \left ({\mathrm e}^{2 x}+\frac {a -b}{a +b}\right )}{a^{4}-2 a^{2} b^{2}+b^{4}}\) | \(98\) |
default | \(\frac {a^{2} b \ln \left (\tanh \left (\frac {x}{2}\right )^{2} a +2 b \tanh \left (\frac {x}{2}\right )+a \right )}{\left (a -b \right )^{2} \left (a +b \right )^{2}}-\frac {4}{\left (8 a -8 b \right ) \left (\tanh \left (\frac {x}{2}\right )+1\right )^{2}}+\frac {8}{\left (16 a -16 b \right ) \left (\tanh \left (\frac {x}{2}\right )+1\right )}-\frac {a \ln \left (\tanh \left (\frac {x}{2}\right )+1\right )}{2 \left (a -b \right )^{2}}+\frac {4}{\left (8 a +8 b \right ) \left (\tanh \left (\frac {x}{2}\right )-1\right )^{2}}+\frac {8}{\left (16 a +16 b \right ) \left (\tanh \left (\frac {x}{2}\right )-1\right )}+\frac {a \ln \left (\tanh \left (\frac {x}{2}\right )-1\right )}{2 \left (a +b \right )^{2}}\) | \(145\) |
-1/2*a*x/(a+b)^2+1/8/(a+b)*exp(2*x)-1/8/(a-b)*exp(-2*x)-2*a^2*b/(a^4-2*a^2 *b^2+b^4)*x+a^2*b/(a^4-2*a^2*b^2+b^4)*ln(exp(2*x)+(a-b)/(a+b))
Leaf count of result is larger than twice the leaf count of optimal. 334 vs. \(2 (79) = 158\).
Time = 0.26 (sec) , antiderivative size = 334, normalized size of antiderivative = 3.98 \[ \int \frac {\sinh ^2(x)}{a+b \tanh (x)} \, dx=\frac {{\left (a^{3} - a^{2} b - a b^{2} + b^{3}\right )} \cosh \left (x\right )^{4} + 4 \, {\left (a^{3} - a^{2} b - a b^{2} + b^{3}\right )} \cosh \left (x\right ) \sinh \left (x\right )^{3} + {\left (a^{3} - a^{2} b - a b^{2} + b^{3}\right )} \sinh \left (x\right )^{4} - 4 \, {\left (a^{3} + 2 \, a^{2} b + a b^{2}\right )} x \cosh \left (x\right )^{2} - a^{3} - a^{2} b + a b^{2} + b^{3} + 2 \, {\left (3 \, {\left (a^{3} - a^{2} b - a b^{2} + b^{3}\right )} \cosh \left (x\right )^{2} - 2 \, {\left (a^{3} + 2 \, a^{2} b + a b^{2}\right )} x\right )} \sinh \left (x\right )^{2} + 8 \, {\left (a^{2} b \cosh \left (x\right )^{2} + 2 \, a^{2} b \cosh \left (x\right ) \sinh \left (x\right ) + a^{2} b \sinh \left (x\right )^{2}\right )} \log \left (\frac {2 \, {\left (a \cosh \left (x\right ) + b \sinh \left (x\right )\right )}}{\cosh \left (x\right ) - \sinh \left (x\right )}\right ) + 4 \, {\left ({\left (a^{3} - a^{2} b - a b^{2} + b^{3}\right )} \cosh \left (x\right )^{3} - 2 \, {\left (a^{3} + 2 \, a^{2} b + a b^{2}\right )} x \cosh \left (x\right )\right )} \sinh \left (x\right )}{8 \, {\left ({\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} \cosh \left (x\right )^{2} + 2 \, {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} \cosh \left (x\right ) \sinh \left (x\right ) + {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} \sinh \left (x\right )^{2}\right )}} \]
1/8*((a^3 - a^2*b - a*b^2 + b^3)*cosh(x)^4 + 4*(a^3 - a^2*b - a*b^2 + b^3) *cosh(x)*sinh(x)^3 + (a^3 - a^2*b - a*b^2 + b^3)*sinh(x)^4 - 4*(a^3 + 2*a^ 2*b + a*b^2)*x*cosh(x)^2 - a^3 - a^2*b + a*b^2 + b^3 + 2*(3*(a^3 - a^2*b - a*b^2 + b^3)*cosh(x)^2 - 2*(a^3 + 2*a^2*b + a*b^2)*x)*sinh(x)^2 + 8*(a^2* b*cosh(x)^2 + 2*a^2*b*cosh(x)*sinh(x) + a^2*b*sinh(x)^2)*log(2*(a*cosh(x) + b*sinh(x))/(cosh(x) - sinh(x))) + 4*((a^3 - a^2*b - a*b^2 + b^3)*cosh(x) ^3 - 2*(a^3 + 2*a^2*b + a*b^2)*x*cosh(x))*sinh(x))/((a^4 - 2*a^2*b^2 + b^4 )*cosh(x)^2 + 2*(a^4 - 2*a^2*b^2 + b^4)*cosh(x)*sinh(x) + (a^4 - 2*a^2*b^2 + b^4)*sinh(x)^2)
\[ \int \frac {\sinh ^2(x)}{a+b \tanh (x)} \, dx=\int \frac {\sinh ^{2}{\left (x \right )}}{a + b \tanh {\left (x \right )}}\, dx \]
Time = 0.19 (sec) , antiderivative size = 83, normalized size of antiderivative = 0.99 \[ \int \frac {\sinh ^2(x)}{a+b \tanh (x)} \, dx=\frac {a^{2} b \log \left (-{\left (a - b\right )} e^{\left (-2 \, x\right )} - a - b\right )}{a^{4} - 2 \, a^{2} b^{2} + b^{4}} - \frac {a x}{2 \, {\left (a^{2} + 2 \, a b + b^{2}\right )}} + \frac {e^{\left (2 \, x\right )}}{8 \, {\left (a + b\right )}} - \frac {e^{\left (-2 \, x\right )}}{8 \, {\left (a - b\right )}} \]
a^2*b*log(-(a - b)*e^(-2*x) - a - b)/(a^4 - 2*a^2*b^2 + b^4) - 1/2*a*x/(a^ 2 + 2*a*b + b^2) + 1/8*e^(2*x)/(a + b) - 1/8*e^(-2*x)/(a - b)
Time = 0.28 (sec) , antiderivative size = 101, normalized size of antiderivative = 1.20 \[ \int \frac {\sinh ^2(x)}{a+b \tanh (x)} \, dx=\frac {a^{2} b \log \left ({\left | a e^{\left (2 \, x\right )} + b e^{\left (2 \, x\right )} + a - b \right |}\right )}{a^{4} - 2 \, a^{2} b^{2} + b^{4}} - \frac {a x}{2 \, {\left (a^{2} - 2 \, a b + b^{2}\right )}} + \frac {{\left (2 \, a e^{\left (2 \, x\right )} - a + b\right )} e^{\left (-2 \, x\right )}}{8 \, {\left (a^{2} - 2 \, a b + b^{2}\right )}} + \frac {e^{\left (2 \, x\right )}}{8 \, {\left (a + b\right )}} \]
a^2*b*log(abs(a*e^(2*x) + b*e^(2*x) + a - b))/(a^4 - 2*a^2*b^2 + b^4) - 1/ 2*a*x/(a^2 - 2*a*b + b^2) + 1/8*(2*a*e^(2*x) - a + b)*e^(-2*x)/(a^2 - 2*a* b + b^2) + 1/8*e^(2*x)/(a + b)
Time = 1.79 (sec) , antiderivative size = 81, normalized size of antiderivative = 0.96 \[ \int \frac {\sinh ^2(x)}{a+b \tanh (x)} \, dx=\frac {{\mathrm {e}}^{2\,x}}{8\,a+8\,b}-\frac {{\mathrm {e}}^{-2\,x}}{8\,a-8\,b}-\frac {a\,x}{2\,{\left (a-b\right )}^2}+\frac {a^2\,b\,\ln \left (a-b+a\,{\mathrm {e}}^{2\,x}+b\,{\mathrm {e}}^{2\,x}\right )}{a^4-2\,a^2\,b^2+b^4} \]