Optimal. Leaf size=30 \[ -\tan (x)+\log (\tan (x)) \tan (x)-\frac {\tan ^3(x)}{9}+\frac {1}{3} \log (\tan (x)) \tan ^3(x) \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.04, antiderivative size = 30, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 3, integrand size = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.375, Rules used = {3852, 2634, 12}
\begin {gather*} -\frac {\tan ^3(x)}{9}-\tan (x)+\frac {1}{3} \tan ^3(x) \log (\tan (x))+\tan (x) \log (\tan (x)) \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 12
Rule 2634
Rule 3852
Rubi steps
\begin {align*} \int \log (\tan (x)) \sec ^4(x) \, dx &=\log (\tan (x)) \tan (x)+\frac {1}{3} \log (\tan (x)) \tan ^3(x)-\int \frac {1}{3} (2+\cos (2 x)) \sec ^4(x) \, dx\\ &=\log (\tan (x)) \tan (x)+\frac {1}{3} \log (\tan (x)) \tan ^3(x)-\frac {1}{3} \int (2+\cos (2 x)) \sec ^4(x) \, dx\\ &=\log (\tan (x)) \tan (x)+\frac {1}{3} \log (\tan (x)) \tan ^3(x)-\frac {1}{3} \text {Subst}\left (\int \left (3+x^2\right ) \, dx,x,\tan (x)\right )\\ &=-\tan (x)+\log (\tan (x)) \tan (x)-\frac {\tan ^3(x)}{9}+\frac {1}{3} \log (\tan (x)) \tan ^3(x)\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.05, size = 29, normalized size = 0.97 \begin {gather*} \frac {1}{9} \left (-8+(-1+6 \log (\tan (x))+3 \cos (2 x) \log (\tan (x))) \sec ^2(x)\right ) \tan (x) \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(54\) vs.
\(2(26)=52\).
time = 0.30, size = 55, normalized size = 1.83
method | result | size |
default | \(\frac {\left (6 \left (\cos ^{2}\left (x \right )\right ) \ln \left (\frac {\sin \left (x \right )}{2 \cos \left (x \right )}\right )+6 \left (\cos ^{2}\left (x \right )\right ) \ln \left (2\right )-8 \left (\cos ^{2}\left (x \right )\right )+3 \ln \left (\frac {\sin \left (x \right )}{2 \cos \left (x \right )}\right )+3 \ln \left (2\right )-1\right ) \sin \left (x \right )}{9 \cos \left (x \right )^{3}}\) | \(55\) |
risch | \(-\frac {4 i \left (3 \,{\mathrm e}^{2 i x}+1\right ) \ln \left ({\mathrm e}^{2 i x}+1\right )}{3 \left ({\mathrm e}^{2 i x}+1\right )^{3}}+\frac {\frac {2 \pi }{3}+\frac {2 \pi \mathrm {csgn}\left (\frac {{\mathrm e}^{2 i x}-1}{{\mathrm e}^{2 i x}+1}\right )^{3}}{3}-\frac {2 \mathrm {csgn}\left (\frac {{\mathrm e}^{2 i x}-1}{{\mathrm e}^{2 i x}+1}\right )^{2} \pi }{3}+\frac {2 i \ln \left ({\mathrm e}^{2 i x}+1\right )}{3}-\frac {4 i {\mathrm e}^{4 i x}}{3}+\frac {2 \pi \mathrm {csgn}\left (\frac {i \left ({\mathrm e}^{2 i x}-1\right )}{{\mathrm e}^{2 i x}+1}\right )^{3}}{3}+2 \pi \,{\mathrm e}^{2 i x}+2 \pi \,\mathrm {csgn}\left (\frac {i}{{\mathrm e}^{2 i x}+1}\right ) \mathrm {csgn}\left (i \left ({\mathrm e}^{2 i x}-1\right )\right ) \mathrm {csgn}\left (\frac {i \left ({\mathrm e}^{2 i x}-1\right )}{{\mathrm e}^{2 i x}+1}\right ) {\mathrm e}^{2 i x}+2 \pi \,\mathrm {csgn}\left (\frac {i \left ({\mathrm e}^{2 i x}-1\right )}{{\mathrm e}^{2 i x}+1}\right ) \mathrm {csgn}\left (\frac {{\mathrm e}^{2 i x}-1}{{\mathrm e}^{2 i x}+1}\right ) {\mathrm e}^{2 i x}-4 i {\mathrm e}^{2 i x}+\frac {2 i \ln \left ({\mathrm e}^{2 i x}-1\right )}{3}-\frac {16 i}{9}-\frac {2 \mathrm {csgn}\left (\frac {i \left ({\mathrm e}^{2 i x}-1\right )}{{\mathrm e}^{2 i x}+1}\right )^{2} \mathrm {csgn}\left (\frac {i}{{\mathrm e}^{2 i x}+1}\right ) \pi }{3}+2 i \ln \left ({\mathrm e}^{2 i x}+1\right ) {\mathrm e}^{4 i x}+2 i \ln \left ({\mathrm e}^{2 i x}+1\right ) {\mathrm e}^{2 i x}-\frac {2 i {\mathrm e}^{6 i x} \ln \left ({\mathrm e}^{2 i x}-1\right )}{3}-2 i {\mathrm e}^{4 i x} \ln \left ({\mathrm e}^{2 i x}-1\right )+\frac {2 i \ln \left ({\mathrm e}^{2 i x}+1\right ) {\mathrm e}^{6 i x}}{3}+\frac {2 \pi \,\mathrm {csgn}\left (\frac {i \left ({\mathrm e}^{2 i x}-1\right )}{{\mathrm e}^{2 i x}+1}\right ) \mathrm {csgn}\left (\frac {{\mathrm e}^{2 i x}-1}{{\mathrm e}^{2 i x}+1}\right )}{3}+2 i {\mathrm e}^{2 i x} \ln \left ({\mathrm e}^{2 i x}-1\right )-2 \pi \mathrm {csgn}\left (\frac {{\mathrm e}^{2 i x}-1}{{\mathrm e}^{2 i x}+1}\right )^{2} {\mathrm e}^{2 i x}-\frac {2 \mathrm {csgn}\left (\frac {i \left ({\mathrm e}^{2 i x}-1\right )}{{\mathrm e}^{2 i x}+1}\right )^{2} \mathrm {csgn}\left (i \left ({\mathrm e}^{2 i x}-1\right )\right ) \pi }{3}-\frac {2 \mathrm {csgn}\left (\frac {{\mathrm e}^{2 i x}-1}{{\mathrm e}^{2 i x}+1}\right )^{2} \mathrm {csgn}\left (\frac {i \left ({\mathrm e}^{2 i x}-1\right )}{{\mathrm e}^{2 i x}+1}\right ) \pi }{3}+2 \pi \mathrm {csgn}\left (\frac {i \left ({\mathrm e}^{2 i x}-1\right )}{{\mathrm e}^{2 i x}+1}\right )^{3} {\mathrm e}^{2 i x}+2 \pi \mathrm {csgn}\left (\frac {{\mathrm e}^{2 i x}-1}{{\mathrm e}^{2 i x}+1}\right )^{3} {\mathrm e}^{2 i x}+\frac {2 \pi \,\mathrm {csgn}\left (\frac {i}{{\mathrm e}^{2 i x}+1}\right ) \mathrm {csgn}\left (i \left ({\mathrm e}^{2 i x}-1\right )\right ) \mathrm {csgn}\left (\frac {i \left ({\mathrm e}^{2 i x}-1\right )}{{\mathrm e}^{2 i x}+1}\right )}{3}-2 \pi \,\mathrm {csgn}\left (\frac {i}{{\mathrm e}^{2 i x}+1}\right ) \mathrm {csgn}\left (\frac {i \left ({\mathrm e}^{2 i x}-1\right )}{{\mathrm e}^{2 i x}+1}\right )^{2} {\mathrm e}^{2 i x}-2 \pi \,\mathrm {csgn}\left (i \left ({\mathrm e}^{2 i x}-1\right )\right ) \mathrm {csgn}\left (\frac {i \left ({\mathrm e}^{2 i x}-1\right )}{{\mathrm e}^{2 i x}+1}\right )^{2} {\mathrm e}^{2 i x}-2 \pi \,\mathrm {csgn}\left (\frac {i \left ({\mathrm e}^{2 i x}-1\right )}{{\mathrm e}^{2 i x}+1}\right ) \mathrm {csgn}\left (\frac {{\mathrm e}^{2 i x}-1}{{\mathrm e}^{2 i x}+1}\right )^{2} {\mathrm e}^{2 i x}}{\left ({\mathrm e}^{2 i x}+1\right )^{3}}\) | \(782\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 1.58, size = 25, normalized size = 0.83 \begin {gather*} -\frac {1}{9} \, \tan \left (x\right )^{3} + \frac {1}{3} \, {\left (\tan \left (x\right )^{3} + 3 \, \tan \left (x\right )\right )} \log \left (\tan \left (x\right )\right ) - \tan \left (x\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.49, size = 39, normalized size = 1.30 \begin {gather*} \frac {3 \, {\left (2 \, \cos \left (x\right )^{2} + 1\right )} \log \left (\frac {\sin \left (x\right )}{\cos \left (x\right )}\right ) \sin \left (x\right ) - {\left (8 \, \cos \left (x\right )^{2} + 1\right )} \sin \left (x\right )}{9 \, \cos \left (x\right )^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 12.45, size = 46, normalized size = 1.53 \begin {gather*} \frac {\log {\left (\tan {\left (x \right )} \right )} \tan ^{3}{\left (x \right )}}{3} + \log {\left (\tan {\left (x \right )} \right )} \tan {\left (x \right )} - \frac {\sin ^{3}{\left (x \right )}}{9 \cos ^{3}{\left (x \right )}} + \frac {\sin {\left (x \right )}}{3 \cos {\left (x \right )}} - \frac {4 \tan {\left (x \right )}}{3} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.91, size = 26, normalized size = 0.87 \begin {gather*} \frac {1}{3} \, \log \left (\tan \left (x\right )\right ) \tan \left (x\right )^{3} - \frac {1}{9} \, \tan \left (x\right )^{3} + \log \left (\tan \left (x\right )\right ) \tan \left (x\right ) - \tan \left (x\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 1.80, size = 148, normalized size = 4.93 \begin {gather*} \frac {\ln \left (-\frac {8\,{\mathrm {e}}^{x\,2{}\mathrm {i}}}{3}-\frac {8}{3}\right )\,2{}\mathrm {i}}{3}-\frac {\ln \left (\frac {8}{3}-\frac {8\,{\mathrm {e}}^{x\,2{}\mathrm {i}}}{3}\right )\,2{}\mathrm {i}}{3}+\frac {8{}\mathrm {i}}{9\,\left (3\,{\mathrm {e}}^{x\,2{}\mathrm {i}}+3\,{\mathrm {e}}^{x\,4{}\mathrm {i}}+{\mathrm {e}}^{x\,6{}\mathrm {i}}+1\right )}-\frac {4{}\mathrm {i}}{3\,\left (2\,{\mathrm {e}}^{x\,2{}\mathrm {i}}+{\mathrm {e}}^{x\,4{}\mathrm {i}}+1\right )}-\frac {4{}\mathrm {i}}{3\,\left ({\mathrm {e}}^{x\,2{}\mathrm {i}}+1\right )}+\frac {\ln \left (-\frac {{\mathrm {e}}^{x\,2{}\mathrm {i}}\,1{}\mathrm {i}-\mathrm {i}}{{\mathrm {e}}^{x\,2{}\mathrm {i}}+1}\right )\,\left ({\mathrm {e}}^{x\,2{}\mathrm {i}}\,4{}\mathrm {i}+\frac {4}{3}{}\mathrm {i}\right )}{3\,{\mathrm {e}}^{x\,2{}\mathrm {i}}+3\,{\mathrm {e}}^{x\,4{}\mathrm {i}}+{\mathrm {e}}^{x\,6{}\mathrm {i}}+1} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________