Optimal. Leaf size=22 \[ -\frac{3 x}{2}+\frac{3 \tan (x)}{2}-\frac{1}{2} \sin ^2(x) \tan (x) \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.0205319, antiderivative size = 22, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 9, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.333, Rules used = {288, 321, 203} \[ -\frac{3 x}{2}+\frac{3 \tan (x)}{2}-\frac{1}{2} \sin ^2(x) \tan (x) \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 288
Rule 321
Rule 203
Rubi steps
\begin{align*} \int (-\cos (x)+\sec (x))^2 \, dx &=\operatorname{Subst}\left (\int \frac{x^4}{\left (1+x^2\right )^2} \, dx,x,\tan (x)\right )\\ &=-\frac{1}{2} \sin ^2(x) \tan (x)+\frac{3}{2} \operatorname{Subst}\left (\int \frac{x^2}{1+x^2} \, dx,x,\tan (x)\right )\\ &=\frac{3 \tan (x)}{2}-\frac{1}{2} \sin ^2(x) \tan (x)-\frac{3}{2} \operatorname{Subst}\left (\int \frac{1}{1+x^2} \, dx,x,\tan (x)\right )\\ &=-\frac{3 x}{2}+\frac{3 \tan (x)}{2}-\frac{1}{2} \sin ^2(x) \tan (x)\\ \end{align*}
Mathematica [A] time = 0.0177295, size = 16, normalized size = 0.73 \[ -\frac{3 x}{2}+\frac{1}{4} \sin (2 x)+\tan (x) \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.016, size = 13, normalized size = 0.6 \begin{align*} \tan \left ( x \right ) -{\frac{3\,x}{2}}+{\frac{\cos \left ( x \right ) \sin \left ( x \right ) }{2}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 0.973503, size = 16, normalized size = 0.73 \begin{align*} -\frac{3}{2} \, x + \frac{1}{4} \, \sin \left (2 \, x\right ) + \tan \left (x\right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 2.06675, size = 68, normalized size = 3.09 \begin{align*} -\frac{3 \, x \cos \left (x\right ) -{\left (\cos \left (x\right )^{2} + 2\right )} \sin \left (x\right )}{2 \, \cos \left (x\right )} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A] time = 2.5935, size = 14, normalized size = 0.64 \begin{align*} - \frac{3 x}{2} + \frac{\sin{\left (2 x \right )}}{4} + \tan{\left (x \right )} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.15956, size = 24, normalized size = 1.09 \begin{align*} -\frac{3}{2} \, x + \frac{\tan \left (x\right )}{2 \,{\left (\tan \left (x\right )^{2} + 1\right )}} + \tan \left (x\right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]