\(\int \frac {1}{\sin (x)+\tan (x)} \, dx\) [247]

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

Optimal result

Integrand size = 7, antiderivative size = 24 \[ \int \frac {1}{\sin (x)+\tan (x)} \, dx=-\frac {1}{2} \text {arctanh}(\cos (x))+\frac {1}{2} \cot (x) \csc (x)-\frac {\csc ^2(x)}{2} \]

[Out]

-1/2*arctanh(cos(x))+1/2*cot(x)*csc(x)-1/2*csc(x)^2

Rubi [A] (verified)

Time = 0.05 (sec) , antiderivative size = 24, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.857, Rules used = {4482, 2785, 2686, 30, 2691, 3855} \[ \int \frac {1}{\sin (x)+\tan (x)} \, dx=-\frac {1}{2} \text {arctanh}(\cos (x))-\frac {1}{2} \csc ^2(x)+\frac {1}{2} \cot (x) \csc (x) \]

[In]

Int[(Sin[x] + Tan[x])^(-1),x]

[Out]

-1/2*ArcTanh[Cos[x]] + (Cot[x]*Csc[x])/2 - Csc[x]^2/2

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rule 2686

Int[((a_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[a/f, Subst[
Int[(a*x)^(m - 1)*(-1 + x^2)^((n - 1)/2), x], x, Sec[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n -
1)/2] &&  !(IntegerQ[m/2] && LtQ[0, m, n + 1])

Rule 2691

Int[((a_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[b*(a*Sec[e +
 f*x])^m*((b*Tan[e + f*x])^(n - 1)/(f*(m + n - 1))), x] - Dist[b^2*((n - 1)/(m + n - 1)), Int[(a*Sec[e + f*x])
^m*(b*Tan[e + f*x])^(n - 2), x], x] /; FreeQ[{a, b, e, f, m}, x] && GtQ[n, 1] && NeQ[m + n - 1, 0] && Integers
Q[2*m, 2*n]

Rule 2785

Int[((g_.)*tan[(e_.) + (f_.)*(x_)])^(p_.)/((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Dist[1/a, Int[S
ec[e + f*x]^2*(g*Tan[e + f*x])^p, x], x] - Dist[1/(b*g), Int[Sec[e + f*x]*(g*Tan[e + f*x])^(p + 1), x], x] /;
FreeQ[{a, b, e, f, g, p}, x] && EqQ[a^2 - b^2, 0] && NeQ[p, -1]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 4482

Int[u_, x_Symbol] :> Int[TrigSimplify[u], x] /; TrigSimplifyQ[u]

Rubi steps \begin{align*} \text {integral}& = \int \frac {\cot (x)}{1+\cos (x)} \, dx \\ & = -\int \cot ^2(x) \csc (x) \, dx+\int \cot (x) \csc ^2(x) \, dx \\ & = \frac {1}{2} \cot (x) \csc (x)+\frac {1}{2} \int \csc (x) \, dx-\text {Subst}(\int x \, dx,x,\csc (x)) \\ & = -\frac {1}{2} \text {arctanh}(\cos (x))+\frac {1}{2} \cot (x) \csc (x)-\frac {\csc ^2(x)}{2} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.03 (sec) , antiderivative size = 35, normalized size of antiderivative = 1.46 \[ \int \frac {1}{\sin (x)+\tan (x)} \, dx=-\frac {1}{2} \log \left (\cos \left (\frac {x}{2}\right )\right )+\frac {1}{2} \log \left (\sin \left (\frac {x}{2}\right )\right )-\frac {1}{4} \sec ^2\left (\frac {x}{2}\right ) \]

[In]

Integrate[(Sin[x] + Tan[x])^(-1),x]

[Out]

-1/2*Log[Cos[x/2]] + Log[Sin[x/2]]/2 - Sec[x/2]^2/4

Maple [A] (verified)

Time = 0.22 (sec) , antiderivative size = 24, normalized size of antiderivative = 1.00

method result size
default \(-\frac {1}{2 \left (\cos \left (x \right )+1\right )}-\frac {\ln \left (\cos \left (x \right )+1\right )}{4}+\frac {\ln \left (-1+\cos \left (x \right )\right )}{4}\) \(24\)
risch \(-\frac {{\mathrm e}^{i x}}{\left ({\mathrm e}^{i x}+1\right )^{2}}-\frac {\ln \left ({\mathrm e}^{i x}+1\right )}{2}+\frac {\ln \left ({\mathrm e}^{i x}-1\right )}{2}\) \(38\)

[In]

int(1/(sin(x)+tan(x)),x,method=_RETURNVERBOSE)

[Out]

-1/2/(cos(x)+1)-1/4*ln(cos(x)+1)+1/4*ln(-1+cos(x))

Fricas [A] (verification not implemented)

none

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

[In]

integrate(1/(sin(x)+tan(x)),x, algorithm="fricas")

[Out]

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

Sympy [F]

\[ \int \frac {1}{\sin (x)+\tan (x)} \, dx=\int \frac {1}{\sin {\left (x \right )} + \tan {\left (x \right )}}\, dx \]

[In]

integrate(1/(sin(x)+tan(x)),x)

[Out]

Integral(1/(sin(x) + tan(x)), x)

Maxima [A] (verification not implemented)

none

Time = 0.19 (sec) , antiderivative size = 25, normalized size of antiderivative = 1.04 \[ \int \frac {1}{\sin (x)+\tan (x)} \, dx=-\frac {\sin \left (x\right )^{2}}{4 \, {\left (\cos \left (x\right ) + 1\right )}^{2}} + \frac {1}{2} \, \log \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1}\right ) \]

[In]

integrate(1/(sin(x)+tan(x)),x, algorithm="maxima")

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 28, normalized size of antiderivative = 1.17 \[ \int \frac {1}{\sin (x)+\tan (x)} \, dx=\frac {\cos \left (x\right ) - 1}{4 \, {\left (\cos \left (x\right ) + 1\right )}} + \frac {1}{4} \, \log \left (-\frac {\cos \left (x\right ) - 1}{\cos \left (x\right ) + 1}\right ) \]

[In]

integrate(1/(sin(x)+tan(x)),x, algorithm="giac")

[Out]

1/4*(cos(x) - 1)/(cos(x) + 1) + 1/4*log(-(cos(x) - 1)/(cos(x) + 1))

Mupad [B] (verification not implemented)

Time = 0.32 (sec) , antiderivative size = 16, normalized size of antiderivative = 0.67 \[ \int \frac {1}{\sin (x)+\tan (x)} \, dx=\frac {\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )\right )}{2}-\frac {{\mathrm {tan}\left (\frac {x}{2}\right )}^2}{4} \]

[In]

int(1/(sin(x) + tan(x)),x)

[Out]

log(tan(x/2))/2 - tan(x/2)^2/4