3.5.5 \(\int (\cos (x)-\sin (x)) \sqrt {\sin (2 x)} \, dx\) [405]

Optimal. Leaf size=47 \[ -\frac {1}{2} \log \left (\cos (x)+\sin (x)+\sqrt {\sin (2 x)}\right )+\frac {1}{2} \cos (x) \sqrt {\sin (2 x)}+\frac {1}{2} \sin (x) \sqrt {\sin (2 x)} \]

[Out]

-1/2*ln(cos(x)+sin(x)+sin(2*x)^(1/2))+1/2*cos(x)*sin(2*x)^(1/2)+1/2*sin(x)*sin(2*x)^(1/2)

________________________________________________________________________________________

Rubi [A]
time = 0.07, antiderivative size = 47, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, integrand size = 16, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.312, Rules used = {4486, 4386, 4391, 4387, 4390} \begin {gather*} \frac {1}{2} \sin (x) \sqrt {\sin (2 x)}+\frac {1}{2} \sqrt {\sin (2 x)} \cos (x)-\frac {1}{2} \log \left (\sin (x)+\sqrt {\sin (2 x)}+\cos (x)\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(Cos[x] - Sin[x])*Sqrt[Sin[2*x]],x]

[Out]

-1/2*Log[Cos[x] + Sin[x] + Sqrt[Sin[2*x]]] + (Cos[x]*Sqrt[Sin[2*x]])/2 + (Sin[x]*Sqrt[Sin[2*x]])/2

Rule 4386

Int[cos[(a_.) + (b_.)*(x_)]*((g_.)*sin[(c_.) + (d_.)*(x_)])^(p_), x_Symbol] :> Simp[2*Sin[a + b*x]*((g*Sin[c +
 d*x])^p/(d*(2*p + 1))), x] + Dist[2*p*(g/(2*p + 1)), Int[Sin[a + b*x]*(g*Sin[c + d*x])^(p - 1), x], x] /; Fre
eQ[{a, b, c, d, g}, x] && EqQ[b*c - a*d, 0] && EqQ[d/b, 2] &&  !IntegerQ[p] && GtQ[p, 0] && IntegerQ[2*p]

Rule 4387

Int[sin[(a_.) + (b_.)*(x_)]*((g_.)*sin[(c_.) + (d_.)*(x_)])^(p_), x_Symbol] :> Simp[-2*Cos[a + b*x]*((g*Sin[c
+ d*x])^p/(d*(2*p + 1))), x] + Dist[2*p*(g/(2*p + 1)), Int[Cos[a + b*x]*(g*Sin[c + d*x])^(p - 1), x], x] /; Fr
eeQ[{a, b, c, d, g}, x] && EqQ[b*c - a*d, 0] && EqQ[d/b, 2] &&  !IntegerQ[p] && GtQ[p, 0] && IntegerQ[2*p]

Rule 4390

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

Rule 4391

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

Rule 4486

Int[u_, x_Symbol] :> With[{v = ExpandTrig[u, x]}, Int[v, x] /; SumQ[v]] /;  !InertTrigFreeQ[u]

Rubi steps

\begin {align*} \int (\cos (x)-\sin (x)) \sqrt {\sin (2 x)} \, dx &=\int \left (\cos (x) \sqrt {\sin (2 x)}-\sin (x) \sqrt {\sin (2 x)}\right ) \, dx\\ &=\int \cos (x) \sqrt {\sin (2 x)} \, dx-\int \sin (x) \sqrt {\sin (2 x)} \, dx\\ &=\frac {1}{2} \cos (x) \sqrt {\sin (2 x)}+\frac {1}{2} \sin (x) \sqrt {\sin (2 x)}-\frac {1}{2} \int \frac {\cos (x)}{\sqrt {\sin (2 x)}} \, dx+\frac {1}{2} \int \frac {\sin (x)}{\sqrt {\sin (2 x)}} \, dx\\ &=-\frac {1}{2} \log \left (\cos (x)+\sin (x)+\sqrt {\sin (2 x)}\right )+\frac {1}{2} \cos (x) \sqrt {\sin (2 x)}+\frac {1}{2} \sin (x) \sqrt {\sin (2 x)}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.05, size = 43, normalized size = 0.91 \begin {gather*} \frac {1}{2} \left (-\log \left (\cos (x)+\sin (x)+\sqrt {\sin (2 x)}\right )+\cos (x) \sqrt {\sin (2 x)}+\sin (x) \sqrt {\sin (2 x)}\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(Cos[x] - Sin[x])*Sqrt[Sin[2*x]],x]

[Out]

(-Log[Cos[x] + Sin[x] + Sqrt[Sin[2*x]]] + Cos[x]*Sqrt[Sin[2*x]] + Sin[x]*Sqrt[Sin[2*x]])/2

