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]

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

________________________________________________________________________________________

Rubi [A]  time = 0.01, antiderivative size = 31, normalized size of antiderivative = 1.00, 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.05, size = 31, normalized size = 1.00 \[ -\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]

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

________________________________________________________________________________________

fricas [A]  time = 1.69, size = 17, normalized size = 0.55 \[ -\frac {i \, a^{2} e^{\left (2 i \, d x + 2 i \, c\right )}}{2 \, d} \]

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

________________________________________________________________________________________

giac [B]  time = 0.15, size = 52, normalized size = 1.68 \[ -\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} \]

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

________________________________________________________________________________________

maple [B]  time = 0.26, size = 73, normalized size = 2.35 \[ \frac {-a^{2} \left (-\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )-i a^{2} \left (\cos ^{2}\left (d x +c \right )\right )+a^{2} \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d} \]

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.54, size = 69, normalized size = 2.23 \[ -\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} \]

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

________________________________________________________________________________________

mupad [B]  time = 2.42, size = 44, normalized size = 1.42 \[ -\frac {2\,a^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,2{}\mathrm {i}-1\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-(2*a^2*tan(c/2 + (d*x)/2))/(d*(tan(c/2 + (d*x)/2)*2i + tan(c/2 + (d*x)/2)^2 - 1))

________________________________________________________________________________________

sympy [A]  time = 0.13, size = 37, normalized size = 1.19 \[ \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} \]

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))

________________________________________________________________________________________