\(\int (\csc (x)-\sec (x)) (\cos (x)+\sin (x)) \, dx\) [827]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [B] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 13, antiderivative size = 7 \[ \int (\csc (x)-\sec (x)) (\cos (x)+\sin (x)) \, dx=\log (\cos (x))+\log (\sin (x)) \]

[Out]

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

Rubi [A] (verified)

Time = 0.05 (sec) , antiderivative size = 9, normalized size of antiderivative = 1.29, number of steps used = 4, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.154, Rules used = {457, 78} \[ \int (\csc (x)-\sec (x)) (\cos (x)+\sin (x)) \, dx=\log (\tan (x))+2 \log (\cos (x)) \]

[In]

Int[(Csc[x] - Sec[x])*(Cos[x] + Sin[x]),x]

[Out]

2*Log[Cos[x]] + Log[Tan[x]]

Rule 78

Int[((a_.) + (b_.)*(x_))*((c_) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Int[ExpandIntegran
d[(a + b*x)*(c + d*x)^n*(e + f*x)^p, x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && ((ILtQ[
n, 0] && ILtQ[p, 0]) || EqQ[p, 1] || (IGtQ[p, 0] && ( !IntegerQ[n] || LeQ[9*p + 5*(n + 2), 0] || GeQ[n + p + 1
, 0] || (GeQ[n + p + 2, 0] && RationalQ[a, b, c, d, e, f]))))

Rule 457

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Dist[1/n, Subst[Int
[x^(Simplify[(m + 1)/n] - 1)*(a + b*x)^p*(c + d*x)^q, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p, q}, x] &&
 NeQ[b*c - a*d, 0] && IntegerQ[Simplify[(m + 1)/n]]

Rubi steps \begin{align*} \text {integral}& = \text {Subst}\left (\int \frac {1-x^2}{x \left (1+x^2\right )} \, dx,x,\tan (x)\right ) \\ & = \frac {1}{2} \text {Subst}\left (\int \frac {1-x}{x (1+x)} \, dx,x,\tan ^2(x)\right ) \\ & = \frac {1}{2} \text {Subst}\left (\int \left (\frac {1}{x}-\frac {2}{1+x}\right ) \, dx,x,\tan ^2(x)\right ) \\ & = 2 \log (\cos (x))+\log (\tan (x)) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.00 (sec) , antiderivative size = 9, normalized size of antiderivative = 1.29 \[ \int (\csc (x)-\sec (x)) (\cos (x)+\sin (x)) \, dx=2 \log (\cos (x))+\log (\tan (x)) \]

[In]

Integrate[(Csc[x] - Sec[x])*(Cos[x] + Sin[x]),x]

[Out]

2*Log[Cos[x]] + Log[Tan[x]]

Maple [A] (verified)

Time = 1.34 (sec) , antiderivative size = 8, normalized size of antiderivative = 1.14

method result size
default \(\ln \left (\cos \left (x \right )\right )+\ln \left (\sin \left (x \right )\right )\) \(8\)
parts \(\ln \left (\sin \left (x \right )\right )-\ln \left (\sec \left (x \right )\right )\) \(10\)
risch \(-2 i x +\ln \left ({\mathrm e}^{4 i x}-1\right )\) \(14\)
norman \(-2 \ln \left (1+\tan \left (\frac {x}{2}\right )^{2}\right )+\ln \left (\tan \left (\frac {x}{2}\right )\right )+\ln \left (\tan \left (\frac {x}{2}\right )-1\right )+\ln \left (\tan \left (\frac {x}{2}\right )+1\right )\) \(32\)
parallelrisch \(-2 \ln \left (\frac {1}{\cos \left (x \right )+1}\right )+\ln \left (\frac {\csc \left (x \right )}{4}-\frac {\cot \left (x \right )}{4}\right )+\ln \left (-\cot \left (x \right )+\csc \left (x \right )-1\right )+\ln \left (\csc \left (x \right )-\cot \left (x \right )+1\right )\) \(39\)

[In]

int((csc(x)-sec(x))*(sin(x)+cos(x)),x,method=_RETURNVERBOSE)

[Out]

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

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 7, normalized size of antiderivative = 1.00 \[ \int (\csc (x)-\sec (x)) (\cos (x)+\sin (x)) \, dx=\log \left (-\frac {1}{2} \, \cos \left (x\right ) \sin \left (x\right )\right ) \]

[In]

integrate((csc(x)-sec(x))*(cos(x)+sin(x)),x, algorithm="fricas")

[Out]

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

Sympy [A] (verification not implemented)

Time = 1.16 (sec) , antiderivative size = 8, normalized size of antiderivative = 1.14 \[ \int (\csc (x)-\sec (x)) (\cos (x)+\sin (x)) \, dx=\log {\left (\sin {\left (x \right )} \right )} + \log {\left (\cos {\left (x \right )} \right )} \]

[In]

integrate((csc(x)-sec(x))*(cos(x)+sin(x)),x)

[Out]

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

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 15 vs. \(2 (7) = 14\).

Time = 0.22 (sec) , antiderivative size = 15, normalized size of antiderivative = 2.14 \[ \int (\csc (x)-\sec (x)) (\cos (x)+\sin (x)) \, dx=\frac {1}{2} \, \log \left (-\sin \left (x\right )^{2} + 1\right ) + \log \left (\sin \left (x\right )\right ) \]

[In]

integrate((csc(x)-sec(x))*(cos(x)+sin(x)),x, algorithm="maxima")

[Out]

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

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 16 vs. \(2 (7) = 14\).

Time = 0.27 (sec) , antiderivative size = 16, normalized size of antiderivative = 2.29 \[ \int (\csc (x)-\sec (x)) (\cos (x)+\sin (x)) \, dx=\frac {1}{2} \, \log \left (-\cos \left (x\right )^{2} + 1\right ) + \log \left ({\left | \cos \left (x\right ) \right |}\right ) \]

[In]

integrate((csc(x)-sec(x))*(cos(x)+sin(x)),x, algorithm="giac")

[Out]

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

Mupad [B] (verification not implemented)

Time = 26.44 (sec) , antiderivative size = 26, normalized size of antiderivative = 3.71 \[ \int (\csc (x)-\sec (x)) (\cos (x)+\sin (x)) \, dx=\ln \left ({\mathrm {tan}\left (\frac {x}{2}\right )}^3-\mathrm {tan}\left (\frac {x}{2}\right )\right )-2\,\ln \left ({\mathrm {tan}\left (\frac {x}{2}\right )}^2+1\right ) \]

[In]

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

[Out]

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