\(\int \frac {\cos (x)}{a^2-b^2 \sin ^2(x)} \, dx\) [13]

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

Optimal result

Integrand size = 18, antiderivative size = 15 \[ \int \frac {\cos (x)}{a^2-b^2 \sin ^2(x)} \, dx=\frac {\text {arctanh}\left (\frac {b \sin (x)}{a}\right )}{a b} \]

[Out]

arctanh(b*sin(x)/a)/a/b

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 15, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.111, Rules used = {3269, 214} \[ \int \frac {\cos (x)}{a^2-b^2 \sin ^2(x)} \, dx=\frac {\text {arctanh}\left (\frac {b \sin (x)}{a}\right )}{a b} \]

[In]

Int[Cos[x]/(a^2 - b^2*Sin[x]^2),x]

[Out]

ArcTanh[(b*Sin[x])/a]/(a*b)

Rule 214

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

Rule 3269

Int[cos[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(p_.), x_Symbol] :> With[{ff = Free
Factors[Sin[e + f*x], x]}, Dist[ff/f, Subst[Int[(1 - ff^2*x^2)^((m - 1)/2)*(a + b*ff^2*x^2)^p, x], x, Sin[e +
f*x]/ff], x]] /; FreeQ[{a, b, e, f, p}, x] && IntegerQ[(m - 1)/2]

Rubi steps \begin{align*} \text {integral}& = \text {Subst}\left (\int \frac {1}{a^2-b^2 x^2} \, dx,x,\sin (x)\right ) \\ & = \frac {\text {arctanh}\left (\frac {b \sin (x)}{a}\right )}{a b} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 15, normalized size of antiderivative = 1.00 \[ \int \frac {\cos (x)}{a^2-b^2 \sin ^2(x)} \, dx=\frac {\text {arctanh}\left (\frac {b \sin (x)}{a}\right )}{a b} \]

[In]

Integrate[Cos[x]/(a^2 - b^2*Sin[x]^2),x]

[Out]

ArcTanh[(b*Sin[x])/a]/(a*b)

Maple [B] (verified)

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

Time = 0.50 (sec) , antiderivative size = 33, normalized size of antiderivative = 2.20

method result size
derivativedivides \(\frac {\ln \left (a +b \sin \left (x \right )\right )}{2 b a}-\frac {\ln \left (-b \sin \left (x \right )+a \right )}{2 b a}\) \(33\)
default \(\frac {\ln \left (a +b \sin \left (x \right )\right )}{2 b a}-\frac {\ln \left (-b \sin \left (x \right )+a \right )}{2 b a}\) \(33\)
parallelrisch \(\frac {-\ln \left (\frac {-b \sin \left (x \right )+a}{\cos \left (x \right )+1}\right )+\ln \left (\frac {a +b \sin \left (x \right )}{\cos \left (x \right )+1}\right )}{2 a b}\) \(41\)
norman \(-\frac {\ln \left (a \left (\tan ^{2}\left (\frac {x}{2}\right )\right )-2 b \tan \left (\frac {x}{2}\right )+a \right )}{2 b a}+\frac {\ln \left (a \left (\tan ^{2}\left (\frac {x}{2}\right )\right )+2 b \tan \left (\frac {x}{2}\right )+a \right )}{2 b a}\) \(54\)
risch \(\frac {\ln \left ({\mathrm e}^{2 i x}+\frac {2 i a \,{\mathrm e}^{i x}}{b}-1\right )}{2 b a}-\frac {\ln \left ({\mathrm e}^{2 i x}-\frac {2 i a \,{\mathrm e}^{i x}}{b}-1\right )}{2 b a}\) \(58\)

[In]

int(cos(x)/(a^2-b^2*sin(x)^2),x,method=_RETURNVERBOSE)

[Out]

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

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 26, normalized size of antiderivative = 1.73 \[ \int \frac {\cos (x)}{a^2-b^2 \sin ^2(x)} \, dx=\frac {\log \left (b \sin \left (x\right ) + a\right ) - \log \left (-b \sin \left (x\right ) + a\right )}{2 \, a b} \]

[In]

integrate(cos(x)/(a^2-b^2*sin(x)^2),x, algorithm="fricas")

[Out]

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

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 44 vs. \(2 (10) = 20\).

Time = 0.25 (sec) , antiderivative size = 44, normalized size of antiderivative = 2.93 \[ \int \frac {\cos (x)}{a^2-b^2 \sin ^2(x)} \, dx=\begin {cases} \frac {\tilde {\infty }}{\sin {\left (x \right )}} & \text {for}\: a = 0 \wedge b = 0 \\\frac {1}{b^{2} \sin {\left (x \right )}} & \text {for}\: a = 0 \\\frac {\sin {\left (x \right )}}{a^{2}} & \text {for}\: b = 0 \\- \frac {\log {\left (- \frac {a}{b} + \sin {\left (x \right )} \right )}}{2 a b} + \frac {\log {\left (\frac {a}{b} + \sin {\left (x \right )} \right )}}{2 a b} & \text {otherwise} \end {cases} \]

[In]

integrate(cos(x)/(a**2-b**2*sin(x)**2),x)

[Out]

Piecewise((zoo/sin(x), Eq(a, 0) & Eq(b, 0)), (1/(b**2*sin(x)), Eq(a, 0)), (sin(x)/a**2, Eq(b, 0)), (-log(-a/b
+ sin(x))/(2*a*b) + log(a/b + sin(x))/(2*a*b), True))

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 33 vs. \(2 (15) = 30\).

Time = 0.21 (sec) , antiderivative size = 33, normalized size of antiderivative = 2.20 \[ \int \frac {\cos (x)}{a^2-b^2 \sin ^2(x)} \, dx=\frac {\log \left (b \sin \left (x\right ) + a\right )}{2 \, a b} - \frac {\log \left (b \sin \left (x\right ) - a\right )}{2 \, a b} \]

[In]

integrate(cos(x)/(a^2-b^2*sin(x)^2),x, algorithm="maxima")

[Out]

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

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 35 vs. \(2 (15) = 30\).

Time = 0.28 (sec) , antiderivative size = 35, normalized size of antiderivative = 2.33 \[ \int \frac {\cos (x)}{a^2-b^2 \sin ^2(x)} \, dx=\frac {\log \left ({\left | b \sin \left (x\right ) + a \right |}\right )}{2 \, a b} - \frac {\log \left ({\left | b \sin \left (x\right ) - a \right |}\right )}{2 \, a b} \]

[In]

integrate(cos(x)/(a^2-b^2*sin(x)^2),x, algorithm="giac")

[Out]

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

Mupad [B] (verification not implemented)

Time = 0.20 (sec) , antiderivative size = 15, normalized size of antiderivative = 1.00 \[ \int \frac {\cos (x)}{a^2-b^2 \sin ^2(x)} \, dx=\frac {\mathrm {atanh}\left (\frac {b\,\sin \left (x\right )}{a}\right )}{a\,b} \]

[In]

int(-cos(x)/(b^2*sin(x)^2 - a^2),x)

[Out]

atanh((b*sin(x))/a)/(a*b)