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

Optimal. Leaf size=17 \[ \frac {\sin (x)}{b (b \cos (x)+a \sin (x))} \]

[Out]

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

________________________________________________________________________________________

Rubi [A]
time = 0.01, antiderivative size = 17, normalized size of antiderivative = 1.00, number of steps used = 1, number of rules used = 1, integrand size = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.091, Rules used = {3154} \begin {gather*} \frac {\sin (x)}{b (a \sin (x)+b \cos (x))} \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

Sin[x]/(b*(b*Cos[x] + a*Sin[x]))

Rule 3154

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

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]
time = 0.02, size = 17, normalized size = 1.00 \begin {gather*} \frac {\sin (x)}{b (b \cos (x)+a \sin (x))} \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

Sin[x]/(b*(b*Cos[x] + a*Sin[x]))

________________________________________________________________________________________

Mathics [C] Result contains higher order function than in optimal. Order 9 vs. order 3 in optimal.
time = 206.40, size = 114, normalized size = 6.71 \begin {gather*} \text {Piecewise}\left [\left \{\left \{\text {DirectedInfinity}\left [\text {Tan}\left [x\right ]\right ],a\text {==}0\text {\&\&}b\text {==}0\right \},\left \{\text {DirectedInfinity}\left [\frac {-x \left (-1+\text {Cos}\left [x\right ]\right )^2+x \left (-1+\text {Cos}\left [2 x\right ]\right )+2 \text {Sin}\left [2 x\right ]}{b^2}\right ],a\text {==}\frac {b \left (\text {Tan}\left [\frac {x}{2}\right ]-\frac {1}{\text {Tan}\left [\frac {x}{2}\right ]}\right )}{2}\right \},\left \{\frac {\text {Tan}\left [\frac {x}{2}\right ]-\frac {1}{\text {Tan}\left [\frac {x}{2}\right ]}}{2 a^2},b\text {==}0\right \}\right \},\frac {2 \text {Tan}\left [\frac {x}{2}\right ]}{2 a b \text {Tan}\left [\frac {x}{2}\right ]+b^2-b^2 \text {Tan}\left [\frac {x}{2}\right ]^2}\right ] \end {gather*}

Warning: Unable to verify antiderivative.

[In]

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

[Out]

Piecewise[{{DirectedInfinity[Tan[x]], a == 0 && b == 0}, {DirectedInfinity[(-x (-1 + Cos[x]) ^ 2 + x (-1 + Cos
[2 x]) + 2 Sin[2 x]) / b ^ 2], a == b (Tan[x / 2] - 1 / Tan[x / 2]) / 2}, {(Tan[x / 2] - 1 / Tan[x / 2]) / (2
a ^ 2), b == 0}}, 2 Tan[x / 2] / (2 a b Tan[x / 2] + b ^ 2 - b ^ 2 Tan[x / 2] ^ 2)]

________________________________________________________________________________________

Maple [A]
time = 0.10, size = 14, normalized size = 0.82

method result size
default \(-\frac {1}{a \left (a \tan \left (x \right )+b \right )}\) \(14\)
norman \(\frac {-\frac {1}{a}+\frac {\tan ^{2}\left (\frac {x}{2}\right )}{a}}{-b \left (\tan ^{2}\left (\frac {x}{2}\right )\right )+2 a \tan \left (\frac {x}{2}\right )+b}\) \(38\)
risch \(-\frac {2 i}{\left (a \,{\mathrm e}^{2 i x}+i b \,{\mathrm e}^{2 i x}-a +i b \right ) \left (i b +a \right )}\) \(38\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-1/a/(a*tan(x)+b)

________________________________________________________________________________________

Maxima [A]
time = 0.27, size = 14, normalized size = 0.82 \begin {gather*} -\frac {1}{a^{2} \tan \left (x\right ) + a b} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-1/(a^2*tan(x) + a*b)

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 39 vs. \(2 (17) = 34\).
time = 0.33, size = 39, normalized size = 2.29 \begin {gather*} -\frac {a \cos \left (x\right ) - b \sin \left (x\right )}{{\left (a^{2} b + b^{3}\right )} \cos \left (x\right ) + {\left (a^{3} + a b^{2}\right )} \sin \left (x\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Integral((a*sin(x) + b*cos(x))**(-2), x)

________________________________________________________________________________________

Giac [A]
time = 0.00, size = 13, normalized size = 0.76 \begin {gather*} -\frac {2}{2 a \left (\tan x\cdot a+b\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-1/((a*tan(x) + b)*a)

________________________________________________________________________________________

Mupad [B]
time = 0.63, size = 29, normalized size = 1.71 \begin {gather*} \frac {2\,\mathrm {tan}\left (\frac {x}{2}\right )}{b\,\left (-b\,{\mathrm {tan}\left (\frac {x}{2}\right )}^2+2\,a\,\mathrm {tan}\left (\frac {x}{2}\right )+b\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

(2*tan(x/2))/(b*(b + 2*a*tan(x/2) - b*tan(x/2)^2))

________________________________________________________________________________________