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

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

Optimal result

Integrand size = 17, antiderivative size = 15 \[ \int \frac {\cos (x)}{a^2+b^2 \sin ^2(x)} \, dx=\frac {\arctan \left (\frac {b \sin (x)}{a}\right )}{a b} \]

[Out]

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

Rubi [A] (verified)

Time = 0.03 (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.118, Rules used = {3269, 211} \[ \int \frac {\cos (x)}{a^2+b^2 \sin ^2(x)} \, dx=\frac {\arctan \left (\frac {b \sin (x)}{a}\right )}{a b} \]

[In]

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

[Out]

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

Rule 211

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/Rt[a/b, 2]], x] /; FreeQ[{a, b}, x]
&& PosQ[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 {\arctan \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 {\arctan \left (\frac {b \sin (x)}{a}\right )}{a b} \]

[In]

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

[Out]

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

Maple [A] (verified)

Time = 0.69 (sec) , antiderivative size = 16, normalized size of antiderivative = 1.07

method result size
derivativedivides \(\frac {\arctan \left (\frac {b \sin \left (x \right )}{a}\right )}{a b}\) \(16\)
default \(\frac {\arctan \left (\frac {b \sin \left (x \right )}{a}\right )}{a b}\) \(16\)
parallelrisch \(-\frac {i \left (-\ln \left (\frac {-i b \sin \left (x \right )+a}{\cos \left (x \right )+1}\right )+\ln \left (\frac {i b \sin \left (x \right )+a}{\cos \left (x \right )+1}\right )\right )}{2 a b}\) \(45\)
risch \(-\frac {i \ln \left ({\mathrm e}^{2 i x}+\frac {2 a \,{\mathrm e}^{i x}}{b}-1\right )}{2 a b}+\frac {i \ln \left ({\mathrm e}^{2 i x}-\frac {2 a \,{\mathrm e}^{i x}}{b}-1\right )}{2 a b}\) \(58\)

[In]

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

[Out]

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

Fricas [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Sympy [B] (verification not implemented)

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

Time = 0.22 (sec) , antiderivative size = 31, normalized size of antiderivative = 2.07 \[ \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 {\operatorname {atan}{\left (\frac {b \sin {\left (x \right )}}{a} \right )}}{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)), (atan(b*si
n(x)/a)/(a*b), True))

Maxima [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

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

[In]

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

[Out]

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