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.40, 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.09, 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]
________________________________________________________________________________________
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.62, size = 859, normalized size = 7.81 \begin {gather*} -\frac {1}{8} \, {\left (8^{\frac {1}{4}} \sqrt {2 \, \sqrt {2} + 4} {\left (\sqrt {2} - 2\right )} e^{x} \log \left (2 \, {\left (8^{\frac {1}{4}} {\left (\sqrt {2} - 1\right )} e^{x} - 8^{\frac {1}{4}}\right )} \sqrt {2 \, \sqrt {2} + 4} - 2 \, {\left (8^{\frac {1}{4}} \sqrt {2 \, \sqrt {2} + 4} {\left (\sqrt {2} - 1\right )} + 4 \, e^{x}\right )} \sqrt {e^{\left (2 \, x\right )} + e^{x}} + 4 \, \sqrt {2} + 8 \, e^{\left (2 \, x\right )} + 4 \, e^{x} + 4\right ) - 8^{\frac {1}{4}} \sqrt {2 \, \sqrt {2} + 4} {\left (\sqrt {2} - 2\right )} e^{x} \log \left (-2 \, {\left (8^{\frac {1}{4}} {\left (\sqrt {2} - 1\right )} e^{x} - 8^{\frac {1}{4}}\right )} \sqrt {2 \, \sqrt {2} + 4} + 2 \, {\left (8^{\frac {1}{4}} \sqrt {2 \, \sqrt {2} + 4} {\left (\sqrt {2} - 1\right )} - 4 \, e^{x}\right )} \sqrt {e^{\left (2 \, x\right )} + e^{x}} + 4 \, \sqrt {2} + 8 \, e^{\left (2 \, x\right )} + 4 \, e^{x} + 4\right ) + 4 \cdot 8^{\frac {1}{4}} \sqrt {2} \sqrt {2 \, \sqrt {2} + 4} \arctan \left (\frac {1}{7} \, {\left (\sqrt {2} {\left (5 \, \sqrt {2} + 6\right )} + 8 \, \sqrt {2} + 4\right )} e^{x} + \frac {1}{112} \, {\left (8 \, \sqrt {2} {\left (5 \, \sqrt {2} + 6\right )} + {\left (8^{\frac {3}{4}} {\left (5 \, \sqrt {2} + 6\right )} + 8 \cdot 8^{\frac {1}{4}} {\left (2 \, \sqrt {2} + 1\right )}\right )} \sqrt {2 \, \sqrt {2} + 4} + 64 \, \sqrt {2} + 32\right )} \sqrt {2 \, {\left (8^{\frac {1}{4}} {\left (\sqrt {2} - 1\right )} e^{x} - 8^{\frac {1}{4}}\right )} \sqrt {2 \, \sqrt {2} + 4} - 2 \, {\left (8^{\frac {1}{4}} \sqrt {2 \, \sqrt {2} + 4} {\left (\sqrt {2} - 1\right )} + 4 \, e^{x}\right )} \sqrt {e^{\left (2 \, x\right )} + e^{x}} + 4 \, \sqrt {2} + 8 \, e^{\left (2 \, x\right )} + 4 \, e^{x} + 4} + \frac {1}{56} \, {\left ({\left (8^{\frac {3}{4}} {\left (5 \, \sqrt {2} + 6\right )} + 8 \cdot 8^{\frac {1}{4}} {\left (2 \, \sqrt {2} + 1\right )}\right )} e^{x} + 8^{\frac {3}{4}} {\left (\sqrt {2} + 4\right )} - 8 \cdot 8^{\frac {1}{4}} {\left (\sqrt {2} - 3\right )}\right )} \sqrt {2 \, \sqrt {2} + 4} + \frac {1}{7} \, \sqrt {2} {\left (\sqrt {2} + 4\right )} - \frac {1}{56} \, {\left (8 \, \sqrt {2} {\left (5 \, \sqrt {2} + 6\right )} + {\left (8^{\frac {3}{4}} {\left (5 \, \sqrt {2} + 6\right )} + 8 \cdot 8^{\frac {1}{4}} {\left (2 \, \sqrt {2} + 1\right )}\right )} \sqrt {2 \, \sqrt {2} + 4} + 64 \, \sqrt {2} + 32\right )} \sqrt {e^{\left (2 \, x\right )} + e^{x}} + \frac {3}{7} \, \sqrt {2} + \frac {5}{7}\right ) e^{x} + 4 \cdot 8^{\frac {1}{4}} \sqrt {2} \sqrt {2 \, \sqrt {2} + 4} \arctan \left (-\frac {1}{7} \, {\left (\sqrt {2} {\left (5 \, \sqrt {2} + 6\right )} + 8 \, \sqrt {2} + 4\right )} e^{x} - \frac {1}{112} \, {\left (8 \, \sqrt {2} {\left (5 \, \sqrt {2} + 6\right )} - {\left (8^{\frac {3}{4}} {\left (5 \, \sqrt {2} + 6\right )} + 8 \cdot 8^{\frac {1}{4}} {\left (2 \, \sqrt {2} + 1\right )}\right )} \sqrt {2 \, \sqrt {2} + 4} + 64 \, \sqrt {2} + 32\right )} \sqrt {-2 \, {\left (8^{\frac {1}{4}} {\left (\sqrt {2} - 1\right )} e^{x} - 8^{\frac {1}{4}}\right )} \sqrt {2 \, \sqrt {2} + 4} + 2 \, {\left (8^{\frac {1}{4}} \sqrt {2 \, \sqrt {2} + 4} {\left (\sqrt {2} - 1\right )} - 4 \, e^{x}\right )} \sqrt {e^{\left (2 \, x\right )} + e^{x}} + 4 \, \sqrt {2} + 8 \, e^{\left (2 \, x\right )} + 4 \, e^{x} + 4} + \frac {1}{56} \, {\left ({\left (8^{\frac {3}{4}} {\left (5 \, \sqrt {2} + 6\right )} + 8 \cdot 8^{\frac {1}{4}} {\left (2 \, \sqrt {2} + 1\right )}\right )} e^{x} + 8^{\frac {3}{4}} {\left (\sqrt {2} + 4\right )} - 8 \cdot 8^{\frac {1}{4}} {\left (\sqrt {2} - 3\right )}\right )} \sqrt {2 \, \sqrt {2} + 4} - \frac {1}{7} \, \sqrt {2} {\left (\sqrt {2} + 4\right )} + \frac {1}{56} \, {\left (8 \, \sqrt {2} {\left (5 \, \sqrt {2} + 6\right )} - {\left (8^{\frac {3}{4}} {\left (5 \, \sqrt {2} + 6\right )} + 8 \cdot 8^{\frac {1}{4}} {\left (2 \, \sqrt {2} + 1\right )}\right )} \sqrt {2 \, \sqrt {2} + 4} + 64 \, \sqrt {2} + 32\right )} \sqrt {e^{\left (2 \, x\right )} + e^{x}} - \frac {3}{7} \, \sqrt {2} - \frac {5}{7}\right ) e^{x} - 16 \, \sqrt {e^{\left (2 \, x\right )} + e^{x}} - 16 \, e^{x}\right )} e^{\left (-x\right )} \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 {\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.62, size = 379, normalized size = 3.45 \begin {gather*} -\left (\frac {1}{4} i + \frac {1}{4}\right ) \, \sqrt {2 \, \sqrt {2} + 2} {\left (\frac {i}{\sqrt {2} + 1} + 1\right )} \log \left (4 \, \sqrt {2} {\left (\sqrt {e^{\left (2 \, x\right )} + e^{x}} - e^{x}\right )} + 2 \, \sqrt {2} \sqrt {2 \, \sqrt {2} - 2} - 4 i \, \sqrt {2} - \left (2 i + 2\right ) \, \sqrt {2 \, \sqrt {2} - 2} - 4 \, \sqrt {e^{\left (2 \, x\right )} + e^{x}} + 4 \, e^{x} + 4 i\right ) + \left (\frac {1}{4} i + \frac {1}{4}\right ) \, \sqrt {2 \, \sqrt {2} + 2} {\left (\frac {i}{\sqrt {2} + 1} + 1\right )} \log \left (4 \, \sqrt {2} {\left (\sqrt {e^{\left (2 \, x\right )} + e^{x}} - e^{x}\right )} - 2 \, \sqrt {2} \sqrt {2 \, \sqrt {2} - 2} - 4 i \, \sqrt {2} + \left (2 i + 2\right ) \, \sqrt {2 \, \sqrt {2} - 2} - 4 \, \sqrt {e^{\left (2 \, x\right )} + e^{x}} + 4 \, e^{x} + 4 i\right ) - \left (\frac {1}{4} i + \frac {1}{4}\right ) \, \sqrt {2 \, \sqrt {2} - 2} {\left (\frac {i}{\sqrt {2} - 1} + 1\right )} \log \left (-20 \, \sqrt {2} {\left (-\left (i + 2\right ) \, \sqrt {e^{\left (2 \, x\right )} + e^{x}} + \left (i + 2\right ) \, e^{x}\right )} + 10 \, \sqrt {2} \sqrt {10 \, \sqrt {2} - 14} + \left (40 i - 20\right ) \, \sqrt {2} - \left (2 i + 14\right ) \, \sqrt {10 \, \sqrt {2} - 14} - \left (28 i + 56\right ) \, \sqrt {e^{\left (2 \, x\right )} + e^{x}} + \left (28 i + 56\right ) \, e^{x} - 56 i + 28\right ) + \left (\frac {1}{4} i + \frac {1}{4}\right ) \, \sqrt {2 \, \sqrt {2} - 2} {\left (\frac {i}{\sqrt {2} - 1} + 1\right )} \log \left (-20 \, \sqrt {2} {\left (-\left (i + 2\right ) \, \sqrt {e^{\left (2 \, x\right )} + e^{x}} + \left (i + 2\right ) \, e^{x}\right )} - 10 \, \sqrt {2} \sqrt {10 \, \sqrt {2} - 14} + \left (40 i - 20\right ) \, \sqrt {2} + \left (2 i + 14\right ) \, \sqrt {10 \, \sqrt {2} - 14} - \left (28 i + 56\right ) \, \sqrt {e^{\left (2 \, x\right )} + e^{x}} + \left (28 i + 56\right ) \, e^{x} - 56 i + 28\right ) + \frac {2}{\sqrt {e^{\left (2 \, x\right )} + e^{x}} - e^{x}} \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]
________________________________________________________________________________________