\(\int (1+\tan (2 x))^2 \, dx\) [38]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 8, antiderivative size = 16 \[ \int (1+\tan (2 x))^2 \, dx=-\log (\cos (2 x))+\frac {1}{2} \tan (2 x) \]

[Out]

-ln(cos(2*x))+1/2*tan(2*x)

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 16, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {3558, 3556} \[ \int (1+\tan (2 x))^2 \, dx=\frac {1}{2} \tan (2 x)-\log (\cos (2 x)) \]

[In]

Int[(1 + Tan[2*x])^2,x]

[Out]

-Log[Cos[2*x]] + Tan[2*x]/2

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3558

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^2, x_Symbol] :> Simp[(a^2 - b^2)*x, x] + (Dist[2*a*b, Int[Tan[c + d
*x], x], x] + Simp[b^2*(Tan[c + d*x]/d), x]) /; FreeQ[{a, b, c, d}, x]

Rubi steps \begin{align*} \text {integral}& = \frac {1}{2} \tan (2 x)+2 \int \tan (2 x) \, dx \\ & = -\log (\cos (2 x))+\frac {1}{2} \tan (2 x) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.02 (sec) , antiderivative size = 26, normalized size of antiderivative = 1.62 \[ \int (1+\tan (2 x))^2 \, dx=x-\frac {1}{2} \arctan (\tan (2 x))-\log (\cos (2 x))+\frac {1}{2} \tan (2 x) \]

[In]

Integrate[(1 + Tan[2*x])^2,x]

[Out]

x - ArcTan[Tan[2*x]]/2 - Log[Cos[2*x]] + Tan[2*x]/2

Maple [A] (verified)

Time = 0.06 (sec) , antiderivative size = 19, normalized size of antiderivative = 1.19

method result size
derivativedivides \(\frac {\tan \left (2 x \right )}{2}+\frac {\ln \left (1+\tan ^{2}\left (2 x \right )\right )}{2}\) \(19\)
default \(\frac {\tan \left (2 x \right )}{2}+\frac {\ln \left (1+\tan ^{2}\left (2 x \right )\right )}{2}\) \(19\)
norman \(\frac {\tan \left (2 x \right )}{2}+\frac {\ln \left (1+\tan ^{2}\left (2 x \right )\right )}{2}\) \(19\)
parallelrisch \(\frac {\tan \left (2 x \right )}{2}+\frac {\ln \left (1+\tan ^{2}\left (2 x \right )\right )}{2}\) \(19\)
parts \(x +\frac {\tan \left (2 x \right )}{2}-\frac {\arctan \left (\tan \left (2 x \right )\right )}{2}+\frac {\ln \left (1+\tan ^{2}\left (2 x \right )\right )}{2}\) \(27\)
risch \(2 i x +\frac {i}{{\mathrm e}^{4 i x}+1}-\ln \left ({\mathrm e}^{4 i x}+1\right )\) \(28\)

[In]

int((1+tan(2*x))^2,x,method=_RETURNVERBOSE)

[Out]

1/2*tan(2*x)+1/2*ln(1+tan(2*x)^2)

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 20, normalized size of antiderivative = 1.25 \[ \int (1+\tan (2 x))^2 \, dx=-\frac {1}{2} \, \log \left (\frac {1}{\tan \left (2 \, x\right )^{2} + 1}\right ) + \frac {1}{2} \, \tan \left (2 \, x\right ) \]

[In]

integrate((1+tan(2*x))^2,x, algorithm="fricas")

[Out]

-1/2*log(1/(tan(2*x)^2 + 1)) + 1/2*tan(2*x)

Sympy [A] (verification not implemented)

Time = 0.06 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.06 \[ \int (1+\tan (2 x))^2 \, dx=\frac {\log {\left (\tan ^{2}{\left (2 x \right )} + 1 \right )}}{2} + \frac {\tan {\left (2 x \right )}}{2} \]

[In]

integrate((1+tan(2*x))**2,x)

[Out]

log(tan(2*x)**2 + 1)/2 + tan(2*x)/2

Maxima [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 12, normalized size of antiderivative = 0.75 \[ \int (1+\tan (2 x))^2 \, dx=\log \left (\sec \left (2 \, x\right )\right ) + \frac {1}{2} \, \tan \left (2 \, x\right ) \]

[In]

integrate((1+tan(2*x))^2,x, algorithm="maxima")

[Out]

log(sec(2*x)) + 1/2*tan(2*x)

Giac [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 22, normalized size of antiderivative = 1.38 \[ \int (1+\tan (2 x))^2 \, dx=-\frac {1}{2} \, \log \left (\frac {4}{\tan \left (2 \, x\right )^{2} + 1}\right ) + \frac {1}{2} \, \tan \left (2 \, x\right ) \]

[In]

integrate((1+tan(2*x))^2,x, algorithm="giac")

[Out]

-1/2*log(4/(tan(2*x)^2 + 1)) + 1/2*tan(2*x)

Mupad [B] (verification not implemented)

Time = 0.33 (sec) , antiderivative size = 18, normalized size of antiderivative = 1.12 \[ \int (1+\tan (2 x))^2 \, dx=\frac {\mathrm {tan}\left (2\,x\right )}{2}+\frac {\ln \left ({\mathrm {tan}\left (2\,x\right )}^2+1\right )}{2} \]

[In]

int((tan(2*x) + 1)^2,x)

[Out]

tan(2*x)/2 + log(tan(2*x)^2 + 1)/2