3.3.49 \(\int \frac {\sec (x)}{1+\sin (x)} \, dx\) [249]

Optimal. Leaf size=18 \[ \frac {1}{2} \tanh ^{-1}(\sin (x))-\frac {1}{2 (1+\sin (x))} \]

[Out]

1/2*arctanh(sin(x))-1/2/(1+sin(x))

________________________________________________________________________________________

Rubi [A]
time = 0.02, antiderivative size = 18, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {2746, 46, 213} \begin {gather*} \frac {1}{2} \tanh ^{-1}(\sin (x))-\frac {1}{2 (\sin (x)+1)} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Sec[x]/(1 + Sin[x]),x]

[Out]

ArcTanh[Sin[x]]/2 - 1/(2*(1 + Sin[x]))

Rule 46

Int[((a_) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d*x
)^n, x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && ILtQ[m, 0] && IntegerQ[n] &&  !(IGtQ[n, 0] && Lt
Q[m + n + 2, 0])

Rule 213

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[b, 2])^(-1))*ArcTanh[Rt[b, 2]*(x/Rt[-a, 2])]
, x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (LtQ[a, 0] || GtQ[b, 0])

Rule 2746

Int[cos[(e_.) + (f_.)*(x_)]^(p_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.), x_Symbol] :> Dist[1/(b^p*f), S
ubst[Int[(a + x)^(m + (p - 1)/2)*(a - x)^((p - 1)/2), x], x, b*Sin[e + f*x]], x] /; FreeQ[{a, b, e, f, m}, x]
&& IntegerQ[(p - 1)/2] && EqQ[a^2 - b^2, 0] && (GeQ[p, -1] ||  !IntegerQ[m + 1/2])

Rubi steps

\begin {align*} \int \frac {\sec (x)}{1+\sin (x)} \, dx &=\text {Subst}\left (\int \frac {1}{(1-x) (1+x)^2} \, dx,x,\sin (x)\right )\\ &=\text {Subst}\left (\int \left (\frac {1}{2 (1+x)^2}-\frac {1}{2 \left (-1+x^2\right )}\right ) \, dx,x,\sin (x)\right )\\ &=-\frac {1}{2 (1+\sin (x))}-\frac {1}{2} \text {Subst}\left (\int \frac {1}{-1+x^2} \, dx,x,\sin (x)\right )\\ &=\frac {1}{2} \tanh ^{-1}(\sin (x))-\frac {1}{2 (1+\sin (x))}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.01, size = 18, normalized size = 1.00 \begin {gather*} \frac {1}{2} \tanh ^{-1}(\sin (x))-\frac {1}{2 (1+\sin (x))} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Sec[x]/(1 + Sin[x]),x]

[Out]

ArcTanh[Sin[x]]/2 - 1/(2*(1 + Sin[x]))

________________________________________________________________________________________

Mathics [B] Leaf count is larger than twice the leaf count of optimal. \(65\) vs. \(2(18)=36\).
time = 4.48, size = 55, normalized size = 3.06 \begin {gather*} \frac {\text {Log}\left [1+\text {Tan}\left [\frac {x}{2}\right ]\right ]+\text {Sin}\left [x\right ]-\text {Log}\left [-1+\text {Tan}\left [\frac {x}{2}\right ]\right ]-\text {Log}\left [-1+\text {Tan}\left [\frac {x}{2}\right ]\right ] \text {Sin}\left [x\right ]+\text {Log}\left [1+\text {Tan}\left [\frac {x}{2}\right ]\right ] \text {Sin}\left [x\right ]}{\left (1+\text {Cos}\left [x\right ]\right ) \left (1+\text {Tan}\left [\frac {x}{2}\right ]\right )^2} \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

(Log[1 + Tan[x / 2]] + Sin[x] - Log[-1 + Tan[x / 2]] - Log[-1 + Tan[x / 2]] Sin[x] + Log[1 + Tan[x / 2]] Sin[x
]) / ((1 + Cos[x]) (1 + Tan[x / 2]) ^ 2)

________________________________________________________________________________________

Maple [A]
time = 0.05, size = 24, normalized size = 1.33

method result size
default \(-\frac {1}{2 \left (\sin \left (x \right )+1\right )}+\frac {\ln \left (\sin \left (x \right )+1\right )}{4}-\frac {\ln \left (-1+\sin \left (x \right )\right )}{4}\) \(24\)
norman \(\frac {\tan \left (\frac {x}{2}\right )}{\left (1+\tan \left (\frac {x}{2}\right )\right )^{2}}-\frac {\ln \left (\tan \left (\frac {x}{2}\right )-1\right )}{2}+\frac {\ln \left (1+\tan \left (\frac {x}{2}\right )\right )}{2}\) \(33\)
risch \(-\frac {i {\mathrm e}^{i x}}{\left ({\mathrm e}^{i x}+i\right )^{2}}-\frac {\ln \left ({\mathrm e}^{i x}-i\right )}{2}+\frac {\ln \left ({\mathrm e}^{i x}+i\right )}{2}\) \(42\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 33 vs. \(2 (14) = 28\).
time = 0.39, size = 33, normalized size = 1.83 \begin {gather*} \frac {{\left (\sin \left (x\right ) + 1\right )} \log \left (\sin \left (x\right ) + 1\right ) - {\left (\sin \left (x\right ) + 1\right )} \log \left (-\sin \left (x\right ) + 1\right ) - 2}{4 \, {\left (\sin \left (x\right ) + 1\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\sec {\left (x \right )}}{\sin {\left (x \right )} + 1}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Giac [A]
time = 0.00, size = 28, normalized size = 1.56 \begin {gather*} -\frac {\ln \left (-\sin x+1\right )}{4}+\frac {\ln \left (\sin x+1\right )}{4}-\frac {1}{2 \left (\sin x+1\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Mupad [B]
time = 0.13, size = 22, normalized size = 1.22 \begin {gather*} \frac {\ln \left (\mathrm {tan}\left (\frac {x}{2}+\frac {\pi }{4}\right )\right )}{2}-\frac {1}{2\,\left (\sin \left (x\right )+1\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

log(tan(x/2 + pi/4))/2 - 1/(2*(sin(x) + 1))

________________________________________________________________________________________