Optimal. Leaf size=138 \[ -\frac {\left (\frac {1}{2}+\frac {i}{2}\right ) \sqrt {-i+x^2}}{\sqrt {2} (1+x)}-\frac {\left (\frac {1}{2}-\frac {i}{2}\right ) \sqrt {i+x^2}}{\sqrt {2} (1+x)}+\frac {\tanh ^{-1}\left (\frac {i+x}{\sqrt {1-i} \sqrt {-i+x^2}}\right )}{(1-i)^{3/2} \sqrt {2}}-\frac {\tanh ^{-1}\left (\frac {i-x}{\sqrt {1+i} \sqrt {i+x^2}}\right )}{(1+i)^{3/2} \sqrt {2}} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.05, antiderivative size = 138, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 3, integrand size = 45, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.067, Rules used = {745, 739, 212}
\begin {gather*} -\frac {\left (\frac {1}{2}+\frac {i}{2}\right ) \sqrt {x^2-i}}{\sqrt {2} (x+1)}-\frac {\left (\frac {1}{2}-\frac {i}{2}\right ) \sqrt {x^2+i}}{\sqrt {2} (x+1)}+\frac {\tanh ^{-1}\left (\frac {x+i}{\sqrt {1-i} \sqrt {x^2-i}}\right )}{(1-i)^{3/2} \sqrt {2}}-\frac {\tanh ^{-1}\left (\frac {-x+i}{\sqrt {1+i} \sqrt {x^2+i}}\right )}{(1+i)^{3/2} \sqrt {2}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 212
Rule 739
Rule 745
Rubi steps
\begin {align*} \int \left (\frac {1}{\sqrt {2} (1+x)^2 \sqrt {-i+x^2}}+\frac {1}{\sqrt {2} (1+x)^2 \sqrt {i+x^2}}\right ) \, dx &=\frac {\int \frac {1}{(1+x)^2 \sqrt {-i+x^2}} \, dx}{\sqrt {2}}+\frac {\int \frac {1}{(1+x)^2 \sqrt {i+x^2}} \, dx}{\sqrt {2}}\\ &=-\frac {\left (\frac {1}{2}+\frac {i}{2}\right ) \sqrt {-i+x^2}}{\sqrt {2} (1+x)}-\frac {\left (\frac {1}{2}-\frac {i}{2}\right ) \sqrt {i+x^2}}{\sqrt {2} (1+x)}+\frac {\left (\frac {1}{2}-\frac {i}{2}\right ) \int \frac {1}{(1+x) \sqrt {i+x^2}} \, dx}{\sqrt {2}}+\frac {\left (\frac {1}{2}+\frac {i}{2}\right ) \int \frac {1}{(1+x) \sqrt {-i+x^2}} \, dx}{\sqrt {2}}\\ &=-\frac {\left (\frac {1}{2}+\frac {i}{2}\right ) \sqrt {-i+x^2}}{\sqrt {2} (1+x)}-\frac {\left (\frac {1}{2}-\frac {i}{2}\right ) \sqrt {i+x^2}}{\sqrt {2} (1+x)}+-\frac {\left (\frac {1}{2}+\frac {i}{2}\right ) \text {Subst}\left (\int \frac {1}{(1-i)-x^2} \, dx,x,\frac {-i-x}{\sqrt {-i+x^2}}\right )}{\sqrt {2}}+-\frac {\left (\frac {1}{2}-\frac {i}{2}\right ) \text {Subst}\left (\int \frac {1}{(1+i)-x^2} \, dx,x,\frac {i-x}{\sqrt {i+x^2}}\right )}{\sqrt {2}}\\ &=-\frac {\left (\frac {1}{2}+\frac {i}{2}\right ) \sqrt {-i+x^2}}{\sqrt {2} (1+x)}-\frac {\left (\frac {1}{2}-\frac {i}{2}\right ) \sqrt {i+x^2}}{\sqrt {2} (1+x)}+\frac {\tanh ^{-1}\left (\frac {i+x}{\sqrt {1-i} \sqrt {-i+x^2}}\right )}{(1-i)^{3/2} \sqrt {2}}-\frac {\tanh ^{-1}\left (\frac {i-x}{\sqrt {1+i} \sqrt {i+x^2}}\right )}{(1+i)^{3/2} \sqrt {2}}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 3.74, size = 126, normalized size = 0.91 \begin {gather*} -\frac {\left (\frac {1}{2}-\frac {i}{2}\right ) \left (i \sqrt {-i+x^2}+\sqrt {i+x^2}+\frac {2 (1+x) \tan ^{-1}\left (\sqrt {-\frac {1}{2}-\frac {i}{2}} \left (1+x-\sqrt {-i+x^2}\right )\right )}{\sqrt {1-i}}+(1+i)^{3/2} (1+x) \tan ^{-1}\left (\sqrt {-\frac {1}{2}+\frac {i}{2}} \left (1+x-\sqrt {i+x^2}\right )\right )\right )}{\sqrt {2} (1+x)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 277 vs. \(2 (101 ) = 202\).
time = 0.12, size = 278, normalized size = 2.01
method | result | size |
default | \(-\frac {\sqrt {2}\, \sqrt {\left (1+x \right )^{2}-2 x -1-i}}{4 \left (1+x \right )}-\frac {i \sqrt {2}\, \sqrt {\left (1+x \right )^{2}-2 x -1-i}}{4 \left (1+x \right )}-\frac {\sqrt {2}\, \ln \left (\frac {-2 i-2 x +2 \sqrt {1-i}\, \sqrt {\left (1+x \right )^{2}-2 x -1-i}}{1+x}\right )}{4 \sqrt {1-i}}-\frac {i \sqrt {2}\, \ln \left (\frac {-2 i-2 x +2 \sqrt {1-i}\, \sqrt {\left (1+x \right )^{2}-2 x -1-i}}{1+x}\right )}{4 \sqrt {1-i}}-\frac {\sqrt {2}\, \sqrt {\left (1+x \right )^{2}-2 x -1+i}}{4 \left (1+x \right )}+\frac {i \sqrt {2}\, \sqrt {\left (1+x \right )^{2}-2 x -1+i}}{4+4 x}-\frac {\sqrt {2}\, \ln \left (\frac {2 i-2 x +2 \sqrt {1+i}\, \sqrt {\left (1+x \right )^{2}-2 x -1+i}}{1+x}\right )}{4 \sqrt {1+i}}+\frac {i \sqrt {2}\, \ln \left (\frac {2 i-2 x +2 \sqrt {1+i}\, \sqrt {\left (1+x \right )^{2}-2 x -1+i}}{1+x}\right )}{4 \sqrt {1+i}}\) | \(278\) |
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: RuntimeError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.77, size = 161, normalized size = 1.17 \begin {gather*} \frac {\sqrt {-\frac {1}{2} i + \frac {1}{2}} {\left (-\left (i - 1\right ) \, x - i + 1\right )} \log \left (\sqrt {2} \sqrt {-\frac {1}{2} i + \frac {1}{2}} - x + \sqrt {x^{2} - i} - 1\right ) + \sqrt {-\frac {1}{2} i + \frac {1}{2}} {\left (\left (i - 1\right ) \, x + i - 1\right )} \log \left (-\sqrt {2} \sqrt {-\frac {1}{2} i + \frac {1}{2}} - x + \sqrt {x^{2} - i} - 1\right ) + \sqrt {-\frac {1}{2} i - \frac {1}{2}} {\left (-\left (i + 1\right ) \, x - i - 1\right )} \log \left (i \, \sqrt {2} \sqrt {-\frac {1}{2} i - \frac {1}{2}} - x + \sqrt {x^{2} + i} - 1\right ) + \sqrt {-\frac {1}{2} i - \frac {1}{2}} {\left (\left (i + 1\right ) \, x + i + 1\right )} \log \left (-i \, \sqrt {2} \sqrt {-\frac {1}{2} i - \frac {1}{2}} - x + \sqrt {x^{2} + i} - 1\right ) + \sqrt {2} {\left (-\left (i + 1\right ) \, x - i - 1\right )} - \sqrt {2} \sqrt {x^{2} + i} - i \, \sqrt {2} \sqrt {x^{2} - i}}{\left (2 i + 2\right ) \, x + 2 i + 2} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: TypeError} \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. 547 vs. \(2 (82) = 164\).
time = 0.88, size = 547, normalized size = 3.96 \begin {gather*} \sqrt {2} {\left (\frac {-\left (i - 1\right ) \, \sqrt {2 \, x^{2} + 2 \, \sqrt {x^{4} + 1}} {\left (\frac {i}{x^{2} + \sqrt {x^{4} + 1}} + 1\right )} + \left (2 i - 2\right ) \, x + 2 i + 2}{{\left (\sqrt {2 \, x^{2} + 2 \, \sqrt {x^{4} + 1}} {\left (\frac {i}{x^{2} + \sqrt {x^{4} + 1}} + 1\right )} - 2 \, x\right )}^{2} - 4 \, \sqrt {2 \, x^{2} + 2 \, \sqrt {x^{4} + 1}} {\left (\frac {i}{x^{2} + \sqrt {x^{4} + 1}} + 1\right )} + 8 \, x - 4 i} - \frac {\left (i - 1\right ) \, \arctan \left (\frac {\sqrt {2} {\left (\sqrt {2 \, x^{2} + 2 \, \sqrt {x^{4} + 1}} {\left (\frac {i}{x^{2} + \sqrt {x^{4} + 1}} + 1\right )} - 2 \, x\right )} - \sqrt {2 \, x^{2} + 2 \, \sqrt {x^{4} + 1}} {\left (\frac {i}{x^{2} + \sqrt {x^{4} + 1}} + 1\right )} + 2 \, x - 2 \, \sqrt {2} + 2}{\sqrt {2} \sqrt {2 \, \sqrt {2} - 2} - \left (i + 1\right ) \, \sqrt {2 \, \sqrt {2} - 2}}\right )}{\sqrt {2 \, \sqrt {2} - 2} {\left (-\frac {i}{\sqrt {2} - 1} + 1\right )}}\right )} + \sqrt {2} {\left (\frac {\left (i + 1\right ) \, \sqrt {2 \, x^{2} + 2 \, \sqrt {x^{4} + 1}} {\left (-\frac {i}{x^{2} + \sqrt {x^{4} + 1}} + 1\right )} - \left (2 i + 2\right ) \, x - 2 i + 2}{{\left (\sqrt {2 \, x^{2} + 2 \, \sqrt {x^{4} + 1}} {\left (-\frac {i}{x^{2} + \sqrt {x^{4} + 1}} + 1\right )} - 2 \, x\right )}^{2} - 4 \, \sqrt {2 \, x^{2} + 2 \, \sqrt {x^{4} + 1}} {\left (-\frac {i}{x^{2} + \sqrt {x^{4} + 1}} + 1\right )} + 8 \, x + 4 i} + \frac {\left (i + 1\right ) \, \arctan \left (\frac {\sqrt {2} {\left (\sqrt {2 \, x^{2} + 2 \, \sqrt {x^{4} + 1}} {\left (-\frac {i}{x^{2} + \sqrt {x^{4} + 1}} + 1\right )} - 2 \, x\right )} - \sqrt {2 \, x^{2} + 2 \, \sqrt {x^{4} + 1}} {\left (-\frac {i}{x^{2} + \sqrt {x^{4} + 1}} + 1\right )} + 2 \, x - 2 \, \sqrt {2} + 2}{\sqrt {2} \sqrt {2 \, \sqrt {2} - 2} + \left (i - 1\right ) \, \sqrt {2 \, \sqrt {2} - 2}}\right )}{\sqrt {2 \, \sqrt {2} - 2} {\left (\frac {i}{\sqrt {2} - 1} + 1\right )}}\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 {\sqrt {2}}{2\,\sqrt {x^2-\mathrm {i}}\,{\left (x+1\right )}^2}+\frac {\sqrt {2}}{2\,\sqrt {x^2+1{}\mathrm {i}}\,{\left (x+1\right )}^2} \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________