3.3.76 \(\int \sqrt {(\cos (20 x)+3 \cos (21 x)+\cos (22 x))^2+(\sin (20 x)+3 \sin (21 x)+\sin (22 x))^2} \, dx\) [276]

Optimal. Leaf size=32 \[ \frac {2 (3+2 \cos (x)) \left (3 \arctan \left (\tan \left (\frac {x}{2}\right )\right )+\sin (x)\right )}{\sqrt {(3+2 \cos (x))^2}} \]

[Out]

2*(3+2*cos(x))*(3*arctan(tan(1/2*x))+sin(x))/((3+2*cos(x))^2)^(1/2)

________________________________________________________________________________________

Rubi [B] Leaf count is larger than twice the leaf count of optimal. \(100\) vs. \(2(32)=64\).
time = 0.16, antiderivative size = 100, normalized size of antiderivative = 3.12, number of steps used = 4, number of rules used = 3, integrand size = 39, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.077, Rules used = {1986, 393, 209} \begin {gather*} \frac {6 \sec ^2\left (\frac {x}{2}\right ) \arctan \left (\tan \left (\frac {x}{2}\right )\right ) \sqrt {\cos ^4\left (\frac {x}{2}\right ) \left (\tan ^2\left (\frac {x}{2}\right )+5\right )^2}}{\tan ^2\left (\frac {x}{2}\right )+5}+\frac {4 \tan \left (\frac {x}{2}\right ) \sqrt {\cos ^4\left (\frac {x}{2}\right ) \left (\tan ^2\left (\frac {x}{2}\right )+5\right )^2}}{\tan ^2\left (\frac {x}{2}\right )+5} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Sqrt[(Cos[20*x] + 3*Cos[21*x] + Cos[22*x])^2 + (Sin[20*x] + 3*Sin[21*x] + Sin[22*x])^2],x]

[Out]

(6*ArcTan[Tan[x/2]]*Sec[x/2]^2*Sqrt[Cos[x/2]^4*(5 + Tan[x/2]^2)^2])/(5 + Tan[x/2]^2) + (4*Tan[x/2]*Sqrt[Cos[x/
2]^4*(5 + Tan[x/2]^2)^2])/(5 + Tan[x/2]^2)

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 393

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[(-(b*c - a*d))*x*((a + b*x^n)^(p
 + 1)/(a*b*n*(p + 1))), x] - Dist[(a*d - b*c*(n*(p + 1) + 1))/(a*b*n*(p + 1)), Int[(a + b*x^n)^(p + 1), x], x]
 /; FreeQ[{a, b, c, d, n, p}, x] && NeQ[b*c - a*d, 0] && (LtQ[p, -1] || ILtQ[1/n + p, 0])

Rule 1986

Int[(u_.)*((e_.)*((a_.) + (b_.)*(x_)^(n_.))^(q_.)*((c_) + (d_.)*(x_)^(n_))^(r_.))^(p_), x_Symbol] :> Dist[Simp
[(e*(a + b*x^n)^q*(c + d*x^n)^r)^p/((a + b*x^n)^(p*q)*(c + d*x^n)^(p*r))], Int[u*(a + b*x^n)^(p*q)*(c + d*x^n)
^(p*r), x], x] /; FreeQ[{a, b, c, d, e, n, p, q, r}, x]

Rubi steps

\begin {gather*} \begin {aligned} \text {Integral} &=2 \text {Subst}\left (\int \frac {\sqrt {\frac {\left (5+x^2\right )^2}{\left (1+x^2\right )^2}}}{1+x^2} \, dx,x,\tan \left (\frac {x}{2}\right )\right )\\ &=\frac {\left (2 \sec ^2\left (\frac {x}{2}\right ) \sqrt {\cos ^4\left (\frac {x}{2}\right ) \left (5+\tan ^2\left (\frac {x}{2}\right )\right )^2}\right ) \text {Subst}\left (\int \frac {5+x^2}{\left (1+x^2\right )^2} \, dx,x,\tan \left (\frac {x}{2}\right )\right )}{5+\tan ^2\left (\frac {x}{2}\right )}\\ &=\frac {4 \tan \left (\frac {x}{2}\right ) \sqrt {\cos ^4\left (\frac {x}{2}\right ) \left (5+\tan ^2\left (\frac {x}{2}\right )\right )^2}}{5+\tan ^2\left (\frac {x}{2}\right )}+\frac {\left (6 \sec ^2\left (\frac {x}{2}\right ) \sqrt {\cos ^4\left (\frac {x}{2}\right ) \left (5+\tan ^2\left (\frac {x}{2}\right )\right )^2}\right ) \text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan \left (\frac {x}{2}\right )\right )}{5+\tan ^2\left (\frac {x}{2}\right )}\\ &=\frac {3 x \sec ^2\left (\frac {x}{2}\right ) \sqrt {\cos ^4\left (\frac {x}{2}\right ) \left (5+\tan ^2\left (\frac {x}{2}\right )\right )^2}}{5+\tan ^2\left (\frac {x}{2}\right )}+\frac {4 \tan \left (\frac {x}{2}\right ) \sqrt {\cos ^4\left (\frac {x}{2}\right ) \left (5+\tan ^2\left (\frac {x}{2}\right )\right )^2}}{5+\tan ^2\left (\frac {x}{2}\right )}\\ \end {aligned} \end {gather*}

