\(\int \frac {1}{a \sec (x)+b \tan (x)} \, dx\) [268]

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

Optimal result

Integrand size = 11, antiderivative size = 11 \[ \int \frac {1}{a \sec (x)+b \tan (x)} \, dx=\frac {\log (a+b \sin (x))}{b} \]

[Out]

ln(a+b*sin(x))/b

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 11, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.273, Rules used = {3238, 2747, 31} \[ \int \frac {1}{a \sec (x)+b \tan (x)} \, dx=\frac {\log (a+b \sin (x))}{b} \]

[In]

Int[(a*Sec[x] + b*Tan[x])^(-1),x]

[Out]

Log[a + b*Sin[x]]/b

Rule 31

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

Rule 2747

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*(b^2 - x^2)^((p - 1)/2), x], x, b*Sin[e + f*x]], x] /; FreeQ[{a, b, e, f, m}, x] && Integer
Q[(p - 1)/2] && NeQ[a^2 - b^2, 0]

Rule 3238

Int[((a_.) + (b_.)*sec[(d_.) + (e_.)*(x_)] + (c_.)*tan[(d_.) + (e_.)*(x_)])^(-1), x_Symbol] :> Int[Cos[d + e*x
]/(b + a*Cos[d + e*x] + c*Sin[d + e*x]), x] /; FreeQ[{a, b, c, d, e}, x]

Rubi steps \begin{align*} \text {integral}& = \int \frac {\cos (x)}{a+b \sin (x)} \, dx \\ & = \frac {\text {Subst}\left (\int \frac {1}{a+x} \, dx,x,b \sin (x)\right )}{b} \\ & = \frac {\log (a+b \sin (x))}{b} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 11, normalized size of antiderivative = 1.00 \[ \int \frac {1}{a \sec (x)+b \tan (x)} \, dx=\frac {\log (a+b \sin (x))}{b} \]

[In]

Integrate[(a*Sec[x] + b*Tan[x])^(-1),x]

[Out]

Log[a + b*Sin[x]]/b

Maple [A] (verified)

Time = 0.55 (sec) , antiderivative size = 12, normalized size of antiderivative = 1.09

method result size
default \(\frac {\ln \left (a +b \sin \left (x \right )\right )}{b}\) \(12\)
risch \(-\frac {i x}{b}+\frac {\ln \left ({\mathrm e}^{2 i x}+\frac {2 i a \,{\mathrm e}^{i x}}{b}-1\right )}{b}\) \(33\)

[In]

int(1/(a*sec(x)+b*tan(x)),x,method=_RETURNVERBOSE)

[Out]

ln(a+b*sin(x))/b

Fricas [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 11, normalized size of antiderivative = 1.00 \[ \int \frac {1}{a \sec (x)+b \tan (x)} \, dx=\frac {\log \left (b \sin \left (x\right ) + a\right )}{b} \]

[In]

integrate(1/(a*sec(x)+b*tan(x)),x, algorithm="fricas")

[Out]

log(b*sin(x) + a)/b

Sympy [B] (verification not implemented)

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

Time = 0.13 (sec) , antiderivative size = 32, normalized size of antiderivative = 2.91 \[ \int \frac {1}{a \sec (x)+b \tan (x)} \, dx=\begin {cases} \frac {\log {\left (\frac {a \sec {\left (x \right )}}{b} + \tan {\left (x \right )} \right )}}{b} - \frac {\log {\left (\tan ^{2}{\left (x \right )} + 1 \right )}}{2 b} & \text {for}\: b \neq 0 \\\frac {\tan {\left (x \right )}}{a \sec {\left (x \right )}} & \text {otherwise} \end {cases} \]

[In]

integrate(1/(a*sec(x)+b*tan(x)),x)

[Out]

Piecewise((log(a*sec(x)/b + tan(x))/b - log(tan(x)**2 + 1)/(2*b), Ne(b, 0)), (tan(x)/(a*sec(x)), True))

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 50 vs. \(2 (11) = 22\).

Time = 0.30 (sec) , antiderivative size = 50, normalized size of antiderivative = 4.55 \[ \int \frac {1}{a \sec (x)+b \tan (x)} \, dx=\frac {\log \left (a + \frac {2 \, b \sin \left (x\right )}{\cos \left (x\right ) + 1} + \frac {a \sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}}\right )}{b} - \frac {\log \left (\frac {\sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}} + 1\right )}{b} \]

[In]

integrate(1/(a*sec(x)+b*tan(x)),x, algorithm="maxima")

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 12, normalized size of antiderivative = 1.09 \[ \int \frac {1}{a \sec (x)+b \tan (x)} \, dx=\frac {\log \left ({\left | b \sin \left (x\right ) + a \right |}\right )}{b} \]

[In]

integrate(1/(a*sec(x)+b*tan(x)),x, algorithm="giac")

[Out]

log(abs(b*sin(x) + a))/b

Mupad [B] (verification not implemented)

Time = 31.00 (sec) , antiderivative size = 55, normalized size of antiderivative = 5.00 \[ \int \frac {1}{a \sec (x)+b \tan (x)} \, dx=\frac {2\,\mathrm {atanh}\left (\frac {b\,\left (2\,a^3\,\sin \left (x\right )+\frac {5\,a^2\,b}{2}-b^3-\frac {a^2\,b\,\cos \left (2\,x\right )}{2}\right )}{{\left (2\,a^2+\sin \left (x\right )\,a\,b-b^2\right )}^2}\right )}{b} \]

[In]

int(1/(b*tan(x) + a/cos(x)),x)

[Out]

(2*atanh((b*(2*a^3*sin(x) + (5*a^2*b)/2 - b^3 - (a^2*b*cos(2*x))/2))/(2*a^2 - b^2 + a*b*sin(x))^2))/b