3.947 \(\int \frac{-\csc (a+b x)+\sec (a+b x)}{\csc (a+b x)+\sec (a+b x)} \, dx\)

Optimal. Leaf size=19 \[ -\frac{\log (\sin (a+b x)+\cos (a+b x))}{b} \]

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.31409, antiderivative size = 19, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 2, integrand size = 31, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.065, Rules used = {801, 260} \[ -\frac{\log (\sin (a+b x)+\cos (a+b x))}{b} \]

Antiderivative was successfully verified.

[In]

Int[(-Csc[a + b*x] + Sec[a + b*x])/(Csc[a + b*x] + Sec[a + b*x]),x]

[Out]

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

Rule 801

Int[(((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_)))/((a_) + (c_.)*(x_)^2), x_Symbol] :> Int[ExpandIntegrand[(
(d + e*x)^m*(f + g*x))/(a + c*x^2), x], x] /; FreeQ[{a, c, d, e, f, g}, x] && NeQ[c*d^2 + a*e^2, 0] && Integer
Q[m]

Rule 260

Int[(x_)^(m_.)/((a_) + (b_.)*(x_)^(n_)), x_Symbol] :> Simp[Log[RemoveContent[a + b*x^n, x]]/(b*n), x] /; FreeQ
[{a, b, m, n}, x] && EqQ[m, n - 1]

Rubi steps

\begin{align*} \int \frac{-\csc (a+b x)+\sec (a+b x)}{\csc (a+b x)+\sec (a+b x)} \, dx &=\frac{\operatorname{Subst}\left (\int \frac{-1+x}{(1+x) \left (1+x^2\right )} \, dx,x,\tan (a+b x)\right )}{b}\\ &=\frac{\operatorname{Subst}\left (\int \left (\frac{1}{-1-x}+\frac{x}{1+x^2}\right ) \, dx,x,\tan (a+b x)\right )}{b}\\ &=-\frac{\log (1+\tan (a+b x))}{b}+\frac{\operatorname{Subst}\left (\int \frac{x}{1+x^2} \, dx,x,\tan (a+b x)\right )}{b}\\ &=-\frac{\log (\cos (a+b x))}{b}-\frac{\log (1+\tan (a+b x))}{b}\\ \end{align*}

Mathematica [A]  time = 0.0578265, size = 19, normalized size = 1. \[ -\frac{\log (\sin (a+b x)+\cos (a+b x))}{b} \]

Antiderivative was successfully verified.

[In]

Integrate[(-Csc[a + b*x] + Sec[a + b*x])/(Csc[a + b*x] + Sec[a + b*x]),x]

[Out]

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

________________________________________________________________________________________

Maple [A]  time = 0.131, size = 32, normalized size = 1.7 \begin{align*} -{\frac{\ln \left ( 1+\tan \left ( bx+a \right ) \right ) }{b}}+{\frac{\ln \left ( 1+ \left ( \tan \left ( bx+a \right ) \right ) ^{2} \right ) }{2\,b}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((-csc(b*x+a)+sec(b*x+a))/(csc(b*x+a)+sec(b*x+a)),x)

[Out]

-ln(1+tan(b*x+a))/b+1/2/b*ln(1+tan(b*x+a)^2)

________________________________________________________________________________________

Maxima [B]  time = 1.4379, size = 95, normalized size = 5. \begin{align*} -\frac{\log \left (-\frac{2 \, \sin \left (b x + a\right )}{\cos \left (b x + a\right ) + 1} + \frac{\sin \left (b x + a\right )^{2}}{{\left (\cos \left (b x + a\right ) + 1\right )}^{2}} - 1\right ) - \log \left (\frac{\sin \left (b x + a\right )^{2}}{{\left (\cos \left (b x + a\right ) + 1\right )}^{2}} + 1\right )}{b} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((-csc(b*x+a)+sec(b*x+a))/(csc(b*x+a)+sec(b*x+a)),x, algorithm="maxima")

[Out]

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

________________________________________________________________________________________

Fricas [A]  time = 2.12089, size = 61, normalized size = 3.21 \begin{align*} -\frac{\log \left (2 \, \cos \left (b x + a\right ) \sin \left (b x + a\right ) + 1\right )}{2 \, b} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((-csc(b*x+a)+sec(b*x+a))/(csc(b*x+a)+sec(b*x+a)),x, algorithm="fricas")

[Out]

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

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} - \int \frac{\csc{\left (a + b x \right )}}{\csc{\left (a + b x \right )} + \sec{\left (a + b x \right )}}\, dx - \int - \frac{\sec{\left (a + b x \right )}}{\csc{\left (a + b x \right )} + \sec{\left (a + b x \right )}}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((-csc(b*x+a)+sec(b*x+a))/(csc(b*x+a)+sec(b*x+a)),x)

[Out]

-Integral(csc(a + b*x)/(csc(a + b*x) + sec(a + b*x)), x) - Integral(-sec(a + b*x)/(csc(a + b*x) + sec(a + b*x)
), x)

________________________________________________________________________________________

Giac [A]  time = 1.15848, size = 39, normalized size = 2.05 \begin{align*} \frac{\log \left (\tan \left (b x + a\right )^{2} + 1\right ) - 2 \, \log \left ({\left | \tan \left (b x + a\right ) + 1 \right |}\right )}{2 \, b} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((-csc(b*x+a)+sec(b*x+a))/(csc(b*x+a)+sec(b*x+a)),x, algorithm="giac")

[Out]

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