________________________________________________________________________________________

Mathematica [A]
time = 0.02, size = 29, normalized size = 0.91 \begin {gather*} \frac {\sqrt {(3+2 \cos (x))^2} (3 x+2 \sin (x))}{3+2 \cos (x)} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Sqrt[(Cos[20*x] + 3*Cos[21*x] + Cos[22*x])^2 + (Sin[20*x] + 3*Sin[21*x] + Sin[22*x])^2],x]

[Out]

(Sqrt[(3 + 2*Cos[x])^2]*(3*x + 2*Sin[x]))/(3 + 2*Cos[x])

________________________________________________________________________________________

Maple [C] Result contains higher order function than in optimal. Order 9 vs. order 3.
time = 1.60, size = 17, normalized size = 0.53

method result size
default \(\mathrm {csgn}\left (3+2 \cos \left (x \right )\right ) \left (3 x +2 \sin \left (x \right )\right )\) \(17\)
risch \(\frac {3 \sqrt {\left ({\mathrm e}^{2 i x}+3 \,{\mathrm e}^{i x}+1\right )^{2} {\mathrm e}^{-2 i x}}\, {\mathrm e}^{i x} x}{{\mathrm e}^{2 i x}+3 \,{\mathrm e}^{i x}+1}-\frac {i \sqrt {\left ({\mathrm e}^{2 i x}+3 \,{\mathrm e}^{i x}+1\right )^{2} {\mathrm e}^{-2 i x}}\, {\mathrm e}^{2 i x}}{{\mathrm e}^{2 i x}+3 \,{\mathrm e}^{i x}+1}+\frac {i \sqrt {\left ({\mathrm e}^{2 i x}+3 \,{\mathrm e}^{i x}+1\right )^{2} {\mathrm e}^{-2 i x}}}{{\mathrm e}^{2 i x}+3 \,{\mathrm e}^{i x}+1}\) \(141\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(((sin(20*x)+3*sin(21*x)+sin(22*x))^2+(cos(20*x)+3*cos(21*x)+cos(22*x))^2)^(1/2),x,method=_RETURNVERBOSE)

[Out]

csgn(3+2*cos(x))*(3*x+2*sin(x))

________________________________________________________________________________________

Maxima [A]
time = 0.39, size = 8, normalized size = 0.25 \begin {gather*} 3 \, x + 2 \, \sin \left (x\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(((sin(20*x)+3*sin(21*x)+sin(22*x))^2+(cos(20*x)+3*cos(21*x)+cos(22*x))^2)^(1/2),x, algorithm="maxima
")

[Out]

3*x + 2*sin(x)

________________________________________________________________________________________

Fricas [A]
time = 0.64, size = 8, normalized size = 0.25 \begin {gather*} 3 \, x + 2 \, \sin \left (x\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(((sin(20*x)+3*sin(21*x)+sin(22*x))^2+(cos(20*x)+3*cos(21*x)+cos(22*x))^2)^(1/2),x, algorithm="fricas
")

[Out]

3*x + 2*sin(x)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \sqrt {\left (\sin {\left (20 x \right )} + 3 \sin {\left (21 x \right )} + \sin {\left (22 x \right )}\right )^{2} + \left (\cos {\left (20 x \right )} + 3 \cos {\left (21 x \right )} + \cos {\left (22 x \right )}\right )^{2}}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(((sin(20*x)+3*sin(21*x)+sin(22*x))**2+(cos(20*x)+3*cos(21*x)+cos(22*x))**2)**(1/2),x)

[Out]

Integral(sqrt((sin(20*x) + 3*sin(21*x) + sin(22*x))**2 + (cos(20*x) + 3*cos(21*x) + cos(22*x))**2), x)

________________________________________________________________________________________

Giac [A]
time = 1.15, size = 32, normalized size = 1.00 \begin {gather*} -6 \, \pi \left \lfloor \frac {x}{2 \, \pi } + \frac {1}{2} \right \rfloor + 3 \, x + \frac {4 \, \tan \left (\frac {1}{2} \, x\right )}{\tan \left (\frac {1}{2} \, x\right )^{2} + 1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(((sin(20*x)+3*sin(21*x)+sin(22*x))^2+(cos(20*x)+3*cos(21*x)+cos(22*x))^2)^(1/2),x, algorithm="giac")

[Out]

-6*pi*floor(1/2*x/pi + 1/2) + 3*x + 4*tan(1/2*x)/(tan(1/2*x)^2 + 1)

________________________________________________________________________________________

Mupad [B]
time = 0.26, size = 8, normalized size = 0.25 \begin {gather*} 3\,x+2\,\sin \left (x\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(((cos(20*x) + 3*cos(21*x) + cos(22*x))^2 + (sin(20*x) + 3*sin(21*x) + sin(22*x))^2)^(1/2),x)

[Out]

3*x + 2*sin(x)

________________________________________________________________________________________

Chatgpt [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {not solved} \end {gather*}

Warning: Unable to verify antiderivative.

[In]

int(((sin(20*x)+3*sin(21*x)+sin(22*x))^2+(cos(20*x)+3*cos(21*x)+cos(22*x))^2)^(1/2),x)

[Out]

not solved

________________________________________________________________________________________