Optimal. Leaf size=27 \[ a b \cos (x)+\sec (x) (a \sin (x)+b) (a+b \sin (x))+b^2 (-x) \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.0538816, antiderivative size = 27, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 11, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.273, Rules used = {4391, 2691, 2638} \[ a b \cos (x)+\sec (x) (a \sin (x)+b) (a+b \sin (x))+b^2 (-x) \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 4391
Rule 2691
Rule 2638
Rubi steps
\begin{align*} \int (a \sec (x)+b \tan (x))^2 \, dx &=\int \sec ^2(x) (a+b \sin (x))^2 \, dx\\ &=\sec (x) (b+a \sin (x)) (a+b \sin (x))-\int \left (b^2+a b \sin (x)\right ) \, dx\\ &=-b^2 x+\sec (x) (b+a \sin (x)) (a+b \sin (x))-(a b) \int \sin (x) \, dx\\ &=-b^2 x+a b \cos (x)+\sec (x) (b+a \sin (x)) (a+b \sin (x))\\ \end{align*}
Mathematica [A] time = 0.0425597, size = 25, normalized size = 0.93 \[ \left (a^2+b^2\right ) \tan (x)+2 a b \sec (x)+b^2 \left (-\tan ^{-1}(\tan (x))\right ) \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.044, size = 26, normalized size = 1. \begin{align*}{a}^{2}\tan \left ( x \right ) +2\,{\frac{ab}{\cos \left ( x \right ) }}+{b}^{2} \left ( \tan \left ( x \right ) -x \right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 1.56571, size = 35, normalized size = 1.3 \begin{align*} -b^{2}{\left (x - \tan \left (x\right )\right )} + a^{2} \tan \left (x\right ) + \frac{2 \, a b}{\cos \left (x\right )} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 2.08211, size = 72, normalized size = 2.67 \begin{align*} -\frac{b^{2} x \cos \left (x\right ) - 2 \, a b -{\left (a^{2} + b^{2}\right )} \sin \left (x\right )}{\cos \left (x\right )} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A] time = 1.48019, size = 22, normalized size = 0.81 \begin{align*} a^{2} \tan{\left (x \right )} + 2 a b \sec{\left (x \right )} + b^{2} \left (- x + \tan{\left (x \right )}\right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.14645, size = 54, normalized size = 2. \begin{align*} -b^{2} x - \frac{2 \,{\left (a^{2} \tan \left (\frac{1}{2} \, x\right ) + b^{2} \tan \left (\frac{1}{2} \, x\right ) + 2 \, a b\right )}}{\tan \left (\frac{1}{2} \, x\right )^{2} - 1} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]