3.251 \(\int (a \cos (c+d x)+i a \sin (c+d x))^2 \, dx\)

Optimal. Leaf size=31 \[ -\frac{i (a \cos (c+d x)+i a \sin (c+d x))^2}{2 d} \]

[Out]

((-I/2)*(a*Cos[c + d*x] + I*a*Sin[c + d*x])^2)/d

________________________________________________________________________________________

Rubi [A]  time = 0.0143722, antiderivative size = 31, normalized size of antiderivative = 1., number of steps used = 1, number of rules used = 1, integrand size = 22, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.045, Rules used = {3071} \[ -\frac{i (a \cos (c+d x)+i a \sin (c+d x))^2}{2 d} \]

Antiderivative was successfully verified.

[In]

Int[(a*Cos[c + d*x] + I*a*Sin[c + d*x])^2,x]

[Out]

((-I/2)*(a*Cos[c + d*x] + I*a*Sin[c + d*x])^2)/d

Rule 3071

Int[(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(a*(a*Cos[c + d*x]
 + b*Sin[c + d*x])^n)/(b*d*n), x] /; FreeQ[{a, b, c, d, n}, x] && EqQ[a^2 + b^2, 0]

Rubi steps

\begin{align*} \int (a \cos (c+d x)+i a \sin (c+d x))^2 \, dx &=-\frac{i (a \cos (c+d x)+i a \sin (c+d x))^2}{2 d}\\ \end{align*}

Mathematica [A]  time = 0.054802, size = 31, normalized size = 1. \[ -\frac{i (a \cos (c+d x)+i a \sin (c+d x))^2}{2 d} \]

Antiderivative was successfully verified.

[In]

Integrate[(a*Cos[c + d*x] + I*a*Sin[c + d*x])^2,x]

[Out]

((-I/2)*(a*Cos[c + d*x] + I*a*Sin[c + d*x])^2)/d

________________________________________________________________________________________

Maple [B]  time = 0.047, size = 73, normalized size = 2.4 \begin{align*}{\frac{1}{d} \left ( -{a}^{2} \left ( -{\frac{\sin \left ( dx+c \right ) \cos \left ( dx+c \right ) }{2}}+{\frac{dx}{2}}+{\frac{c}{2}} \right ) -i{a}^{2} \left ( \cos \left ( dx+c \right ) \right ) ^{2}+{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]

int((a*cos(d*x+c)+I*a*sin(d*x+c))^2,x)

[Out]

1/d*(-a^2*(-1/2*sin(d*x+c)*cos(d*x+c)+1/2*d*x+1/2*c)-I*a^2*cos(d*x+c)^2+a^2*(1/2*sin(d*x+c)*cos(d*x+c)+1/2*d*x
+1/2*c))

________________________________________________________________________________________

Maxima [B]  time = 0.999395, size = 93, normalized size = 3. \begin{align*} -\frac{i \, a^{2} \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 )} a^{2}}{4 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a*cos(d*x+c)+I*a*sin(d*x+c))^2,x, algorithm="maxima")

[Out]

-I*a^2*cos(d*x + c)^2/d + 1/4*(2*d*x + 2*c + sin(2*d*x + 2*c))*a^2/d - 1/4*(2*d*x + 2*c - sin(2*d*x + 2*c))*a^
2/d

________________________________________________________________________________________

Fricas [A]  time = 2.18604, size = 46, normalized size = 1.48 \begin{align*} -\frac{i \, a^{2} e^{\left (2 i \, d x + 2 i \, c\right )}}{2 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a*cos(d*x+c)+I*a*sin(d*x+c))^2,x, algorithm="fricas")

[Out]

-1/2*I*a^2*e^(2*I*d*x + 2*I*c)/d

________________________________________________________________________________________

Sympy [A]  time = 0.160782, size = 37, normalized size = 1.19 \begin{align*} \begin{cases} - \frac{i a^{2} e^{2 i c} e^{2 i d x}}{2 d} & \text{for}\: 2 d \neq 0 \\a^{2} x e^{2 i c} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a*cos(d*x+c)+I*a*sin(d*x+c))**2,x)

[Out]

Piecewise((-I*a**2*exp(2*I*c)*exp(2*I*d*x)/(2*d), Ne(2*d, 0)), (a**2*x*exp(2*I*c), True))

________________________________________________________________________________________

Giac [B]  time = 1.16402, size = 70, normalized size = 2.26 \begin{align*} -\frac{i \, a^{2} e^{\left (2 i \, d x + 2 i \, c\right )}}{4 \, d} - \frac{i \, a^{2} e^{\left (-2 i \, d x - 2 i \, c\right )}}{4 \, d} + \frac{a^{2} \sin \left (2 \, d x + 2 \, c\right )}{2 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a*cos(d*x+c)+I*a*sin(d*x+c))^2,x, algorithm="giac")

[Out]

-1/4*I*a^2*e^(2*I*d*x + 2*I*c)/d - 1/4*I*a^2*e^(-2*I*d*x - 2*I*c)/d + 1/2*a^2*sin(2*d*x + 2*c)/d