\(\int \frac {\cosh ^2(x)}{a+b \cosh (x)+c \cosh ^2(x)} \, dx\) [834]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F(-1)]
   Maxima [F]
   Giac [A] (verification not implemented)
   Mupad [F(-1)]

Optimal result

Integrand size = 19, antiderivative size = 255 \[ \int \frac {\cosh ^2(x)}{a+b \cosh (x)+c \cosh ^2(x)} \, dx=\frac {x}{c}-\frac {2 \left (b-\frac {b^2-2 a c}{\sqrt {b^2-4 a c}}\right ) \text {arctanh}\left (\frac {\sqrt {b-2 c-\sqrt {b^2-4 a c}} \tanh \left (\frac {x}{2}\right )}{\sqrt {b+2 c-\sqrt {b^2-4 a c}}}\right )}{c \sqrt {b-2 c-\sqrt {b^2-4 a c}} \sqrt {b+2 c-\sqrt {b^2-4 a c}}}-\frac {2 \left (b+\frac {b^2-2 a c}{\sqrt {b^2-4 a c}}\right ) \text {arctanh}\left (\frac {\sqrt {b-2 c+\sqrt {b^2-4 a c}} \tanh \left (\frac {x}{2}\right )}{\sqrt {b+2 c+\sqrt {b^2-4 a c}}}\right )}{c \sqrt {b-2 c+\sqrt {b^2-4 a c}} \sqrt {b+2 c+\sqrt {b^2-4 a c}}} \]

[Out]

x/c-2*arctanh((b-2*c-(-4*a*c+b^2)^(1/2))^(1/2)*tanh(1/2*x)/(b+2*c-(-4*a*c+b^2)^(1/2))^(1/2))*(b+(2*a*c-b^2)/(-
4*a*c+b^2)^(1/2))/c/(b-2*c-(-4*a*c+b^2)^(1/2))^(1/2)/(b+2*c-(-4*a*c+b^2)^(1/2))^(1/2)-2*arctanh((b-2*c+(-4*a*c
+b^2)^(1/2))^(1/2)*tanh(1/2*x)/(b+2*c+(-4*a*c+b^2)^(1/2))^(1/2))*(b+(-2*a*c+b^2)/(-4*a*c+b^2)^(1/2))/c/(b-2*c+
(-4*a*c+b^2)^(1/2))^(1/2)/(b+2*c+(-4*a*c+b^2)^(1/2))^(1/2)

Rubi [A] (verified)

Time = 0.78 (sec) , antiderivative size = 255, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.211, Rules used = {3338, 3374, 2738, 214} \[ \int \frac {\cosh ^2(x)}{a+b \cosh (x)+c \cosh ^2(x)} \, dx=-\frac {2 \left (b-\frac {b^2-2 a c}{\sqrt {b^2-4 a c}}\right ) \text {arctanh}\left (\frac {\tanh \left (\frac {x}{2}\right ) \sqrt {-\sqrt {b^2-4 a c}+b-2 c}}{\sqrt {-\sqrt {b^2-4 a c}+b+2 c}}\right )}{c \sqrt {-\sqrt {b^2-4 a c}+b-2 c} \sqrt {-\sqrt {b^2-4 a c}+b+2 c}}-\frac {2 \left (\frac {b^2-2 a c}{\sqrt {b^2-4 a c}}+b\right ) \text {arctanh}\left (\frac {\tanh \left (\frac {x}{2}\right ) \sqrt {\sqrt {b^2-4 a c}+b-2 c}}{\sqrt {\sqrt {b^2-4 a c}+b+2 c}}\right )}{c \sqrt {\sqrt {b^2-4 a c}+b-2 c} \sqrt {\sqrt {b^2-4 a c}+b+2 c}}+\frac {x}{c} \]

[In]

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

[Out]

x/c - (2*(b - (b^2 - 2*a*c)/Sqrt[b^2 - 4*a*c])*ArcTanh[(Sqrt[b - 2*c - Sqrt[b^2 - 4*a*c]]*Tanh[x/2])/Sqrt[b +
2*c - Sqrt[b^2 - 4*a*c]]])/(c*Sqrt[b - 2*c - Sqrt[b^2 - 4*a*c]]*Sqrt[b + 2*c - Sqrt[b^2 - 4*a*c]]) - (2*(b + (
b^2 - 2*a*c)/Sqrt[b^2 - 4*a*c])*ArcTanh[(Sqrt[b - 2*c + Sqrt[b^2 - 4*a*c]]*Tanh[x/2])/Sqrt[b + 2*c + Sqrt[b^2
- 4*a*c]]])/(c*Sqrt[b - 2*c + Sqrt[b^2 - 4*a*c]]*Sqrt[b + 2*c + Sqrt[b^2 - 4*a*c]])

Rule 214

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

Rule 2738

