3.40 \(\int (-\sec (x)+\tan (x))^2 \, dx\)

Optimal. Leaf size=14 \[ -x-\frac{2 \cos (x)}{\sin (x)+1} \]

[Out]

-x - (2*Cos[x])/(1 + Sin[x])

_______________________________________________________________________________________

Rubi [A]  time = 0.106171, antiderivative size = 14, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 4, integrand size = 9, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.444 \[ -x-\frac{2 \cos (x)}{\sin (x)+1} \]

Antiderivative was successfully verified.

[In]  Int[(-Sec[x] + Tan[x])^2,x]

[Out]

-x - (2*Cos[x])/(1 + Sin[x])

_______________________________________________________________________________________

Rubi in Sympy [A]  time = 4.0545, size = 12, normalized size = 0.86 \[ - x - \frac{2 \cos{\left (x \right )}}{\sin{\left (x \right )} + 1} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  rubi_integrate((-sec(x)+tan(x))**2,x)

[Out]

-x - 2*cos(x)/(sin(x) + 1)

_______________________________________________________________________________________

Mathematica [A]  time = 0.0108401, size = 12, normalized size = 0.86 \[ -x+2 \tan (x)-2 \sec (x) \]

Antiderivative was successfully verified.

[In]  Integrate[(-Sec[x] + Tan[x])^2,x]

[Out]

-x - 2*Sec[x] + 2*Tan[x]

_______________________________________________________________________________________

Maple [A]  time = 0.021, size = 15, normalized size = 1.1 \[ 2\,\tan \left ( x \right ) -2\, \left ( \cos \left ( x \right ) \right ) ^{-1}-x \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  int((-sec(x)+tan(x))^2,x)

[Out]

2*tan(x)-2/cos(x)-x

_______________________________________________________________________________________

Maxima [A]  time = 1.49182, size = 19, normalized size = 1.36 \[ -x - \frac{2}{\cos \left (x\right )} + 2 \, \tan \left (x\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate((sec(x) - tan(x))^2,x, algorithm="maxima")

[Out]

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

_______________________________________________________________________________________

Fricas [A]  time = 0.226354, size = 34, normalized size = 2.43 \[ -\frac{{\left (x + 2\right )} \cos \left (x\right ) +{\left (x - 2\right )} \sin \left (x\right ) + x + 2}{\cos \left (x\right ) + \sin \left (x\right ) + 1} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate((sec(x) - tan(x))^2,x, algorithm="fricas")

[Out]

-((x + 2)*cos(x) + (x - 2)*sin(x) + x + 2)/(cos(x) + sin(x) + 1)

_______________________________________________________________________________________

Sympy [A]  time = 0.573023, size = 10, normalized size = 0.71 \[ - x + 2 \tan{\left (x \right )} - 2 \sec{\left (x \right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate((-sec(x)+tan(x))**2,x)

[Out]

-x + 2*tan(x) - 2*sec(x)

_______________________________________________________________________________________

GIAC/XCAS [A]  time = 0.207797, size = 19, normalized size = 1.36 \[ -x - \frac{4}{\tan \left (\frac{1}{2} \, x\right ) + 1} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate((sec(x) - tan(x))^2,x, algorithm="giac")

[Out]

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