Optimal. Leaf size=94 \[ \frac {x}{a}+\frac {\left (2 a^2-3 b^2\right ) \text {ArcTan}(\sinh (x))}{2 b^3}-\frac {2 (a-b)^{3/2} (a+b)^{3/2} \text {ArcTan}\left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{a b^3}-\frac {a \tanh (x)}{b^2}+\frac {\text {sech}(x) \tanh (x)}{2 b} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.21, antiderivative size = 94, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 6, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.462, Rules used = {3983, 2972,
3136, 2738, 211, 3855} \begin {gather*} \frac {\left (2 a^2-3 b^2\right ) \text {ArcTan}(\sinh (x))}{2 b^3}-\frac {2 (a-b)^{3/2} (a+b)^{3/2} \text {ArcTan}\left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{a b^3}-\frac {a \tanh (x)}{b^2}+\frac {x}{a}+\frac {\tanh (x) \text {sech}(x)}{2 b} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 211
Rule 2738
Rule 2972
Rule 3136
Rule 3855
Rule 3983
Rubi steps
\begin {align*} \int \frac {\tanh ^4(x)}{a+b \text {sech}(x)} \, dx &=\int \frac {\sinh (x) \tanh ^3(x)}{b+a \cosh (x)} \, dx\\ &=-\frac {a \tanh (x)}{b^2}+\frac {\text {sech}(x) \tanh (x)}{2 b}-\frac {\int \frac {\left (-2 a^2+3 b^2-a b \cosh (x)-2 b^2 \cosh ^2(x)\right ) \text {sech}(x)}{b+a \cosh (x)} \, dx}{2 b^2}\\ &=\frac {x}{a}-\frac {a \tanh (x)}{b^2}+\frac {\text {sech}(x) \tanh (x)}{2 b}-\frac {\left (a^2-b^2\right )^2 \int \frac {1}{b+a \cosh (x)} \, dx}{a b^3}-\frac {\left (-2 a^2+3 b^2\right ) \int \text {sech}(x) \, dx}{2 b^3}\\ &=\frac {x}{a}+\frac {\left (2 a^2-3 b^2\right ) \tan ^{-1}(\sinh (x))}{2 b^3}-\frac {a \tanh (x)}{b^2}+\frac {\text {sech}(x) \tanh (x)}{2 b}-\frac {\left (2 \left (a^2-b^2\right )^2\right ) \text {Subst}\left (\int \frac {1}{a+b-(-a+b) x^2} \, dx,x,\tanh \left (\frac {x}{2}\right )\right )}{a b^3}\\ &=\frac {x}{a}+\frac {\left (2 a^2-3 b^2\right ) \tan ^{-1}(\sinh (x))}{2 b^3}-\frac {2 (a-b)^{3/2} (a+b)^{3/2} \tan ^{-1}\left (\frac {\sqrt {a-b} \tanh \left (\frac {x}{2}\right )}{\sqrt {a+b}}\right )}{a b^3}-\frac {a \tanh (x)}{b^2}+\frac {\text {sech}(x) \tanh (x)}{2 b}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.28, size = 113, normalized size = 1.20 \begin {gather*} \frac {(b+a \cosh (x)) \text {sech}^2(x) \left (2 \left (b^3 x+a \left (2 a^2-3 b^2\right ) \text {ArcTan}\left (\tanh \left (\frac {x}{2}\right )\right )+2 \left (a^2-b^2\right )^{3/2} \text {ArcTan}\left (\frac {(-a+b) \tanh \left (\frac {x}{2}\right )}{\sqrt {a^2-b^2}}\right )\right ) \cosh (x)+a b (-2 a \sinh (x)+b \tanh (x))\right )}{2 a b^3 (a+b \text {sech}(x))} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 1.02, size = 152, normalized size = 1.62
method | result | size |
default | \(-\frac {2 \left (a -b \right )^{2} \left (a^{2}+2 a b +b^{2}\right ) \arctan \left (\frac {\left (a -b \right ) \tanh \left (\frac {x}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{a \,b^{3} \sqrt {\left (a +b \right ) \left (a -b \right )}}+\frac {\frac {2 \left (\left (-a b -\frac {1}{2} b^{2}\right ) \left (\tanh ^{3}\left (\frac {x}{2}\right )\right )+\left (-a b +\frac {1}{2} b^{2}\right ) \tanh \left (\frac {x}{2}\right )\right )}{\left (\tanh ^{2}\left (\frac {x}{2}\right )+1\right )^{2}}+\left (2 a^{2}-3 b^{2}\right ) \arctan \left (\tanh \left (\frac {x}{2}\right )\right )}{b^{3}}-\frac {\ln \left (\tanh \left (\frac {x}{2}\right )-1\right )}{a}+\frac {\ln \left (\tanh \left (\frac {x}{2}\right )+1\right )}{a}\) | \(152\) |
risch | \(\frac {x}{a}+\frac {b \,{\mathrm e}^{3 x}+2 \,{\mathrm e}^{2 x} a -{\mathrm e}^{x} b +2 a}{\left (1+{\mathrm e}^{2 x}\right )^{2} b^{2}}+\frac {\sqrt {-a^{2}+b^{2}}\, a \ln \left ({\mathrm e}^{x}-\frac {\sqrt {-a^{2}+b^{2}}-b}{a}\right )}{b^{3}}-\frac {\sqrt {-a^{2}+b^{2}}\, \ln \left ({\mathrm e}^{x}-\frac {\sqrt {-a^{2}+b^{2}}-b}{a}\right )}{b a}-\frac {\sqrt {-a^{2}+b^{2}}\, a \ln \left ({\mathrm e}^{x}+\frac {b +\sqrt {-a^{2}+b^{2}}}{a}\right )}{b^{3}}+\frac {\sqrt {-a^{2}+b^{2}}\, \ln \left ({\mathrm e}^{x}+\frac {b +\sqrt {-a^{2}+b^{2}}}{a}\right )}{b a}+\frac {i \ln \left ({\mathrm e}^{x}+i\right ) a^{2}}{b^{3}}-\frac {3 i \ln \left ({\mathrm e}^{x}+i\right )}{2 b}-\frac {i \ln \left ({\mathrm e}^{x}-i\right ) a^{2}}{b^{3}}+\frac {3 i \ln \left ({\mathrm e}^{x}-i\right )}{2 b}\) | \(255\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \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. 587 vs.
\(2 (80) = 160\).
time = 0.46, size = 1254, normalized size = 13.34 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\tanh ^{4}{\left (x \right )}}{a + b \operatorname {sech}{\left (x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.39, size = 111, normalized size = 1.18 \begin {gather*} \frac {x}{a} + \frac {{\left (2 \, a^{2} - 3 \, b^{2}\right )} \arctan \left (e^{x}\right )}{b^{3}} - \frac {2 \, {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} \arctan \left (\frac {a e^{x} + b}{\sqrt {a^{2} - b^{2}}}\right )}{\sqrt {a^{2} - b^{2}} a b^{3}} + \frac {b e^{\left (3 \, x\right )} + 2 \, a e^{\left (2 \, x\right )} - b e^{x} + 2 \, a}{b^{2} {\left (e^{\left (2 \, x\right )} + 1\right )}^{2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 7.26, size = 700, normalized size = 7.45 \begin {gather*} \frac {\frac {2\,a}{b^2}+\frac {{\mathrm {e}}^x}{b}}{{\mathrm {e}}^{2\,x}+1}+\frac {x}{a}-\frac {\ln \left ({\mathrm {e}}^x-\mathrm {i}\right )\,\left (a^2\,2{}\mathrm {i}-b^2\,3{}\mathrm {i}\right )}{2\,b^3}+\frac {\ln \left ({\mathrm {e}}^x+1{}\mathrm {i}\right )\,\left (a^2\,2{}\mathrm {i}-b^2\,3{}\mathrm {i}\right )}{2\,b^3}-\frac {2\,{\mathrm {e}}^x}{b\,\left (2\,{\mathrm {e}}^{2\,x}+{\mathrm {e}}^{4\,x}+1\right )}+\frac {\ln \left (\frac {\left (\frac {64\,a^8+96\,{\mathrm {e}}^x\,a^7\,b-288\,a^6\,b^2-416\,{\mathrm {e}}^x\,a^5\,b^3+456\,a^4\,b^4+600\,{\mathrm {e}}^x\,a^3\,b^5-272\,a^2\,b^6-288\,{\mathrm {e}}^x\,a\,b^7+32\,b^8}{a^6\,b^4}-\frac {\left (\frac {16\,\left (a^2-b^2\right )\,\left (-4\,a^3-7\,{\mathrm {e}}^x\,a^2\,b+4\,a\,b^2+8\,{\mathrm {e}}^x\,b^3\right )}{a^6}+\frac {32\,\sqrt {-{\left (a+b\right )}^3\,{\left (a-b\right )}^3}\,\left (-2\,a^3-3\,{\mathrm {e}}^x\,a^2\,b+3\,a\,b^2+4\,{\mathrm {e}}^x\,b^3\right )}{a^6\,b}\right )\,\sqrt {-{\left (a+b\right )}^3\,{\left (a-b\right )}^3}}{a\,b^3}\right )\,\sqrt {-{\left (a+b\right )}^3\,{\left (a-b\right )}^3}}{a\,b^3}-\frac {8\,{\left (a^2-b^2\right )}^2\,\left (2\,a^2-3\,b^2\right )\,\left (-4\,a^3-7\,{\mathrm {e}}^x\,a^2\,b+6\,a\,b^2+10\,{\mathrm {e}}^x\,b^3\right )}{a^6\,b^6}\right )\,\sqrt {-{\left (a+b\right )}^3\,{\left (a-b\right )}^3}}{a\,b^3}-\frac {\ln \left (-\frac {\left (\frac {64\,a^8+96\,{\mathrm {e}}^x\,a^7\,b-288\,a^6\,b^2-416\,{\mathrm {e}}^x\,a^5\,b^3+456\,a^4\,b^4+600\,{\mathrm {e}}^x\,a^3\,b^5-272\,a^2\,b^6-288\,{\mathrm {e}}^x\,a\,b^7+32\,b^8}{a^6\,b^4}+\frac {\left (\frac {16\,\left (a^2-b^2\right )\,\left (-4\,a^3-7\,{\mathrm {e}}^x\,a^2\,b+4\,a\,b^2+8\,{\mathrm {e}}^x\,b^3\right )}{a^6}-\frac {32\,\sqrt {-{\left (a+b\right )}^3\,{\left (a-b\right )}^3}\,\left (-2\,a^3-3\,{\mathrm {e}}^x\,a^2\,b+3\,a\,b^2+4\,{\mathrm {e}}^x\,b^3\right )}{a^6\,b}\right )\,\sqrt {-{\left (a+b\right )}^3\,{\left (a-b\right )}^3}}{a\,b^3}\right )\,\sqrt {-{\left (a+b\right )}^3\,{\left (a-b\right )}^3}}{a\,b^3}-\frac {8\,{\left (a^2-b^2\right )}^2\,\left (2\,a^2-3\,b^2\right )\,\left (-4\,a^3-7\,{\mathrm {e}}^x\,a^2\,b+6\,a\,b^2+10\,{\mathrm {e}}^x\,b^3\right )}{a^6\,b^6}\right )\,\sqrt {-{\left (a+b\right )}^3\,{\left (a-b\right )}^3}}{a\,b^3} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________