Optimal. Leaf size=55 \[ \frac{1}{2} x \left (a^2+b^2\right )-\frac{(b \cos (c+d x)-a \sin (c+d x)) (a \cos (c+d x)+b \sin (c+d x))}{2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.0192334, antiderivative size = 55, normalized size of antiderivative = 1., number of steps used = 2, number of rules used = 2, integrand size = 19, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.105, Rules used = {3073, 8} \[ \frac{1}{2} x \left (a^2+b^2\right )-\frac{(b \cos (c+d x)-a \sin (c+d x)) (a \cos (c+d x)+b \sin (c+d x))}{2 d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3073
Rule 8
Rubi steps
\begin{align*} \int (a \cos (c+d x)+b \sin (c+d x))^2 \, dx &=-\frac{(b \cos (c+d x)-a \sin (c+d x)) (a \cos (c+d x)+b \sin (c+d x))}{2 d}+\frac{1}{2} \left (a^2+b^2\right ) \int 1 \, dx\\ &=\frac{1}{2} \left (a^2+b^2\right ) x-\frac{(b \cos (c+d x)-a \sin (c+d x)) (a \cos (c+d x)+b \sin (c+d x))}{2 d}\\ \end{align*}
Mathematica [A] time = 0.102152, size = 52, normalized size = 0.95 \[ \frac{2 \left (a^2+b^2\right ) (c+d x)+\left (a^2-b^2\right ) \sin (2 (c+d x))-2 a b \cos (2 (c+d x))}{4 d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.041, size = 70, normalized size = 1.3 \begin{align*}{\frac{1}{d} \left ({b}^{2} \left ( -{\frac{\sin \left ( dx+c \right ) \cos \left ( dx+c \right ) }{2}}+{\frac{dx}{2}}+{\frac{c}{2}} \right ) - \left ( \cos \left ( dx+c \right ) \right ) ^{2}ab+{a}^{2} \left ({\frac{\sin \left ( dx+c \right ) \cos \left ( dx+c \right ) }{2}}+{\frac{dx}{2}}+{\frac{c}{2}} \right ) \right ) } \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 0.970316, size = 92, normalized size = 1.67 \begin{align*} -\frac{a b \cos \left (d x + c\right )^{2}}{d} + \frac{{\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} a^{2}}{4 \, d} + \frac{{\left (2 \, d x + 2 \, c - \sin \left (2 \, d x + 2 \, c\right )\right )} b^{2}}{4 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 2.59547, size = 120, normalized size = 2.18 \begin{align*} -\frac{2 \, a b \cos \left (d x + c\right )^{2} -{\left (a^{2} + b^{2}\right )} d x -{\left (a^{2} - b^{2}\right )} \cos \left (d x + c\right ) \sin \left (d x + c\right )}{2 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A] time = 0.339938, size = 128, normalized size = 2.33 \begin{align*} \begin{cases} \frac{a^{2} x \sin ^{2}{\left (c + d x \right )}}{2} + \frac{a^{2} x \cos ^{2}{\left (c + d x \right )}}{2} + \frac{a^{2} \sin{\left (c + d x \right )} \cos{\left (c + d x \right )}}{2 d} + \frac{a b \sin ^{2}{\left (c + d x \right )}}{d} + \frac{b^{2} x \sin ^{2}{\left (c + d x \right )}}{2} + \frac{b^{2} x \cos ^{2}{\left (c + d x \right )}}{2} - \frac{b^{2} \sin{\left (c + d x \right )} \cos{\left (c + d x \right )}}{2 d} & \text{for}\: d \neq 0 \\x \left (a \cos{\left (c \right )} + b \sin{\left (c \right )}\right )^{2} & \text{otherwise} \end{cases} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.10991, size = 68, normalized size = 1.24 \begin{align*} \frac{1}{2} \,{\left (a^{2} + b^{2}\right )} x - \frac{a b \cos \left (2 \, d x + 2 \, c\right )}{2 \, d} + \frac{{\left (a^{2} - b^{2}\right )} \sin \left (2 \, d x + 2 \, c\right )}{4 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]