________________________________________________________________________________________

Maple [C] Result contains higher order function than in optimal. Order 4 vs. order 3.
time = 0.18, size = 443, normalized size = 9.43

method result size
default \(-\frac {\sqrt {-\frac {\tan \left (\frac {x}{2}\right )}{\tan ^{2}\left (\frac {x}{2}\right )-1}}\, \left (\tan ^{2}\left (\frac {x}{2}\right )-1\right ) \left (3 \sqrt {\left (1+\tan \left (\frac {x}{2}\right )\right ) \left (\tan \left (\frac {x}{2}\right )-1\right ) \tan \left (\frac {x}{2}\right )}\, \sqrt {1+\tan \left (\frac {x}{2}\right )}\, \sqrt {-2 \tan \left (\frac {x}{2}\right )+2}\, \sqrt {-\tan \left (\frac {x}{2}\right )}\, \EllipticF \left (\sqrt {1+\tan \left (\frac {x}{2}\right )}, \frac {\sqrt {2}}{2}\right ) \left (\tan ^{2}\left (\frac {x}{2}\right )\right )-4 \sqrt {\left (1+\tan \left (\frac {x}{2}\right )\right ) \left (\tan \left (\frac {x}{2}\right )-1\right ) \tan \left (\frac {x}{2}\right )}\, \sqrt {1+\tan \left (\frac {x}{2}\right )}\, \sqrt {-2 \tan \left (\frac {x}{2}\right )+2}\, \sqrt {-\tan \left (\frac {x}{2}\right )}\, \EllipticE \left (\sqrt {1+\tan \left (\frac {x}{2}\right )}, \frac {\sqrt {2}}{2}\right ) \left (\tan ^{2}\left (\frac {x}{2}\right )\right )+3 \sqrt {1+\tan \left (\frac {x}{2}\right )}\, \sqrt {-2 \tan \left (\frac {x}{2}\right )+2}\, \sqrt {-\tan \left (\frac {x}{2}\right )}\, \EllipticF \left (\sqrt {1+\tan \left (\frac {x}{2}\right )}, \frac {\sqrt {2}}{2}\right ) \sqrt {\left (1+\tan \left (\frac {x}{2}\right )\right ) \left (\tan \left (\frac {x}{2}\right )-1\right ) \tan \left (\frac {x}{2}\right )}-4 \sqrt {\left (1+\tan \left (\frac {x}{2}\right )\right ) \left (\tan \left (\frac {x}{2}\right )-1\right ) \tan \left (\frac {x}{2}\right )}\, \sqrt {1+\tan \left (\frac {x}{2}\right )}\, \sqrt {-2 \tan \left (\frac {x}{2}\right )+2}\, \sqrt {-\tan \left (\frac {x}{2}\right )}\, \EllipticE \left (\sqrt {1+\tan \left (\frac {x}{2}\right )}, \frac {\sqrt {2}}{2}\right )-4 \sqrt {\tan ^{3}\left (\frac {x}{2}\right )-\tan \left (\frac {x}{2}\right )}\, \left (\tan ^{4}\left (\frac {x}{2}\right )\right )+2 \sqrt {\left (1+\tan \left (\frac {x}{2}\right )\right ) \left (\tan \left (\frac {x}{2}\right )-1\right ) \tan \left (\frac {x}{2}\right )}\, \left (\tan ^{3}\left (\frac {x}{2}\right )\right )-4 \sqrt {\tan ^{3}\left (\frac {x}{2}\right )-\tan \left (\frac {x}{2}\right )}\, \left (\tan ^{2}\left (\frac {x}{2}\right )\right )-2 \sqrt {\left (1+\tan \left (\frac {x}{2}\right )\right ) \left (\tan \left (\frac {x}{2}\right )-1\right ) \tan \left (\frac {x}{2}\right )}\, \tan \left (\frac {x}{2}\right )\right )}{\sqrt {\tan \left (\frac {x}{2}\right ) \left (\tan ^{2}\left (\frac {x}{2}\right )-1\right )}\, \sqrt {\left (1+\tan \left (\frac {x}{2}\right )\right ) \left (\tan \left (\frac {x}{2}\right )-1\right ) \tan \left (\frac {x}{2}\right )}\, \sqrt {\tan ^{3}\left (\frac {x}{2}\right )-\tan \left (\frac {x}{2}\right )}\, \left (1+\tan ^{2}\left (\frac {x}{2}\right )\right )}\) \(443\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((cos(x)-sin(x))*sin(2*x)^(1/2),x,method=_RETURNVERBOSE)

[Out]

-(-tan(1/2*x)/(tan(1/2*x)^2-1))^(1/2)*(tan(1/2*x)^2-1)*(3*((1+tan(1/2*x))*(tan(1/2*x)-1)*tan(1/2*x))^(1/2)*(1+
tan(1/2*x))^(1/2)*(-2*tan(1/2*x)+2)^(1/2)*(-tan(1/2*x))^(1/2)*EllipticF((1+tan(1/2*x))^(1/2),1/2*2^(1/2))*tan(
1/2*x)^2-4*((1+tan(1/2*x))*(tan(1/2*x)-1)*tan(1/2*x))^(1/2)*(1+tan(1/2*x))^(1/2)*(-2*tan(1/2*x)+2)^(1/2)*(-tan
(1/2*x))^(1/2)*EllipticE((1+tan(1/2*x))^(1/2),1/2*2^(1/2))*tan(1/2*x)^2+3*(1+tan(1/2*x))^(1/2)*(-2*tan(1/2*x)+
2)^(1/2)*(-tan(1/2*x))^(1/2)*EllipticF((1+tan(1/2*x))^(1/2),1/2*2^(1/2))*((1+tan(1/2*x))*(tan(1/2*x)-1)*tan(1/
2*x))^(1/2)-4*((1+tan(1/2*x))*(tan(1/2*x)-1)*tan(1/2*x))^(1/2)*(1+tan(1/2*x))^(1/2)*(-2*tan(1/2*x)+2)^(1/2)*(-
tan(1/2*x))^(1/2)*EllipticE((1+tan(1/2*x))^(1/2),1/2*2^(1/2))-4*(tan(1/2*x)^3-tan(1/2*x))^(1/2)*tan(1/2*x)^4+2
*((1+tan(1/2*x))*(tan(1/2*x)-1)*tan(1/2*x))^(1/2)*tan(1/2*x)^3-4*(tan(1/2*x)^3-tan(1/2*x))^(1/2)*tan(1/2*x)^2-
2*((1+tan(1/2*x))*(tan(1/2*x)-1)*tan(1/2*x))^(1/2)*tan(1/2*x))/(tan(1/2*x)*(tan(1/2*x)^2-1))^(1/2)/((1+tan(1/2
*x))*(tan(1/2*x)-1)*tan(1/2*x))^(1/2)/(tan(1/2*x)^3-tan(1/2*x))^(1/2)/(1+tan(1/2*x)^2)

________________________________________________________________________________________

Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((cos(x)-sin(x))*sin(2*x)^(1/2),x, algorithm="maxima")

[Out]

integrate((cos(x) - sin(x))*sqrt(sin(2*x)), x)

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 76 vs. \(2 (35) = 70\).
time = 1.49, size = 76, normalized size = 1.62 \begin {gather*} \frac {1}{2} \, \sqrt {2} \sqrt {\cos \left (x\right ) \sin \left (x\right )} {\left (\cos \left (x\right ) + \sin \left (x\right )\right )} + \frac {1}{8} \, \log \left (-32 \, \cos \left (x\right )^{4} + 4 \, \sqrt {2} {\left (4 \, \cos \left (x\right )^{3} - {\left (4 \, \cos \left (x\right )^{2} + 1\right )} \sin \left (x\right ) - 5 \, \cos \left (x\right )\right )} \sqrt {\cos \left (x\right ) \sin \left (x\right )} + 32 \, \cos \left (x\right )^{2} + 16 \, \cos \left (x\right ) \sin \left (x\right ) + 1\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((cos(x)-sin(x))*sin(2*x)^(1/2),x, algorithm="fricas")

[Out]

1/2*sqrt(2)*sqrt(cos(x)*sin(x))*(cos(x) + sin(x)) + 1/8*log(-32*cos(x)^4 + 4*sqrt(2)*(4*cos(x)^3 - (4*cos(x)^2
 + 1)*sin(x) - 5*cos(x))*sqrt(cos(x)*sin(x)) + 32*cos(x)^2 + 16*cos(x)*sin(x) + 1)

________________________________________________________________________________________

Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((cos(x)-sin(x))*sin(2*x)**(1/2),x)

[Out]

Timed out

________________________________________________________________________________________

Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((cos(x)-sin(x))*sin(2*x)^(1/2),x, algorithm="giac")

[Out]

integrate((cos(x) - sin(x))*sqrt(sin(2*x)), x)

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.02 \begin {gather*} \int \sqrt {\sin \left (2\,x\right )}\,\left (\cos \left (x\right )-\sin \left (x\right )\right ) \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(2*x)^(1/2)*(cos(x) - sin(x)),x)

[Out]

int(sin(2*x)^(1/2)*(cos(x) - sin(x)), x)

________________________________________________________________________________________