Optimal. Leaf size=137 \[ \sinh ^{-1}(1+\tan (x))-\sqrt {\frac {1}{2} \left (1+\sqrt {5}\right )} \tan ^{-1}\left (\frac {2 \sqrt {5}-\left (5+\sqrt {5}\right ) \tan (x)}{\sqrt {10 \left (1+\sqrt {5}\right )} \sqrt {2+2 \tan (x)+\tan ^2(x)}}\right )-\sqrt {\frac {1}{2} \left (-1+\sqrt {5}\right )} \tanh ^{-1}\left (\frac {2 \sqrt {5}+\left (5-\sqrt {5}\right ) \tan (x)}{\sqrt {10 \left (-1+\sqrt {5}\right )} \sqrt {2+2 \tan (x)+\tan ^2(x)}}\right ) \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.13, antiderivative size = 137, normalized size of antiderivative = 1.00, number of steps
used = 9, number of rules used = 7, integrand size = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.500, Rules used = {1004, 633, 221,
1050, 1044, 213, 209} \begin {gather*} -\sqrt {\frac {1}{2} \left (1+\sqrt {5}\right )} \tan ^{-1}\left (\frac {2 \sqrt {5}-\left (5+\sqrt {5}\right ) \tan (x)}{\sqrt {10 \left (1+\sqrt {5}\right )} \sqrt {\tan ^2(x)+2 \tan (x)+2}}\right )-\sqrt {\frac {1}{2} \left (\sqrt {5}-1\right )} \tanh ^{-1}\left (\frac {\left (5-\sqrt {5}\right ) \tan (x)+2 \sqrt {5}}{\sqrt {10 \left (\sqrt {5}-1\right )} \sqrt {\tan ^2(x)+2 \tan (x)+2}}\right )+\sinh ^{-1}(\tan (x)+1) \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 209
Rule 213
Rule 221
Rule 633
Rule 1004
Rule 1044
Rule 1050
Rubi steps
\begin {align*} \int \sqrt {2+2 \tan (x)+\tan ^2(x)} \, dx &=\text {Subst}\left (\int \frac {\sqrt {2+2 x+x^2}}{1+x^2} \, dx,x,\tan (x)\right )\\ &=\text {Subst}\left (\int \frac {1}{\sqrt {2+2 x+x^2}} \, dx,x,\tan (x)\right )-\text {Subst}\left (\int \frac {-1-2 x}{\left (1+x^2\right ) \sqrt {2+2 x+x^2}} \, dx,x,\tan (x)\right )\\ &=\frac {1}{2} \text {Subst}\left (\int \frac {1}{\sqrt {1+\frac {x^2}{4}}} \, dx,x,2+2 \tan (x)\right )-\frac {\text {Subst}\left (\int \frac {5-\sqrt {5}-2 \sqrt {5} x}{\left (1+x^2\right ) \sqrt {2+2 x+x^2}} \, dx,x,\tan (x)\right )}{2 \sqrt {5}}+\frac {\text {Subst}\left (\int \frac {5+\sqrt {5}+2 \sqrt {5} x}{\left (1+x^2\right ) \sqrt {2+2 x+x^2}} \, dx,x,\tan (x)\right )}{2 \sqrt {5}}\\ &=\sinh ^{-1}(1+\tan (x))-\left (2 \left (5-\sqrt {5}\right )\right ) \text {Subst}\left (\int \frac {1}{20 \left (1-\sqrt {5}\right )+2 x^2} \, dx,x,\frac {-2 \sqrt {5}-\left (5-\sqrt {5}\right ) \tan (x)}{\sqrt {2+2 \tan (x)+\tan ^2(x)}}\right )-\left (2 \left (5+\sqrt {5}\right )\right ) \text {Subst}\left (\int \frac {1}{20 \left (1+\sqrt {5}\right )+2 x^2} \, dx,x,\frac {2 \sqrt {5}-\left (5+\sqrt {5}\right ) \tan (x)}{\sqrt {2+2 \tan (x)+\tan ^2(x)}}\right )\\ &=\sinh ^{-1}(1+\tan (x))-\sqrt {\frac {1}{2} \left (1+\sqrt {5}\right )} \tan ^{-1}\left (\frac {2 \sqrt {5}-\left (5+\sqrt {5}\right ) \tan (x)}{\sqrt {10 \left (1+\sqrt {5}\right )} \sqrt {2+2 \tan (x)+\tan ^2(x)}}\right )-\sqrt {\frac {1}{2} \left (-1+\sqrt {5}\right )} \tanh ^{-1}\left (\frac {2 \sqrt {5}+\left (5-\sqrt {5}\right ) \tan (x)}{\sqrt {10 \left (-1+\sqrt {5}\right )} \sqrt {2+2 \tan (x)+\tan ^2(x)}}\right )\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains higher order function than in optimal. Order 9 vs. order 3 in
optimal.
time = 2.60, size = 340, normalized size = 2.48 \begin {gather*} \frac {\cos (x) \left (2 \sqrt {2} \tanh ^{-1}\left (\frac {2 \sqrt {2} \tan \left (\frac {x}{2}\right )}{2+\sqrt {\sec ^4\left (\frac {x}{2}\right ) (3+\cos (2 x)+2 \sin (2 x))}-2 \tan ^2\left (\frac {x}{2}\right )}\right )+\text {RootSum}\left [20+32 \text {$\#$1}+12 \text {$\#$1}^2+\text {$\#$1}^4\&,\frac {6 \log \left (\tan \left (\frac {x}{2}\right )\right )-6 \log \left (\frac {1}{2} \left (2+\sqrt {\sec ^4\left (\frac {x}{2}\right ) (3+\cos (2 x)+2 \sin (2 x))}-2 \text {$\#$1} \tan \left (\frac {x}{2}\right )-2 \tan ^2\left (\frac {x}{2}\right )\right )\right )+8 \log \left (\tan \left (\frac {x}{2}\right )\right ) \text {$\#$1}-8 \log \left (\frac {1}{2} \left (2+\sqrt {\sec ^4\left (\frac {x}{2}\right ) (3+\cos (2 x)+2 \sin (2 x))}-2 \text {$\#$1} \tan \left (\frac {x}{2}\right )-2 \tan ^2\left (\frac {x}{2}\right )\right )\right ) \text {$\#$1}+\log \left (\tan \left (\frac {x}{2}\right )\right ) \text {$\#$1}^2-\log \left (\frac {1}{2} \left (2+\sqrt {\sec ^4\left (\frac {x}{2}\right ) (3+\cos (2 x)+2 \sin (2 x))}-2 \text {$\#$1} \tan \left (\frac {x}{2}\right )-2 \tan ^2\left (\frac {x}{2}\right )\right )\right ) \text {$\#$1}^2}{8+6 \text {$\#$1}+\text {$\#$1}^3}\&\right ]\right ) \sqrt {2+2 \tan (x)+\tan ^2(x)}}{(1+\cos (x)) \sqrt {\frac {3+\cos (2 x)+2 \sin (2 x)}{(1+\cos (x))^2}}} \end {gather*}
Warning: Unable to verify antiderivative.
[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. \(1603\) vs.
\(2(105)=210\).
time = 0.46, size = 1604, normalized size = 11.71
method | result | size |
derivativedivides | \(\text {Expression too large to display}\) | \(1604\) |
default | \(\text {Expression too large to display}\) | \(1604\) |
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 [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \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 \sqrt {\tan ^{2}{\left (x \right )} + 2 \tan {\left (x \right )} + 2}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 495 vs.
\(2 (104) = 208\).
time = 0.05, size = 975, normalized size = 7.12 \begin {gather*} 2 \left (\frac {1}{8} \sqrt {2 \left (\sqrt {5}-1\right )} \ln \left (\left (16 \left (\sqrt {\tan ^{2}x+2 \tan x+2}-\tan x\right ) \sqrt {5}-32 \left (\sqrt {\tan ^{2}x+2 \tan x+2}-\tan x\right )-16 \sqrt {5} \sqrt {\sqrt {5}-2}-16 \sqrt {5}+32 \sqrt {\sqrt {5}-2}+32\right ) \left (16 \left (\sqrt {\tan ^{2}x+2 \tan x+2}-\tan x\right ) \sqrt {5}-32 \left (\sqrt {\tan ^{2}x+2 \tan x+2}-\tan x\right )-16 \sqrt {5} \sqrt {\sqrt {5}-2}-16 \sqrt {5}+32 \sqrt {\sqrt {5}-2}+32\right )+\left (16 \left (\sqrt {\tan ^{2}x+2 \tan x+2}-\tan x\right ) \sqrt {5}-32 \left (\sqrt {\tan ^{2}x+2 \tan x+2}-\tan x\right )+16 \sqrt {5}-16 \sqrt {\sqrt {5}-2}-32\right ) \left (16 \left (\sqrt {\tan ^{2}x+2 \tan x+2}-\tan x\right ) \sqrt {5}-32 \left (\sqrt {\tan ^{2}x+2 \tan x+2}-\tan x\right )+16 \sqrt {5}-16 \sqrt {\sqrt {5}-2}-32\right )\right )+\frac {32 \sqrt {2 \left (\sqrt {5}-1\right )} \left (\frac {\pi }{4}+\arctan \left (\frac {60368053528205721600+35013471046359318528 \sqrt {5} \sqrt {\sqrt {5}-2}+11671157015453106176 \sqrt {5}+81698099108171743232 \sqrt {\sqrt {5}-2}-25354582481846403072+\left (-32196295215043051520-23342314030906212352 \sqrt {5} \sqrt {\sqrt {5}-2}-11671157015453106176 \sqrt {5}-46684628061812424704 \sqrt {\sqrt {5}-2}-2817175831316267008\right ) \left (\sqrt {\tan ^{2}x+2 \tan x+2}-\tan x\right )}{23342314030906212352}\right )\right )}{4 \left (16 \sqrt {5}-16\right )}-\frac {1}{8} \sqrt {2 \left (\sqrt {5}-1\right )} \ln \left (\left (16 \left (\sqrt {\tan ^{2}x+2 \tan x+2}-\tan x\right ) \sqrt {5}-32 \left (\sqrt {\tan ^{2}x+2 \tan x+2}-\tan x\right )+16 \sqrt {5} \sqrt {\sqrt {5}-2}-16 \sqrt {5}-32 \sqrt {\sqrt {5}-2}+32\right ) \left (16 \left (\sqrt {\tan ^{2}x+2 \tan x+2}-\tan x\right ) \sqrt {5}-32 \left (\sqrt {\tan ^{2}x+2 \tan x+2}-\tan x\right )+16 \sqrt {5} \sqrt {\sqrt {5}-2}-16 \sqrt {5}-32 \sqrt {\sqrt {5}-2}+32\right )+\left (16 \left (\sqrt {\tan ^{2}x+2 \tan x+2}-\tan x\right ) \sqrt {5}-32 \left (\sqrt {\tan ^{2}x+2 \tan x+2}-\tan x\right )+16 \sqrt {5}+16 \sqrt {\sqrt {5}-2}-32\right ) \left (16 \left (\sqrt {\tan ^{2}x+2 \tan x+2}-\tan x\right ) \sqrt {5}-32 \left (\sqrt {\tan ^{2}x+2 \tan x+2}-\tan x\right )+16 \sqrt {5}+16 \sqrt {\sqrt {5}-2}-32\right )\right )-\frac {32 \sqrt {2 \left (\sqrt {5}-1\right )} \left (\frac {\pi }{4}+\arctan \left (\frac {-76466201135727247360-35013471046359318528 \sqrt {5} \sqrt {\sqrt {5}-2}+11671157015453106176 \sqrt {5}-81698099108171743232 \sqrt {\sqrt {5}-2}+111479672182086565888+\left (48294442822564577280+23342314030906212352 \sqrt {5} \sqrt {\sqrt {5}-2}-11671157015453106176 \sqrt {5}+46684628061812424704 \sqrt {\sqrt {5}-2}-83307913868923895808\right ) \left (\sqrt {\tan ^{2}x+2 \tan x+2}-\tan x\right )}{23342314030906212352}\right )\right )}{4 \left (16 \sqrt {5}-16\right )}-\frac {\ln \left (\sqrt {\tan ^{2}x+2 \tan x+2}-\tan x-1\right )}{2}\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 \sqrt {{\mathrm {tan}\left (x\right )}^2+2\,\mathrm {tan}\left (x\right )+2} \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________