Int[((a_) + (b_.)*sin[Pi/2 + (c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = FreeFactors[Tan[(c + d*x)/2], x
]}, Dist[2*(e/d), Subst[Int[1/(a + b + (a - b)*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}
, x] && NeQ[a^2 - b^2, 0]

Rule 3338

Int[cos[(d_.) + (e_.)*(x_)]^(m_.)*((a_.) + cos[(d_.) + (e_.)*(x_)]^(n_.)*(b_.) + cos[(d_.) + (e_.)*(x_)]^(n2_.
)*(c_.))^(p_), x_Symbol] :> Int[ExpandTrig[cos[d + e*x]^m*(a + b*cos[d + e*x]^n + c*cos[d + e*x]^(2*n))^p, x],
 x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[n2, 2*n] && NeQ[b^2 - 4*a*c, 0] && IntegersQ[m, n, p]

Rule 3374

Int[(cos[(d_.) + (e_.)*(x_)]*(B_.) + (A_))/((a_.) + cos[(d_.) + (e_.)*(x_)]*(b_.) + cos[(d_.) + (e_.)*(x_)]^2*
(c_.)), x_Symbol] :> Module[{q = Rt[b^2 - 4*a*c, 2]}, Dist[B + (b*B - 2*A*c)/q, Int[1/(b + q + 2*c*Cos[d + e*x
]), x], x] + Dist[B - (b*B - 2*A*c)/q, Int[1/(b - q + 2*c*Cos[d + e*x]), x], x]] /; FreeQ[{a, b, c, d, e, A, B
}, x] && NeQ[b^2 - 4*a*c, 0]

Rubi steps \begin{align*} \text {integral}& = \int \left (\frac {1}{c}+\frac {-a-b \cosh (x)}{c \left (a+b \cosh (x)+c \cosh ^2(x)\right )}\right ) \, dx \\ & = \frac {x}{c}+\frac {\int \frac {-a-b \cosh (x)}{a+b \cosh (x)+c \cosh ^2(x)} \, dx}{c} \\ & = \frac {x}{c}-\frac {\left (b-\frac {b^2-2 a c}{\sqrt {b^2-4 a c}}\right ) \int \frac {1}{b-\sqrt {b^2-4 a c}+2 c \cosh (x)} \, dx}{c}-\frac {\left (b+\frac {b^2-2 a c}{\sqrt {b^2-4 a c}}\right ) \int \frac {1}{b+\sqrt {b^2-4 a c}+2 c \cosh (x)} \, dx}{c} \\ & = \frac {x}{c}-\frac {\left (2 \left (b-\frac {b^2-2 a c}{\sqrt {b^2-4 a c}}\right )\right ) \text {Subst}\left (\int \frac {1}{b+2 c-\sqrt {b^2-4 a c}-\left (b-2 c-\sqrt {b^2-4 a c}\right ) x^2} \, dx,x,\tanh \left (\frac {x}{2}\right )\right )}{c}-\frac {\left (2 \left (b+\frac {b^2-2 a c}{\sqrt {b^2-4 a c}}\right )\right ) \text {Subst}\left (\int \frac {1}{b+2 c+\sqrt {b^2-4 a c}-\left (b-2 c+\sqrt {b^2-4 a c}\right ) x^2} \, dx,x,\tanh \left (\frac {x}{2}\right )\right )}{c} \\ & = \frac {x}{c}-\frac {2 \left (b-\frac {b^2-2 a c}{\sqrt {b^2-4 a c}}\right ) \text {arctanh}\left (\frac {\sqrt {b-2 c-\sqrt {b^2-4 a c}} \tanh \left (\frac {x}{2}\right )}{\sqrt {b+2 c-\sqrt {b^2-4 a c}}}\right )}{c \sqrt {b-2 c-\sqrt {b^2-4 a c}} \sqrt {b+2 c-\sqrt {b^2-4 a c}}}-\frac {2 \left (b+\frac {b^2-2 a c}{\sqrt {b^2-4 a c}}\right ) \text {arctanh}\left (\frac {\sqrt {b-2 c+\sqrt {b^2-4 a c}} \tanh \left (\frac {x}{2}\right )}{\sqrt {b+2 c+\sqrt {b^2-4 a c}}}\right )}{c \sqrt {b-2 c+\sqrt {b^2-4 a c}} \sqrt {b+2 c+\sqrt {b^2-4 a c}}} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.75 (sec) , antiderivative size = 264, normalized size of antiderivative = 1.04 \[ \int \frac {\cosh ^2(x)}{a+b \cosh (x)+c \cosh ^2(x)} \, dx=\frac {x+\frac {\sqrt {2} \left (b^2-2 a c+b \sqrt {b^2-4 a c}\right ) \arctan \left (\frac {\left (b-2 c+\sqrt {b^2-4 a c}\right ) \tanh \left (\frac {x}{2}\right )}{\sqrt {-2 b^2+4 c (a+c)-2 b \sqrt {b^2-4 a c}}}\right )}{\sqrt {b^2-4 a c} \sqrt {-b^2+2 c (a+c)-b \sqrt {b^2-4 a c}}}-\frac {\sqrt {2} \left (-b^2+2 a c+b \sqrt {b^2-4 a c}\right ) \arctan \left (\frac {\left (-b+2 c+\sqrt {b^2-4 a c}\right ) \tanh \left (\frac {x}{2}\right )}{\sqrt {-2 b^2+4 c (a+c)+2 b \sqrt {b^2-4 a c}}}\right )}{\sqrt {b^2-4 a c} \sqrt {-b^2+2 c (a+c)+b \sqrt {b^2-4 a c}}}}{c} \]

[In]

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

[Out]

(x + (Sqrt[2]*(b^2 - 2*a*c + b*Sqrt[b^2 - 4*a*c])*ArcTan[((b - 2*c + Sqrt[b^2 - 4*a*c])*Tanh[x/2])/Sqrt[-2*b^2
 + 4*c*(a + c) - 2*b*Sqrt[b^2 - 4*a*c]]])/(Sqrt[b^2 - 4*a*c]*Sqrt[-b^2 + 2*c*(a + c) - b*Sqrt[b^2 - 4*a*c]]) -
 (Sqrt[2]*(-b^2 + 2*a*c + b*Sqrt[b^2 - 4*a*c])*ArcTan[((-b + 2*c + Sqrt[b^2 - 4*a*c])*Tanh[x/2])/Sqrt[-2*b^2 +
 4*c*(a + c) + 2*b*Sqrt[b^2 - 4*a*c]]])/(Sqrt[b^2 - 4*a*c]*Sqrt[-b^2 + 2*c*(a + c) + b*Sqrt[b^2 - 4*a*c]]))/c

Maple [A] (verified)

Time = 0.91 (sec) , antiderivative size = 274, normalized size of antiderivative = 1.07

method result size
default \(-\frac {\ln \left (\tanh \left (\frac {x}{2}\right )-1\right )}{c}+\frac {2 \left (a -b +c \right ) \left (\frac {\left (a \sqrt {-4 a c +b^{2}}-b \sqrt {-4 a c +b^{2}}-a b -2 a c +b^{2}\right ) \operatorname {arctanh}\left (\frac {\left (-a +b -c \right ) \tanh \left (\frac {x}{2}\right )}{\sqrt {\left (\sqrt {-4 a c +b^{2}}+a -c \right ) \left (a -b +c \right )}}\right )}{2 \sqrt {-4 a c +b^{2}}\, \left (a -b +c \right ) \sqrt {\left (\sqrt {-4 a c +b^{2}}+a -c \right ) \left (a -b +c \right )}}+\frac {\left (a \sqrt {-4 a c +b^{2}}-b \sqrt {-4 a c +b^{2}}+a b +2 a c -b^{2}\right ) \arctan \left (\frac {\left (a -b +c \right ) \tanh \left (\frac {x}{2}\right )}{\sqrt {\left (\sqrt {-4 a c +b^{2}}-a +c \right ) \left (a -b +c \right )}}\right )}{2 \sqrt {-4 a c +b^{2}}\, \left (a -b +c \right ) \sqrt {\left (\sqrt {-4 a c +b^{2}}-a +c \right ) \left (a -b +c \right )}}\right )}{c}+\frac {\ln \left (1+\tanh \left (\frac {x}{2}\right )\right )}{c}\) \(274\)
risch \(\text {Expression too large to display}\) \(1158\)

[In]

int(cosh(x)^2/(a+b*cosh(x)+c*cosh(x)^2),x,method=_RETURNVERBOSE)

[Out]

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 5079 vs. \(2 (215) = 430\).

Time = 0.58 (sec) , antiderivative size = 5079, normalized size of antiderivative = 19.92 \[ \int \frac {\cosh ^2(x)}{a+b \cosh (x)+c \cosh ^2(x)} \, dx=\text {Too large to display} \]

[In]

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

[Out]

Too large to include

Sympy [F(-1)]

Timed out. \[ \int \frac {\cosh ^2(x)}{a+b \cosh (x)+c \cosh ^2(x)} \, dx=\text {Timed out} \]

[In]

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

[Out]

Timed out

Maxima [F]

\[ \int \frac {\cosh ^2(x)}{a+b \cosh (x)+c \cosh ^2(x)} \, dx=\int { \frac {\cosh \left (x\right )^{2}}{c \cosh \left (x\right )^{2} + b \cosh \left (x\right ) + a} \,d x } \]

[In]

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

[Out]

x/c - 1/4*integrate(8*(b*e^(3*x) + 2*a*e^(2*x) + b*e^x)/(c^2*e^(4*x) + 2*b*c*e^(3*x) + 2*b*c*e^x + c^2 + 2*(2*
a*c + c^2)*e^(2*x)), x)

Giac [A] (verification not implemented)

none

Time = 0.73 (sec) , antiderivative size = 5, normalized size of antiderivative = 0.02 \[ \int \frac {\cosh ^2(x)}{a+b \cosh (x)+c \cosh ^2(x)} \, dx=\frac {x}{c} \]

[In]

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

[Out]

x/c

Mupad [F(-1)]

Timed out. \[ \int \frac {\cosh ^2(x)}{a+b \cosh (x)+c \cosh ^2(x)} \, dx=\text {Hanged} \]

[In]

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

[Out]

\text{Hanged}