3.647 \(\int (a \coth (x)+b \text {csch}(x))^2 \, dx\)

Optimal. Leaf size=27 \[ a^2 x+a b \sinh (x)-\text {csch}(x) (a \cosh (x)+b) (a+b \cosh (x)) \]

[Out]

a^2*x-(b+a*cosh(x))*(a+b*cosh(x))*csch(x)+a*b*sinh(x)

________________________________________________________________________________________

Rubi [A]  time = 0.07, antiderivative size = 27, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.273, Rules used = {4392, 2691, 2637} \[ a^2 x+a b \sinh (x)-\text {csch}(x) (a \cosh (x)+b) (a+b \cosh (x)) \]

Antiderivative was successfully verified.

[In]

Int[(a*Coth[x] + b*Csch[x])^2,x]

[Out]

a^2*x - (b + a*Cosh[x])*(a + b*Cosh[x])*Csch[x] + a*b*Sinh[x]

Rule 2637

Int[sin[Pi/2 + (c_.) + (d_.)*(x_)], x_Symbol] :> Simp[Sin[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 2691

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_), x_Symbol] :> -Simp[((g*C
os[e + f*x])^(p + 1)*(a + b*Sin[e + f*x])^(m - 1)*(b + a*Sin[e + f*x]))/(f*g*(p + 1)), x] + Dist[1/(g^2*(p + 1
)), Int[(g*Cos[e + f*x])^(p + 2)*(a + b*Sin[e + f*x])^(m - 2)*(b^2*(m - 1) + a^2*(p + 2) + a*b*(m + p + 1)*Sin
[e + f*x]), x], x] /; FreeQ[{a, b, e, f, g}, x] && NeQ[a^2 - b^2, 0] && GtQ[m, 1] && LtQ[p, -1] && (IntegersQ[
2*m, 2*p] || IntegerQ[m])

Rule 4392

Int[(cot[(c_.) + (d_.)*(x_)]^(n_.)*(a_.) + csc[(c_.) + (d_.)*(x_)]^(n_.)*(b_.))^(p_)*(u_.), x_Symbol] :> Int[A
ctivateTrig[u]*Csc[c + d*x]^(n*p)*(b + a*Cos[c + d*x]^n)^p, x] /; FreeQ[{a, b, c, d}, x] && IntegersQ[n, p]

Rubi steps

\begin {align*} \int (a \coth (x)+b \text {csch}(x))^2 \, dx &=-\int (i b+i a \cosh (x))^2 \text {csch}^2(x) \, dx\\ &=-(b+a \cosh (x)) (a+b \cosh (x)) \text {csch}(x)-\int \left (-a^2-a b \cosh (x)\right ) \, dx\\ &=a^2 x-(b+a \cosh (x)) (a+b \cosh (x)) \text {csch}(x)+(a b) \int \cosh (x) \, dx\\ &=a^2 x-(b+a \cosh (x)) (a+b \cosh (x)) \text {csch}(x)+a b \sinh (x)\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.13, size = 23, normalized size = 0.85 \[ a (a x-2 b \text {csch}(x))-\left (a^2+b^2\right ) \coth (x) \]

Antiderivative was successfully verified.

[In]

Integrate[(a*Coth[x] + b*Csch[x])^2,x]

[Out]

-((a^2 + b^2)*Coth[x]) + a*(a*x - 2*b*Csch[x])

________________________________________________________________________________________

fricas [A]  time = 0.40, size = 37, normalized size = 1.37 \[ -\frac {2 \, a b + {\left (a^{2} + b^{2}\right )} \cosh \relax (x) - {\left (a^{2} x + a^{2} + b^{2}\right )} \sinh \relax (x)}{\sinh \relax (x)} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a*coth(x)+b*csch(x))^2,x, algorithm="fricas")

[Out]

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

________________________________________________________________________________________

giac [A]  time = 0.13, size = 29, normalized size = 1.07 \[ a^{2} x - \frac {2 \, {\left (2 \, a b e^{x} + a^{2} + b^{2}\right )}}{e^{\left (2 \, x\right )} - 1} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a*coth(x)+b*csch(x))^2,x, algorithm="giac")

[Out]

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

________________________________________________________________________________________

maple [A]  time = 0.34, size = 27, normalized size = 1.00 \[ a^{2} \left (x -\coth \relax (x )\right )-\frac {2 a b}{\sinh \relax (x )}-b^{2} \coth \relax (x ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a*coth(x)+b*csch(x))^2,x)

[Out]

a^2*(x-coth(x))-2*a*b/sinh(x)-b^2*coth(x)

________________________________________________________________________________________

maxima [A]  time = 0.45, size = 45, normalized size = 1.67 \[ a^{2} {\left (x + \frac {2}{e^{\left (-2 \, x\right )} - 1}\right )} + \frac {4 \, a b}{e^{\left (-x\right )} - e^{x}} + \frac {2 \, b^{2}}{e^{\left (-2 \, x\right )} - 1} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a*coth(x)+b*csch(x))^2,x, algorithm="maxima")

[Out]

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

________________________________________________________________________________________

mupad [B]  time = 1.61, size = 33, normalized size = 1.22 \[ a^2\,x-\frac {2\,a^2+4\,{\mathrm {e}}^x\,a\,b+2\,b^2}{{\mathrm {e}}^{2\,x}-1} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

a^2*x - (2*a^2 + 2*b^2 + 4*a*b*exp(x))/(exp(2*x) - 1)

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \left (a \coth {\relax (x )} + b \operatorname {csch}{\relax (x )}\right )^{2}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a*coth(x)+b*csch(x))**2,x)

[Out]

Integral((a*coth(x) + b*csch(x))**2, x)

________________________________________________________________________________________