3.2.20 \(\int \frac {1}{1+\sin (x)} \, dx\) [120]

Optimal. Leaf size=10 \[ -\frac {\cos (x)}{1+\sin (x)} \]

[Out]

-cos(x)/(1+sin(x))

________________________________________________________________________________________

Rubi [A]
time = 0.00, antiderivative size = 10, normalized size of antiderivative = 1.00, number of steps used = 1, number of rules used = 1, integrand size = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.167, Rules used = {2727} \begin {gather*} -\frac {\cos (x)}{\sin (x)+1} \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

-(Cos[x]/(1 + Sin[x]))

Rule 2727

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

Rubi steps

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

________________________________________________________________________________________

Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(23\) vs. \(2(10)=20\).
time = 0.01, size = 23, normalized size = 2.30 \begin {gather*} \frac {2 \sin \left (\frac {x}{2}\right )}{\cos \left (\frac {x}{2}\right )+\sin \left (\frac {x}{2}\right )} \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

(2*Sin[x/2])/(Cos[x/2] + Sin[x/2])

________________________________________________________________________________________

Mathics [A]
time = 1.76, size = 10, normalized size = 1.00 \begin {gather*} \frac {-2}{1+\text {Tan}\left [\frac {x}{2}\right ]} \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

-2 / (1 + Tan[x / 2])

________________________________________________________________________________________

Maple [A]
time = 0.02, size = 11, normalized size = 1.10

method result size
default \(-\frac {2}{1+\tan \left (\frac {x}{2}\right )}\) \(11\)
norman \(-\frac {2}{1+\tan \left (\frac {x}{2}\right )}\) \(11\)
risch \(-\frac {2}{{\mathrm e}^{i x}+i}\) \(13\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-2/(1+tan(1/2*x))

________________________________________________________________________________________

Maxima [A]
time = 0.25, size = 15, normalized size = 1.50 \begin {gather*} -\frac {2}{\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1} + 1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [A]
time = 0.30, size = 18, normalized size = 1.80 \begin {gather*} -\frac {\cos \left (x\right ) - \sin \left (x\right ) + 1}{\cos \left (x\right ) + \sin \left (x\right ) + 1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-(cos(x) - sin(x) + 1)/(cos(x) + sin(x) + 1)

________________________________________________________________________________________

Sympy [A]
time = 0.19, size = 8, normalized size = 0.80 \begin {gather*} - \frac {2}{\tan {\left (\frac {x}{2} \right )} + 1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-2/(tan(x/2) + 1)

________________________________________________________________________________________

Giac [A]
time = 0.00, size = 11, normalized size = 1.10 \begin {gather*} -\frac {2}{\tan \left (\frac {x}{2}\right )+1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-2/(tan(1/2*x) + 1)

________________________________________________________________________________________

Mupad [B]
time = 0.02, size = 10, normalized size = 1.00 \begin {gather*} -\frac {2}{\mathrm {tan}\left (\frac {x}{2}\right )+1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-2/(tan(x/2) + 1)

________________________________________________________________________________________