### 3.58 $$\int \sin ^2(3 x) \, dx$$

Optimal. Leaf size=18 $\frac{x}{2}-\frac{1}{6} \sin (3 x) \cos (3 x)$

[Out]

x/2 - (Cos[3*x]*Sin[3*x])/6

________________________________________________________________________________________

Rubi [A]  time = 0.0060824, antiderivative size = 18, normalized size of antiderivative = 1., number of steps used = 2, number of rules used = 2, integrand size = 6, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.333, Rules used = {2635, 8} $\frac{x}{2}-\frac{1}{6} \sin (3 x) \cos (3 x)$

Antiderivative was successfully veriﬁed.

[In]

Int[Sin[3*x]^2,x]

[Out]

x/2 - (Cos[3*x]*Sin[3*x])/6

Rule 2635

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> -Simp[(b*Cos[c + d*x]*(b*Sin[c + d*x])^(n - 1))/(d*n),
x] + Dist[(b^2*(n - 1))/n, Int[(b*Sin[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && Integer
Q[2*n]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rubi steps

\begin{align*} \int \sin ^2(3 x) \, dx &=-\frac{1}{6} \cos (3 x) \sin (3 x)+\frac{\int 1 \, dx}{2}\\ &=\frac{x}{2}-\frac{1}{6} \cos (3 x) \sin (3 x)\\ \end{align*}

Mathematica [A]  time = 0.0062876, size = 14, normalized size = 0.78 $\frac{x}{2}-\frac{1}{12} \sin (6 x)$

Antiderivative was successfully veriﬁed.

[In]

Integrate[Sin[3*x]^2,x]

[Out]

x/2 - Sin[6*x]/12

________________________________________________________________________________________

Maple [A]  time = 0.007, size = 15, normalized size = 0.8 \begin{align*}{\frac{x}{2}}-{\frac{\cos \left ( 3\,x \right ) \sin \left ( 3\,x \right ) }{6}} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

int(sin(3*x)^2,x)

[Out]

1/2*x-1/6*cos(3*x)*sin(3*x)

________________________________________________________________________________________

Maxima [A]  time = 0.936092, size = 14, normalized size = 0.78 \begin{align*} \frac{1}{2} \, x - \frac{1}{12} \, \sin \left (6 \, x\right ) \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(3*x)^2,x, algorithm="maxima")

[Out]

1/2*x - 1/12*sin(6*x)

________________________________________________________________________________________

Fricas [A]  time = 2.58258, size = 43, normalized size = 2.39 \begin{align*} -\frac{1}{6} \, \cos \left (3 \, x\right ) \sin \left (3 \, x\right ) + \frac{1}{2} \, x \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(3*x)^2,x, algorithm="fricas")

[Out]

-1/6*cos(3*x)*sin(3*x) + 1/2*x

________________________________________________________________________________________

Sympy [A]  time = 0.060721, size = 14, normalized size = 0.78 \begin{align*} \frac{x}{2} - \frac{\sin{\left (3 x \right )} \cos{\left (3 x \right )}}{6} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(3*x)**2,x)

[Out]

x/2 - sin(3*x)*cos(3*x)/6

________________________________________________________________________________________

Giac [A]  time = 1.07291, size = 14, normalized size = 0.78 \begin{align*} \frac{1}{2} \, x - \frac{1}{12} \, \sin \left (6 \, x\right ) \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(3*x)^2,x, algorithm="giac")

[Out]

1/2*x - 1/12*sin(6*x)