Optimal. Leaf size=42 \[ \frac{1}{2} i \text{PolyLog}\left (2,-e^{2 i x}\right )+\frac{i x^2}{2}-x \log \left (1+e^{2 i x}\right )+\tan (x) \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.0548971, antiderivative size = 42, normalized size of antiderivative = 1., number of steps used = 7, number of rules used = 6, integrand size = 10, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.6, Rules used = {3719, 2190, 2279, 2391, 3473, 8} \[ \frac{1}{2} i \text{PolyLog}\left (2,-e^{2 i x}\right )+\frac{i x^2}{2}-x \log \left (1+e^{2 i x}\right )+\tan (x) \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3719
Rule 2190
Rule 2279
Rule 2391
Rule 3473
Rule 8
Rubi steps
\begin{align*} \int \left (1+x \tan (x)+\tan ^2(x)\right ) \, dx &=x+\int x \tan (x) \, dx+\int \tan ^2(x) \, dx\\ &=x+\frac{i x^2}{2}+\tan (x)-2 i \int \frac{e^{2 i x} x}{1+e^{2 i x}} \, dx-\int 1 \, dx\\ &=\frac{i x^2}{2}-x \log \left (1+e^{2 i x}\right )+\tan (x)+\int \log \left (1+e^{2 i x}\right ) \, dx\\ &=\frac{i x^2}{2}-x \log \left (1+e^{2 i x}\right )+\tan (x)-\frac{1}{2} i \operatorname{Subst}\left (\int \frac{\log (1+x)}{x} \, dx,x,e^{2 i x}\right )\\ &=\frac{i x^2}{2}-x \log \left (1+e^{2 i x}\right )+\frac{1}{2} i \text{Li}_2\left (-e^{2 i x}\right )+\tan (x)\\ \end{align*}
Mathematica [A] time = 0.0124761, size = 42, normalized size = 1. \[ \frac{1}{2} i \text{PolyLog}\left (2,-e^{2 i x}\right )+\frac{i x^2}{2}-x \log \left (1+e^{2 i x}\right )+\tan (x) \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.036, size = 43, normalized size = 1. \begin{align*}{\frac{i}{2}}{x}^{2}-x\ln \left ( 1+{{\rm e}^{2\,ix}} \right ) +{\frac{i}{2}}{\it polylog} \left ( 2,-{{\rm e}^{2\,ix}} \right ) +{\frac{2\,i}{1+{{\rm e}^{2\,ix}}}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] time = 1.67233, size = 196, normalized size = 4.67 \begin{align*} x + \frac{x^{2} -{\left (2 \, x \cos \left (2 \, x\right ) + 2 i \, x \sin \left (2 \, x\right ) + 2 \, x\right )} \arctan \left (\sin \left (2 \, x\right ), \cos \left (2 \, x\right ) + 1\right ) +{\left (x^{2} + 2 i \, x\right )} \cos \left (2 \, x\right ) +{\left (\cos \left (2 \, x\right ) + i \, \sin \left (2 \, x\right ) + 1\right )}{\rm Li}_2\left (-e^{\left (2 i \, x\right )}\right ) -{\left (-i \, x \cos \left (2 \, x\right ) + x \sin \left (2 \, x\right ) - i \, x\right )} \log \left (\cos \left (2 \, x\right )^{2} + \sin \left (2 \, x\right )^{2} + 2 \, \cos \left (2 \, x\right ) + 1\right ) -{\left (-i \, x^{2} + 2 \, x\right )} \sin \left (2 \, x\right ) + 2 i \, x + 4}{-2 i \, \cos \left (2 \, x\right ) + 2 \, \sin \left (2 \, x\right ) - 2 i} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] time = 2.52804, size = 277, normalized size = 6.6 \begin{align*} -\frac{1}{2} \, x \log \left (-\frac{2 \,{\left (i \, \tan \left (x\right ) - 1\right )}}{\tan \left (x\right )^{2} + 1}\right ) - \frac{1}{2} \, x \log \left (-\frac{2 \,{\left (-i \, \tan \left (x\right ) - 1\right )}}{\tan \left (x\right )^{2} + 1}\right ) - \frac{1}{4} i \,{\rm Li}_2\left (\frac{2 \,{\left (i \, \tan \left (x\right ) - 1\right )}}{\tan \left (x\right )^{2} + 1} + 1\right ) + \frac{1}{4} i \,{\rm Li}_2\left (\frac{2 \,{\left (-i \, \tan \left (x\right ) - 1\right )}}{\tan \left (x\right )^{2} + 1} + 1\right ) + \tan \left (x\right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F] time = 0., size = 0, normalized size = 0. \begin{align*} \int \left (x \tan{\left (x \right )} + \tan ^{2}{\left (x \right )} + 1\right )\, dx \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F] time = 0., size = 0, normalized size = 0. \begin{align*} \int x \tan \left (x\right ) + \tan \left (x\right )^{2} + 1\,{d x} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]