Optimal. Leaf size=110 \[ 2 e^{-x} \sqrt {e^x+e^{2 x}}-\frac {\tan ^{-1}\left (\frac {i-(1-2 i) e^x}{2 \sqrt {1+i} \sqrt {e^x+e^{2 x}}}\right )}{\sqrt {1+i}}+\frac {\tan ^{-1}\left (\frac {i+(1+2 i) e^x}{2 \sqrt {1-i} \sqrt {e^x+e^{2 x}}}\right )}{\sqrt {1-i}} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.39, antiderivative size = 147, normalized size of antiderivative = 1.34, number of steps
used = 11, number of rules used = 7, integrand size = 16, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.438, Rules used = {2320, 6856,
1600, 6857, 96, 95, 214} \begin {gather*} \frac {2 \left (e^x+1\right )}{\sqrt {e^x+e^{2 x}}}-\frac {(1-i)^{3/2} \sqrt {e^x} \sqrt {e^x+1} \tanh ^{-1}\left (\frac {\sqrt {1-i} \sqrt {e^x}}{\sqrt {e^x+1}}\right )}{\sqrt {e^x+e^{2 x}}}-\frac {(1+i)^{3/2} \sqrt {e^x} \sqrt {e^x+1} \tanh ^{-1}\left (\frac {\sqrt {1+i} \sqrt {e^x}}{\sqrt {e^x+1}}\right )}{\sqrt {e^x+e^{2 x}}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 95
Rule 96
Rule 214
Rule 1600
Rule 2320
Rule 6856
Rule 6857
Rubi steps
\begin {align*} \int \frac {\tanh (x)}{\sqrt {e^x+e^{2 x}}} \, dx &=\text {Subst}\left (\int \frac {-1+x^2}{x \left (1+x^2\right ) \sqrt {x+x^2}} \, dx,x,e^x\right )\\ &=\frac {\left (\sqrt {e^x} \sqrt {1+e^x}\right ) \text {Subst}\left (\int \frac {-1+x^2}{x^{3/2} \sqrt {1+x} \left (1+x^2\right )} \, dx,x,e^x\right )}{\sqrt {e^x+e^{2 x}}}\\ &=\frac {\left (\sqrt {e^x} \sqrt {1+e^x}\right ) \text {Subst}\left (\int \frac {(-1+x) \sqrt {1+x}}{x^{3/2} \left (1+x^2\right )} \, dx,x,e^x\right )}{\sqrt {e^x+e^{2 x}}}\\ &=\frac {\left (\sqrt {e^x} \sqrt {1+e^x}\right ) \text {Subst}\left (\int \left (-\frac {\left (\frac {1}{2}+\frac {i}{2}\right ) \sqrt {1+x}}{(i-x) x^{3/2}}+\frac {\left (\frac {1}{2}-\frac {i}{2}\right ) \sqrt {1+x}}{x^{3/2} (i+x)}\right ) \, dx,x,e^x\right )}{\sqrt {e^x+e^{2 x}}}\\ &=-\frac {\left (\left (\frac {1}{2}+\frac {i}{2}\right ) \sqrt {e^x} \sqrt {1+e^x}\right ) \text {Subst}\left (\int \frac {\sqrt {1+x}}{(i-x) x^{3/2}} \, dx,x,e^x\right )}{\sqrt {e^x+e^{2 x}}}+\frac {\left (\left (\frac {1}{2}-\frac {i}{2}\right ) \sqrt {e^x} \sqrt {1+e^x}\right ) \text {Subst}\left (\int \frac {\sqrt {1+x}}{x^{3/2} (i+x)} \, dx,x,e^x\right )}{\sqrt {e^x+e^{2 x}}}\\ &=\frac {2 \left (1+e^x\right )}{\sqrt {e^x+e^{2 x}}}-\frac {\left (\sqrt {e^x} \sqrt {1+e^x}\right ) \text {Subst}\left (\int \frac {1}{(i-x) \sqrt {x} \sqrt {1+x}} \, dx,x,e^x\right )}{\sqrt {e^x+e^{2 x}}}+\frac {\left (\sqrt {e^x} \sqrt {1+e^x}\right ) \text {Subst}\left (\int \frac {1}{\sqrt {x} (i+x) \sqrt {1+x}} \, dx,x,e^x\right )}{\sqrt {e^x+e^{2 x}}}\\ &=\frac {2 \left (1+e^x\right )}{\sqrt {e^x+e^{2 x}}}-\frac {\left (2 \sqrt {e^x} \sqrt {1+e^x}\right ) \text {Subst}\left (\int \frac {1}{i-(1+i) x^2} \, dx,x,\frac {\sqrt {e^x}}{\sqrt {1+e^x}}\right )}{\sqrt {e^x+e^{2 x}}}+\frac {\left (2 \sqrt {e^x} \sqrt {1+e^x}\right ) \text {Subst}\left (\int \frac {1}{i+(1-i) x^2} \, dx,x,\frac {\sqrt {e^x}}{\sqrt {1+e^x}}\right )}{\sqrt {e^x+e^{2 x}}}\\ &=\frac {2 \left (1+e^x\right )}{\sqrt {e^x+e^{2 x}}}-\frac {(1-i)^{3/2} \sqrt {e^x} \sqrt {1+e^x} \tanh ^{-1}\left (\frac {\sqrt {1-i} \sqrt {e^x}}{\sqrt {1+e^x}}\right )}{\sqrt {e^x+e^{2 x}}}-\frac {(1+i)^{3/2} \sqrt {e^x} \sqrt {1+e^x} \tanh ^{-1}\left (\frac {\sqrt {1+i} \sqrt {e^x}}{\sqrt {1+e^x}}\right )}{\sqrt {e^x+e^{2 x}}}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.08, size = 121, normalized size = 1.10 \begin {gather*} \frac {2+2 e^x-(1-i)^{3/2} e^{x/2} \sqrt {1+e^x} \tanh ^{-1}\left (\frac {\sqrt {1-i} e^{x/2}}{\sqrt {1+e^x}}\right )-(1+i)^{3/2} e^{x/2} \sqrt {1+e^x} \tanh ^{-1}\left (\frac {\sqrt {1+i} e^{x/2}}{\sqrt {1+e^x}}\right )}{\sqrt {e^x \left (1+e^x\right )}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Mathics [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {cought exception: maximum recursion depth exceeded while calling a Python object} \end {gather*}
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(363\) vs.
\(2(81)=162\).
time = 0.10, size = 364, normalized size = 3.31
method | result | size |
default | \(-\frac {\sqrt {2}\, \left (\sqrt {2}\, \sqrt {2+2 \sqrt {2}}\, \sqrt {\tanh \left (\frac {x}{2}\right )+1}\, \ln \left (\tanh \left (\frac {x}{2}\right )+1-\sqrt {\tanh \left (\frac {x}{2}\right )+1}\, \sqrt {2+2 \sqrt {2}}+\sqrt {2}\right ) \sqrt {-2+2 \sqrt {2}}-\sqrt {2}\, \sqrt {2+2 \sqrt {2}}\, \sqrt {\tanh \left (\frac {x}{2}\right )+1}\, \ln \left (\tanh \left (\frac {x}{2}\right )+1+\sqrt {\tanh \left (\frac {x}{2}\right )+1}\, \sqrt {2+2 \sqrt {2}}+\sqrt {2}\right ) \sqrt {-2+2 \sqrt {2}}-\sqrt {2+2 \sqrt {2}}\, \sqrt {\tanh \left (\frac {x}{2}\right )+1}\, \ln \left (\tanh \left (\frac {x}{2}\right )+1-\sqrt {\tanh \left (\frac {x}{2}\right )+1}\, \sqrt {2+2 \sqrt {2}}+\sqrt {2}\right ) \sqrt {-2+2 \sqrt {2}}+\sqrt {2+2 \sqrt {2}}\, \sqrt {\tanh \left (\frac {x}{2}\right )+1}\, \ln \left (\tanh \left (\frac {x}{2}\right )+1+\sqrt {\tanh \left (\frac {x}{2}\right )+1}\, \sqrt {2+2 \sqrt {2}}+\sqrt {2}\right ) \sqrt {-2+2 \sqrt {2}}-4 \sqrt {\tanh \left (\frac {x}{2}\right )+1}\, \arctan \left (\frac {-2 \sqrt {\tanh \left (\frac {x}{2}\right )+1}+\sqrt {2+2 \sqrt {2}}}{\sqrt {-2+2 \sqrt {2}}}\right )+4 \sqrt {\tanh \left (\frac {x}{2}\right )+1}\, \arctan \left (\frac {2 \sqrt {\tanh \left (\frac {x}{2}\right )+1}+\sqrt {2+2 \sqrt {2}}}{\sqrt {-2+2 \sqrt {2}}}\right )+8 \sqrt {-2+2 \sqrt {2}}\right )}{4 \sqrt {-2+2 \sqrt {2}}\, \left (\tanh \left (\frac {x}{2}\right )-1\right ) \sqrt {\frac {\tanh \left (\frac {x}{2}\right )+1}{\left (\tanh \left (\frac {x}{2}\right )-1\right )^{2}}}}\) | \(364\) |
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. 859 vs.
\(2 (67) = 134\).
time = 0.36, size = 859, normalized size = 7.81
result too large to display
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 {\left (x \right )}}{\sqrt {\left (e^{x} + 1\right ) e^{x}}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 379 vs. \(2 (67) = 134\).
time = 0.09, size = 489, normalized size = 4.45 \begin {gather*} 2 \left (\frac {\sqrt {2 \left (\sqrt {2}-1\right )} \left (1+\frac {4 \mathrm {i}}{4 \sqrt {2}-4}\right ) \ln \left (\left (40+20 \mathrm {i}\right ) \left (\sqrt {\left (\mathrm {e}^{x}\right )^{2}+\mathrm {e}^{x}}-\mathrm {e}^{x}\right ) \sqrt {2}+\left (-56-28 \mathrm {i}\right ) \left (\sqrt {\left (\mathrm {e}^{x}\right )^{2}+\mathrm {e}^{x}}-\mathrm {e}^{x}\right )-10 \sqrt {2 \left (5 \sqrt {2}-7\right )} \sqrt {2}+\left (14+2 \mathrm {i}\right ) \sqrt {2 \left (5 \sqrt {2}-7\right )}+\left (-20+40 \mathrm {i}\right ) \sqrt {2}+\left (28-56 \mathrm {i}\right )\right )}{4-4 \mathrm {i}}-\frac {\sqrt {2 \left (\sqrt {2}-1\right )} \left (1+\frac {4 \mathrm {i}}{4 \sqrt {2}-4}\right ) \ln \left (\left (40+20 \mathrm {i}\right ) \left (\sqrt {\left (\mathrm {e}^{x}\right )^{2}+\mathrm {e}^{x}}-\mathrm {e}^{x}\right ) \sqrt {2}+\left (-56-28 \mathrm {i}\right ) \left (\sqrt {\left (\mathrm {e}^{x}\right )^{2}+\mathrm {e}^{x}}-\mathrm {e}^{x}\right )+10 \sqrt {2 \left (5 \sqrt {2}-7\right )} \sqrt {2}+\left (-14-2 \mathrm {i}\right ) \sqrt {2 \left (5 \sqrt {2}-7\right )}+\left (-20+40 \mathrm {i}\right ) \sqrt {2}+\left (28-56 \mathrm {i}\right )\right )}{4-4 \mathrm {i}}+\frac {\sqrt {2 \left (\sqrt {2}+1\right )} \left (1+\frac {4 \mathrm {i}}{4 \sqrt {2}+4}\right ) \ln \left (4 \left (\sqrt {\left (\mathrm {e}^{x}\right )^{2}+\mathrm {e}^{x}}-\mathrm {e}^{x}\right ) \sqrt {2}-4 \left (\sqrt {\left (\mathrm {e}^{x}\right )^{2}+\mathrm {e}^{x}}-\mathrm {e}^{x}\right )-2 \sqrt {2 \left (\sqrt {2}-1\right )} \sqrt {2}+\left (2+2 \mathrm {i}\right ) \sqrt {2 \left (\sqrt {2}-1\right )}-4 \mathrm {i} \sqrt {2}+4 \mathrm {i}\right )}{4-4 \mathrm {i}}-\frac {\sqrt {2 \left (\sqrt {2}+1\right )} \left (1+\frac {4 \mathrm {i}}{4 \sqrt {2}+4}\right ) \ln \left (4 \left (\sqrt {\left (\mathrm {e}^{x}\right )^{2}+\mathrm {e}^{x}}-\mathrm {e}^{x}\right ) \sqrt {2}-4 \left (\sqrt {\left (\mathrm {e}^{x}\right )^{2}+\mathrm {e}^{x}}-\mathrm {e}^{x}\right )+2 \sqrt {2 \left (\sqrt {2}-1\right )} \sqrt {2}+\left (-2-2 \mathrm {i}\right ) \sqrt {2 \left (\sqrt {2}-1\right )}-4 \mathrm {i} \sqrt {2}+4 \mathrm {i}\right )}{4-4 \mathrm {i}}+\frac 1{\sqrt {\left (\mathrm {e}^{x}\right )^{2}+\mathrm {e}^{x}}-\mathrm {e}^{x}}\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int \frac {\mathrm {tanh}\left (x\right )}{\sqrt {{\mathrm {e}}^{2\,x}+{\mathrm {e}}^x}} \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________