3.2.15 \(\int \cos ^2(a+b x) \, dx\) [115]

Optimal. Leaf size=25 \[ \frac {x}{2}+\frac {\cos (a+b x) \sin (a+b x)}{2 b} \]

[Out]

1/2*x+1/2*cos(b*x+a)*sin(b*x+a)/b

________________________________________________________________________________________

Rubi [A]
time = 0.01, antiderivative size = 25, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, integrand size = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {2715, 8} \begin {gather*} \frac {\sin (a+b x) \cos (a+b x)}{2 b}+\frac {x}{2} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cos[a + b*x]^2,x]

[Out]

x/2 + (Cos[a + b*x]*Sin[a + b*x])/(2*b)

Rule 8

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

Rule 2715

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] && Integ
erQ[2*n]

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]
time = 0.01, size = 23, normalized size = 0.92 \begin {gather*} \frac {2 (a+b x)+\sin (2 (a+b x))}{4 b} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cos[a + b*x]^2,x]

[Out]

(2*(a + b*x) + Sin[2*(a + b*x)])/(4*b)

________________________________________________________________________________________

Maple [A]
time = 0.03, size = 27, normalized size = 1.08

method result size
risch \(\frac {x}{2}+\frac {\sin \left (2 b x +2 a \right )}{4 b}\) \(19\)
derivativedivides \(\frac {\frac {\cos \left (b x +a \right ) \sin \left (b x +a \right )}{2}+\frac {b x}{2}+\frac {a}{2}}{b}\) \(27\)
default \(\frac {\frac {\cos \left (b x +a \right ) \sin \left (b x +a \right )}{2}+\frac {b x}{2}+\frac {a}{2}}{b}\) \(27\)
norman \(\frac {\frac {\tan \left (\frac {b x}{2}+\frac {a}{2}\right )}{b}+x \left (\tan ^{2}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )+\frac {x}{2}-\frac {\tan ^{3}\left (\frac {b x}{2}+\frac {a}{2}\right )}{b}+\frac {x \left (\tan ^{4}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )}{2}}{\left (1+\tan ^{2}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )^{2}}\) \(77\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(b*x+a)^2,x,method=_RETURNVERBOSE)

[Out]

1/b*(1/2*cos(b*x+a)*sin(b*x+a)+1/2*b*x+1/2*a)

________________________________________________________________________________________

Maxima [A]
time = 2.16, size = 22, normalized size = 0.88 \begin {gather*} \frac {2 \, b x + 2 \, a + \sin \left (2 \, b x + 2 \, a\right )}{4 \, b} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(b*x+a)^2,x, algorithm="maxima")

[Out]

1/4*(2*b*x + 2*a + sin(2*b*x + 2*a))/b

________________________________________________________________________________________

Fricas [A]
time = 0.60, size = 22, normalized size = 0.88 \begin {gather*} \frac {b x + \cos \left (b x + a\right ) \sin \left (b x + a\right )}{2 \, b} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(b*x+a)^2,x, algorithm="fricas")

[Out]

1/2*(b*x + cos(b*x + a)*sin(b*x + a))/b

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 46 vs. \(2 (19) = 38\).
time = 0.08, size = 46, normalized size = 1.84 \begin {gather*} \begin {cases} \frac {x \sin ^{2}{\left (a + b x \right )}}{2} + \frac {x \cos ^{2}{\left (a + b x \right )}}{2} + \frac {\sin {\left (a + b x \right )} \cos {\left (a + b x \right )}}{2 b} & \text {for}\: b \neq 0 \\x \cos ^{2}{\left (a \right )} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(b*x+a)**2,x)

[Out]

Piecewise((x*sin(a + b*x)**2/2 + x*cos(a + b*x)**2/2 + sin(a + b*x)*cos(a + b*x)/(2*b), Ne(b, 0)), (x*cos(a)**
2, True))

________________________________________________________________________________________

Giac [A]
time = 0.71, size = 18, normalized size = 0.72 \begin {gather*} \frac {1}{2} \, x + \frac {\sin \left (2 \, b x + 2 \, a\right )}{4 \, b} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(b*x+a)^2,x, algorithm="giac")

[Out]

1/2*x + 1/4*sin(2*b*x + 2*a)/b

________________________________________________________________________________________

Mupad [B]
time = 0.18, size = 18, normalized size = 0.72 \begin {gather*} \frac {x}{2}+\frac {\sin \left (2\,a+2\,b\,x\right )}{4\,b} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(a + b*x)^2,x)

[Out]

x/2 + sin(2*a + 2*b*x)/(4*b)

________________________________________________________________________________________