3.3.63 \(\int \frac {-\cos (x)+\sin (x)}{\cos (x)+\sin (x)} \, dx\) [263]

Optimal. Leaf size=8 \[ -\log (\cos (x)+\sin (x)) \]

[Out]

-ln(cos(x)+sin(x))

________________________________________________________________________________________

Rubi [A]
time = 0.01, antiderivative size = 8, normalized size of antiderivative = 1.00, number of steps used = 1, number of rules used = 1, integrand size = 15, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.067, Rules used = {3212} \begin {gather*} -\log (\sin (x)+\cos (x)) \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(-Cos[x] + Sin[x])/(Cos[x] + Sin[x]),x]

[Out]

-Log[Cos[x] + Sin[x]]

Rule 3212

Int[((A_.) + cos[(d_.) + (e_.)*(x_)]*(B_.) + (C_.)*sin[(d_.) + (e_.)*(x_)])/((a_.) + cos[(d_.) + (e_.)*(x_)]*(
b_.) + (c_.)*sin[(d_.) + (e_.)*(x_)]), x_Symbol] :> Simp[(b*B + c*C)*(x/(b^2 + c^2)), x] + Simp[(c*B - b*C)*(L
og[a + b*Cos[d + e*x] + c*Sin[d + e*x]]/(e*(b^2 + c^2))), x] /; FreeQ[{a, b, c, d, e, A, B, C}, x] && NeQ[b^2
+ c^2, 0] && EqQ[A*(b^2 + c^2) - a*(b*B + c*C), 0]

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]
time = 0.02, size = 8, normalized size = 1.00 \begin {gather*} -\log (\cos (x)+\sin (x)) \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(-Cos[x] + Sin[x])/(Cos[x] + Sin[x]),x]

[Out]

-Log[Cos[x] + Sin[x]]

________________________________________________________________________________________

Mathics [B] Leaf count is larger than twice the leaf count of optimal. \(18\) vs. \(2(8)=16\).
time = 1.75, size = 14, normalized size = 1.75 \begin {gather*} -\text {Log}\left [\text {Sin}\left [\frac {\text {Pi}}{4}+x\right ]\right ]-\frac {\text {Log}\left [2\right ]}{2} \end {gather*}

Antiderivative was successfully verified.

[In]

mathics('Integrate[(-Cos[x] + Sin[x])/(Cos[x] + Sin[x]),x]')

[Out]

-Log[Sin[Pi / 4 + x]] - Log[2] / 2

________________________________________________________________________________________

Maple [A]
time = 0.06, size = 9, normalized size = 1.12

method result size
derivativedivides \(-\ln \left (\cos \left (x \right )+\sin \left (x \right )\right )\) \(9\)
default \(-\ln \left (\cos \left (x \right )+\sin \left (x \right )\right )\) \(9\)
risch \(i x -\ln \left ({\mathrm e}^{2 i x}+i\right )\) \(17\)
norman \(-\ln \left (\tan ^{2}\left (\frac {x}{2}\right )-2 \tan \left (\frac {x}{2}\right )-1\right )+\ln \left (1+\tan ^{2}\left (\frac {x}{2}\right )\right )\) \(28\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((-cos(x)+sin(x))/(cos(x)+sin(x)),x,method=_RETURNVERBOSE)

[Out]

-ln(cos(x)+sin(x))

________________________________________________________________________________________

Maxima [A]
time = 0.26, size = 8, normalized size = 1.00 \begin {gather*} -\log \left (\cos \left (x\right ) + \sin \left (x\right )\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((-cos(x)+sin(x))/(cos(x)+sin(x)),x, algorithm="maxima")

[Out]

-log(cos(x) + sin(x))

________________________________________________________________________________________

Fricas [A]
time = 0.36, size = 11, normalized size = 1.38 \begin {gather*} -\frac {1}{2} \, \log \left (2 \, \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))/(cos(x)+sin(x)),x, algorithm="fricas")

[Out]

-1/2*log(2*cos(x)*sin(x) + 1)

________________________________________________________________________________________

Sympy [A]
time = 0.06, size = 8, normalized size = 1.00 \begin {gather*} - \log {\left (\sin {\left (x \right )} + \cos {\left (x \right )} \right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((-cos(x)+sin(x))/(cos(x)+sin(x)),x)

[Out]

-log(sin(x) + cos(x))

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 18 vs. \(2 (8) = 16\).
time = 0.01, size = 23, normalized size = 2.88 \begin {gather*} 2 \left (-\frac {\ln \left |\tan x+1\right |}{2}+\frac {\ln \left (\tan ^{2}x+1\right )}{4}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((-cos(x)+sin(x))/(cos(x)+sin(x)),x)

[Out]

1/2*log(tan(x)^2 + 1) - log(abs(tan(x) + 1))

________________________________________________________________________________________

Mupad [B]
time = 0.42, size = 32, normalized size = 4.00 \begin {gather*} -2\,\mathrm {atanh}\left (\frac {128\,\mathrm {tan}\left (\frac {x}{2}\right )+128}{16\,{\mathrm {tan}\left (\frac {x}{2}\right )}^2+32\,\mathrm {tan}\left (\frac {x}{2}\right )+48}-3\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(-(cos(x) - sin(x))/(cos(x) + sin(x)),x)

[Out]

-2*atanh((128*tan(x/2) + 128)/(32*tan(x/2) + 16*tan(x/2)^2 + 48) - 3)

________________________________________________________________________________________