Optimal. Leaf size=255 \[ \frac {x}{c}-\frac {2 \left (b-\frac {b^2-2 a c}{\sqrt {b^2-4 a c}}\right ) \tanh ^{-1}\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 ) \tanh ^{-1}\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]
________________________________________________________________________________________
Rubi [A]
time = 0.86, antiderivative size = 255, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 4, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.210, Rules used = {3338, 3374,
2738, 214} \begin {gather*} -\frac {2 \left (b-\frac {b^2-2 a c}{\sqrt {b^2-4 a c}}\right ) \tanh ^{-1}\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 ) \tanh ^{-1}\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} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 214
Rule 2738
Rule 3338
Rule 3374
Rubi steps
\begin {align*} \int \frac {\cosh ^2(x)}{a+b \cosh (x)+c \cosh ^2(x)} \, dx &=\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 ) \tanh ^{-1}\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 ) \tanh ^{-1}\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]
time = 0.36, size = 264, normalized size = 1.04 \begin {gather*} \frac {x+\frac {\sqrt {2} \left (b^2-2 a c+b \sqrt {b^2-4 a c}\right ) \text {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 ) \text {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} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 2.26, size = 274, normalized size = 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 ) \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 (\tanh \left (\frac {x}{2}\right )-1\right )}{c}\) | \(274\) |
risch | \(\frac {x}{c}+\left (\munderset {\textit {\_R} =\RootOf \left (\left (16 a^{4} c^{4}-8 a^{3} b^{2} c^{3}+32 a^{3} c^{5}+a^{2} b^{4} c^{2}-32 a^{2} b^{2} c^{4}+16 a^{2} c^{6}+10 a \,b^{4} c^{3}-8 a \,b^{2} c^{5}-b^{6} c^{2}+b^{4} c^{4}\right ) \textit {\_Z}^{4}+\left (-8 a^{4} c^{2}+6 a^{3} b^{2} c -8 a^{3} c^{3}-a^{2} b^{4}+18 a^{2} b^{2} c^{2}-8 a \,b^{4} c +b^{6}\right ) \textit {\_Z}^{2}+a^{4}\right )}{\sum }\textit {\_R} \ln \left ({\mathrm e}^{x}+\left (\frac {2 c^{2} a^{4} b^{2}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}+\frac {18 c^{3} a^{3} b^{2}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}-\frac {3 c^{2} a^{2} b^{4}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}+\frac {22 c^{4} a^{2} b^{2}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}-\frac {8 c^{3} a \,b^{4}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}+\frac {6 c^{5} b^{2} a}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}-\frac {8 c^{3} a^{5}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}-\frac {24 c^{4} a^{4}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}-\frac {24 c^{5} a^{3}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}-\frac {8 c^{6} a^{2}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}+\frac {c^{2} b^{6}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}-\frac {c^{4} b^{4}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}\right ) \textit {\_R}^{3}+\left (\frac {c^{3} b^{2} a^{2}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}+\frac {c \,a^{4} b^{2}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}+\frac {6 c^{2} a^{3} b^{2}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}-\frac {c \,a^{2} b^{4}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}-\frac {4 c^{2} a^{5}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}-\frac {8 c^{3} a^{4}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}-\frac {4 c^{4} a^{3}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}\right ) \textit {\_R}^{2}+\left (-\frac {b^{6}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}-\frac {8 c \,a^{3} b^{2}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}-\frac {9 c^{2} b^{2} a^{2}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}+\frac {6 c \,b^{4} a}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}+\frac {2 a^{2} b^{4}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}+\frac {2 c \,a^{5}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}-\frac {a^{4} b^{2}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}+\frac {4 a^{4} c^{2}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}+\frac {2 c^{3} a^{3}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}\right ) \textit {\_R} +\frac {a^{5}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}+\frac {a^{4} c}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}-\frac {a^{3} b^{2}}{a^{4} b +2 a^{3} b c -a^{2} b^{3}}\right )\right )\) | \(1158\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 5079 vs.
\(2 (215) = 430\).
time = 0.70, size = 5079, normalized size = 19.92 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.80, size = 5, normalized size = 0.02 \begin {gather*} \frac {x}{c} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F(-1)]
time = 0.00, size = -1, normalized size = -0.00 \begin {gather*} \text {Hanged} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________