Integrand size = 16, antiderivative size = 74 \[ \int \frac {\sinh ^2(x)}{a \cosh (x)+b \sinh (x)} \, dx=-\frac {a^2 \arctan \left (\frac {b \cosh (x)+a \sinh (x)}{\sqrt {a^2-b^2}}\right )}{\left (a^2-b^2\right )^{3/2}}-\frac {b \cosh (x)}{a^2-b^2}+\frac {a \sinh (x)}{a^2-b^2} \] Output:
-a^2*arctan((b*cosh(x)+a*sinh(x))/(a^2-b^2)^(1/2))/(a^2-b^2)^(3/2)-b*cosh( x)/(a^2-b^2)+a*sinh(x)/(a^2-b^2)
Time = 0.27 (sec) , antiderivative size = 89, normalized size of antiderivative = 1.20 \[ \int \frac {\sinh ^2(x)}{a \cosh (x)+b \sinh (x)} \, dx=\frac {-\sqrt {a-b} b (a+b) \cosh (x)+a \left (-2 a \sqrt {a+b} \arctan \left (\frac {b+a \tanh \left (\frac {x}{2}\right )}{\sqrt {a-b} \sqrt {a+b}}\right )+\sqrt {a-b} (a+b) \sinh (x)\right )}{(a-b)^{3/2} (a+b)^2} \] Input:
Integrate[Sinh[x]^2/(a*Cosh[x] + b*Sinh[x]),x]
Output:
(-(Sqrt[a - b]*b*(a + b)*Cosh[x]) + a*(-2*a*Sqrt[a + b]*ArcTan[(b + a*Tanh [x/2])/(Sqrt[a - b]*Sqrt[a + b])] + Sqrt[a - b]*(a + b)*Sinh[x]))/((a - b) ^(3/2)*(a + b)^2)
Result contains complex when optimal does not.
Time = 0.40 (sec) , antiderivative size = 82, normalized size of antiderivative = 1.11, number of steps used = 10, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.562, Rules used = {3042, 25, 3578, 26, 3042, 26, 3118, 3553, 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 (x)+b \sinh (x)} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int -\frac {\sin (i x)^2}{a \cos (i x)-i b \sin (i x)}dx\) |
\(\Big \downarrow \) 25 |
\(\displaystyle -\int \frac {\sin (i x)^2}{a \cos (i x)-i b \sin (i x)}dx\) |
\(\Big \downarrow \) 3578 |
\(\displaystyle \frac {i b \int i \sinh (x)dx}{a^2-b^2}-\frac {a^2 \int \frac {1}{a \cosh (x)+b \sinh (x)}dx}{a^2-b^2}+\frac {a \sinh (x)}{a^2-b^2}\) |
\(\Big \downarrow \) 26 |
\(\displaystyle -\frac {b \int \sinh (x)dx}{a^2-b^2}-\frac {a^2 \int \frac {1}{a \cosh (x)+b \sinh (x)}dx}{a^2-b^2}+\frac {a \sinh (x)}{a^2-b^2}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle -\frac {b \int -i \sin (i x)dx}{a^2-b^2}-\frac {a^2 \int \frac {1}{a \cos (i x)-i b \sin (i x)}dx}{a^2-b^2}+\frac {a \sinh (x)}{a^2-b^2}\) |
\(\Big \downarrow \) 26 |
\(\displaystyle \frac {i b \int \sin (i x)dx}{a^2-b^2}-\frac {a^2 \int \frac {1}{a \cos (i x)-i b \sin (i x)}dx}{a^2-b^2}+\frac {a \sinh (x)}{a^2-b^2}\) |
\(\Big \downarrow \) 3118 |
\(\displaystyle -\frac {a^2 \int \frac {1}{a \cos (i x)-i b \sin (i x)}dx}{a^2-b^2}+\frac {a \sinh (x)}{a^2-b^2}-\frac {b \cosh (x)}{a^2-b^2}\) |
\(\Big \downarrow \) 3553 |
\(\displaystyle -\frac {i a^2 \int \frac {1}{a^2-b^2-(-i b \cosh (x)-i a \sinh (x))^2}d(-i b \cosh (x)-i a \sinh (x))}{a^2-b^2}+\frac {a \sinh (x)}{a^2-b^2}-\frac {b \cosh (x)}{a^2-b^2}\) |
\(\Big \downarrow \) 219 |
\(\displaystyle -\frac {i a^2 \text {arctanh}\left (\frac {-i a \sinh (x)-i b \cosh (x)}{\sqrt {a^2-b^2}}\right )}{\left (a^2-b^2\right )^{3/2}}+\frac {a \sinh (x)}{a^2-b^2}-\frac {b \cosh (x)}{a^2-b^2}\) |
Input:
Int[Sinh[x]^2/(a*Cosh[x] + b*Sinh[x]),x]
Output:
((-I)*a^2*ArcTanh[((-I)*b*Cosh[x] - I*a*Sinh[x])/Sqrt[a^2 - b^2]])/(a^2 - b^2)^(3/2) - (b*Cosh[x])/(a^2 - b^2) + (a*Sinh[x])/(a^2 - b^2)
Int[(Complex[0, a_])*(Fx_), x_Symbol] :> Simp[(Complex[Identity[0], a]) I nt[Fx, x], x] /; FreeQ[a, x] && EqQ[a^2, 1]
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])
Int[(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x _Symbol] :> Simp[-d^(-1) Subst[Int[1/(a^2 + b^2 - x^2), x], x, b*Cos[c + d*x] - a*Sin[c + d*x]], x] /; FreeQ[{a, b, c, d}, x] && NeQ[a^2 + b^2, 0]
Int[sin[(c_.) + (d_.)*(x_)]^(m_)/(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin [(c_.) + (d_.)*(x_)]), x_Symbol] :> Simp[(-a)*(Sin[c + d*x]^(m - 1)/(d*(a^2 + b^2)*(m - 1))), x] + (Simp[a^2/(a^2 + b^2) Int[Sin[c + d*x]^(m - 2)/(a *Cos[c + d*x] + b*Sin[c + d*x]), x], x] + Simp[b/(a^2 + b^2) Int[Sin[c + d*x]^(m - 1), x], x]) /; FreeQ[{a, b, c, d}, x] && NeQ[a^2 + b^2, 0] && GtQ [m, 1]
Time = 0.34 (sec) , antiderivative size = 93, normalized size of antiderivative = 1.26
method | result | size |
default | \(-\frac {2 a^{2} \arctan \left (\frac {2 a \tanh \left (\frac {x}{2}\right )+2 b}{2 \sqrt {a^{2}-b^{2}}}\right )}{\left (a -b \right ) \left (a +b \right ) \sqrt {a^{2}-b^{2}}}-\frac {8}{\left (8 a -8 b \right ) \left (1+\tanh \left (\frac {x}{2}\right )\right )}-\frac {8}{\left (8 a +8 b \right ) \left (\tanh \left (\frac {x}{2}\right )-1\right )}\) | \(93\) |
risch | \(\frac {{\mathrm e}^{x}}{2 a +2 b}-\frac {{\mathrm e}^{-x}}{2 \left (a -b \right )}-\frac {a^{2} \ln \left ({\mathrm e}^{x}+\frac {a -b}{\sqrt {-a^{2}+b^{2}}}\right )}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right )}+\frac {a^{2} \ln \left ({\mathrm e}^{x}-\frac {a -b}{\sqrt {-a^{2}+b^{2}}}\right )}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right )}\) | \(122\) |
Input:
int(sinh(x)^2/(a*cosh(x)+b*sinh(x)),x,method=_RETURNVERBOSE)
Output:
-2*a^2/(a-b)/(a+b)/(a^2-b^2)^(1/2)*arctan(1/2*(2*a*tanh(1/2*x)+2*b)/(a^2-b ^2)^(1/2))-8/(8*a-8*b)/(1+tanh(1/2*x))-8/(8*a+8*b)/(tanh(1/2*x)-1)
Leaf count of result is larger than twice the leaf count of optimal. 190 vs. \(2 (70) = 140\).
Time = 0.12 (sec) , antiderivative size = 435, normalized size of antiderivative = 5.88 \[ \int \frac {\sinh ^2(x)}{a \cosh (x)+b \sinh (x)} \, dx=\left [-\frac {a^{3} + a^{2} b - a b^{2} - b^{3} - {\left (a^{3} - a^{2} b - a b^{2} + b^{3}\right )} \cosh \left (x\right )^{2} - 2 \, {\left (a^{3} - a^{2} b - a b^{2} + b^{3}\right )} \cosh \left (x\right ) \sinh \left (x\right ) - {\left (a^{3} - a^{2} b - a b^{2} + b^{3}\right )} \sinh \left (x\right )^{2} - 2 \, {\left (a^{2} \cosh \left (x\right ) + a^{2} \sinh \left (x\right )\right )} \sqrt {-a^{2} + b^{2}} \log \left (\frac {{\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} - 2 \, \sqrt {-a^{2} + b^{2}} {\left (\cosh \left (x\right ) + \sinh \left (x\right )\right )} - a + b}{{\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 )}{2 \, {\left ({\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} \cosh \left (x\right ) + {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} \sinh \left (x\right )\right )}}, -\frac {a^{3} + a^{2} b - a b^{2} - b^{3} - {\left (a^{3} - a^{2} b - a b^{2} + b^{3}\right )} \cosh \left (x\right )^{2} - 2 \, {\left (a^{3} - a^{2} b - a b^{2} + b^{3}\right )} \cosh \left (x\right ) \sinh \left (x\right ) - {\left (a^{3} - a^{2} b - a b^{2} + b^{3}\right )} \sinh \left (x\right )^{2} - 4 \, {\left (a^{2} \cosh \left (x\right ) + a^{2} \sinh \left (x\right )\right )} \sqrt {a^{2} - b^{2}} \arctan \left (\frac {\sqrt {a^{2} - b^{2}}}{{\left (a + b\right )} \cosh \left (x\right ) + {\left (a + b\right )} \sinh \left (x\right )}\right )}{2 \, {\left ({\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} \cosh \left (x\right ) + {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} \sinh \left (x\right )\right )}}\right ] \] Input:
integrate(sinh(x)^2/(a*cosh(x)+b*sinh(x)),x, algorithm="fricas")
Output:
[-1/2*(a^3 + a^2*b - a*b^2 - b^3 - (a^3 - a^2*b - a*b^2 + b^3)*cosh(x)^2 - 2*(a^3 - a^2*b - a*b^2 + b^3)*cosh(x)*sinh(x) - (a^3 - a^2*b - a*b^2 + b^ 3)*sinh(x)^2 - 2*(a^2*cosh(x) + a^2*sinh(x))*sqrt(-a^2 + b^2)*log(((a + b) *cosh(x)^2 + 2*(a + b)*cosh(x)*sinh(x) + (a + b)*sinh(x)^2 - 2*sqrt(-a^2 + b^2)*(cosh(x) + sinh(x)) - a + b)/((a + b)*cosh(x)^2 + 2*(a + b)*cosh(x)* sinh(x) + (a + b)*sinh(x)^2 + a - b)))/((a^4 - 2*a^2*b^2 + b^4)*cosh(x) + (a^4 - 2*a^2*b^2 + b^4)*sinh(x)), -1/2*(a^3 + a^2*b - a*b^2 - b^3 - (a^3 - a^2*b - a*b^2 + b^3)*cosh(x)^2 - 2*(a^3 - a^2*b - a*b^2 + b^3)*cosh(x)*si nh(x) - (a^3 - a^2*b - a*b^2 + b^3)*sinh(x)^2 - 4*(a^2*cosh(x) + a^2*sinh( x))*sqrt(a^2 - b^2)*arctan(sqrt(a^2 - b^2)/((a + b)*cosh(x) + (a + b)*sinh (x))))/((a^4 - 2*a^2*b^2 + b^4)*cosh(x) + (a^4 - 2*a^2*b^2 + b^4)*sinh(x)) ]
Leaf count of result is larger than twice the leaf count of optimal. 685 vs. \(2 (58) = 116\).
Time = 70.04 (sec) , antiderivative size = 685, normalized size of antiderivative = 9.26 \[ \int \frac {\sinh ^2(x)}{a \cosh (x)+b \sinh (x)} \, dx =\text {Too large to display} \] Input:
integrate(sinh(x)**2/(a*cosh(x)+b*sinh(x)),x)
Output:
Piecewise((zoo*cosh(x), Eq(a, 0) & Eq(b, 0)), (cosh(x)/b, Eq(a, 0)), (-sin h(x)**2/(-3*b*sinh(x) + 3*b*cosh(x)) - 2*sinh(x)*cosh(x)/(-3*b*sinh(x) + 3 *b*cosh(x)) + 2*cosh(x)**2/(-3*b*sinh(x) + 3*b*cosh(x)), Eq(a, -b)), (-sin h(x)**2/(3*b*sinh(x) + 3*b*cosh(x)) + 2*sinh(x)*cosh(x)/(3*b*sinh(x) + 3*b *cosh(x)) + 2*cosh(x)**2/(3*b*sinh(x) + 3*b*cosh(x)), Eq(a, b)), (-a**2*lo g(tanh(x/2) + b/a - sqrt(-a**2 + b**2)/a)*tanh(x/2)**2/(a**2*sqrt(-a**2 + b**2)*tanh(x/2)**2 - a**2*sqrt(-a**2 + b**2) - b**2*sqrt(-a**2 + b**2)*tan h(x/2)**2 + b**2*sqrt(-a**2 + b**2)) + a**2*log(tanh(x/2) + b/a - sqrt(-a* *2 + b**2)/a)/(a**2*sqrt(-a**2 + b**2)*tanh(x/2)**2 - a**2*sqrt(-a**2 + b* *2) - b**2*sqrt(-a**2 + b**2)*tanh(x/2)**2 + b**2*sqrt(-a**2 + b**2)) + a* *2*log(tanh(x/2) + b/a + sqrt(-a**2 + b**2)/a)*tanh(x/2)**2/(a**2*sqrt(-a* *2 + b**2)*tanh(x/2)**2 - a**2*sqrt(-a**2 + b**2) - b**2*sqrt(-a**2 + b**2 )*tanh(x/2)**2 + b**2*sqrt(-a**2 + b**2)) - a**2*log(tanh(x/2) + b/a + sqr t(-a**2 + b**2)/a)/(a**2*sqrt(-a**2 + b**2)*tanh(x/2)**2 - a**2*sqrt(-a**2 + b**2) - b**2*sqrt(-a**2 + b**2)*tanh(x/2)**2 + b**2*sqrt(-a**2 + b**2)) - 2*a*sqrt(-a**2 + b**2)*tanh(x/2)/(a**2*sqrt(-a**2 + b**2)*tanh(x/2)**2 - a**2*sqrt(-a**2 + b**2) - b**2*sqrt(-a**2 + b**2)*tanh(x/2)**2 + b**2*sq rt(-a**2 + b**2)) + 2*b*sqrt(-a**2 + b**2)/(a**2*sqrt(-a**2 + b**2)*tanh(x /2)**2 - a**2*sqrt(-a**2 + b**2) - b**2*sqrt(-a**2 + b**2)*tanh(x/2)**2 + b**2*sqrt(-a**2 + b**2)), True))
Exception generated. \[ \int \frac {\sinh ^2(x)}{a \cosh (x)+b \sinh (x)} \, dx=\text {Exception raised: ValueError} \] Input:
integrate(sinh(x)^2/(a*cosh(x)+b*sinh(x)),x, algorithm="maxima")
Output:
Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'assume' command before evaluation *may* help (example of legal syntax is 'assume(4*b^2-4*a^2>0)', see `assume?` f or more de
Time = 0.13 (sec) , antiderivative size = 61, normalized size of antiderivative = 0.82 \[ \int \frac {\sinh ^2(x)}{a \cosh (x)+b \sinh (x)} \, dx=-\frac {2 \, a^{2} \arctan \left (\frac {a e^{x} + b e^{x}}{\sqrt {a^{2} - b^{2}}}\right )}{{\left (a^{2} - b^{2}\right )}^{\frac {3}{2}}} - \frac {e^{\left (-x\right )}}{2 \, {\left (a - b\right )}} + \frac {e^{x}}{2 \, {\left (a + b\right )}} \] Input:
integrate(sinh(x)^2/(a*cosh(x)+b*sinh(x)),x, algorithm="giac")
Output:
-2*a^2*arctan((a*e^x + b*e^x)/sqrt(a^2 - b^2))/(a^2 - b^2)^(3/2) - 1/2*e^( -x)/(a - b) + 1/2*e^x/(a + b)
Time = 1.09 (sec) , antiderivative size = 157, normalized size of antiderivative = 2.12 \[ \int \frac {\sinh ^2(x)}{a \cosh (x)+b \sinh (x)} \, dx=\frac {{\mathrm {e}}^x}{2\,a+2\,b}-\frac {{\mathrm {e}}^{-x}}{2\,a-2\,b}-\frac {a^2\,\ln \left (-\frac {2\,a^2}{{\left (a+b\right )}^{5/2}\,\sqrt {b-a}}-\frac {2\,a^2\,{\mathrm {e}}^x}{-a^3-a^2\,b+a\,b^2+b^3}\right )}{{\left (a+b\right )}^{3/2}\,{\left (b-a\right )}^{3/2}}+\frac {a^2\,\ln \left (\frac {2\,a^2}{{\left (a+b\right )}^{5/2}\,\sqrt {b-a}}-\frac {2\,a^2\,{\mathrm {e}}^x}{-a^3-a^2\,b+a\,b^2+b^3}\right )}{{\left (a+b\right )}^{3/2}\,{\left (b-a\right )}^{3/2}} \] Input:
int(sinh(x)^2/(a*cosh(x) + b*sinh(x)),x)
Output:
exp(x)/(2*a + 2*b) - exp(-x)/(2*a - 2*b) - (a^2*log(- (2*a^2)/((a + b)^(5/ 2)*(b - a)^(1/2)) - (2*a^2*exp(x))/(a*b^2 - a^2*b - a^3 + b^3)))/((a + b)^ (3/2)*(b - a)^(3/2)) + (a^2*log((2*a^2)/((a + b)^(5/2)*(b - a)^(1/2)) - (2 *a^2*exp(x))/(a*b^2 - a^2*b - a^3 + b^3)))/((a + b)^(3/2)*(b - a)^(3/2))
Time = 0.22 (sec) , antiderivative size = 127, normalized size of antiderivative = 1.72 \[ \int \frac {\sinh ^2(x)}{a \cosh (x)+b \sinh (x)} \, dx=\frac {-4 e^{x} \sqrt {a^{2}-b^{2}}\, \mathit {atan} \left (\frac {e^{x} a +e^{x} b}{\sqrt {a^{2}-b^{2}}}\right ) a^{2}+e^{2 x} a^{3}-e^{2 x} a^{2} b -e^{2 x} a \,b^{2}+e^{2 x} b^{3}-a^{3}-a^{2} b +a \,b^{2}+b^{3}}{2 e^{x} \left (a^{4}-2 a^{2} b^{2}+b^{4}\right )} \] Input:
int(sinh(x)^2/(a*cosh(x)+b*sinh(x)),x)
Output:
( - 4*e**x*sqrt(a**2 - b**2)*atan((e**x*a + e**x*b)/sqrt(a**2 - b**2))*a** 2 + e**(2*x)*a**3 - e**(2*x)*a**2*b - e**(2*x)*a*b**2 + e**(2*x)*b**3 - a* *3 - a**2*b + a*b**2 + b**3)/(2*e**x*(a**4 - 2*a**2*b**2 + b**4))