3.250 \(\int \frac{1}{b \cos (x)+a \sin (x)} \, dx\)

Optimal. Leaf size=36 \[ -\frac{\tanh ^{-1}\left (\frac{a \cos (x)-b \sin (x)}{\sqrt{a^2+b^2}}\right )}{\sqrt{a^2+b^2}} \]

[Out]

-(ArcTanh[(a*Cos[x] - b*Sin[x])/Sqrt[a^2 + b^2]]/Sqrt[a^2 + b^2])

_______________________________________________________________________________________

Rubi [A]  time = 0.0412535, antiderivative size = 36, normalized size of antiderivative = 1., number of steps used = 2, number of rules used = 2, integrand size = 11, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.182 \[ -\frac{\tanh ^{-1}\left (\frac{a \cos (x)-b \sin (x)}{\sqrt{a^2+b^2}}\right )}{\sqrt{a^2+b^2}} \]

Antiderivative was successfully verified.

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

[Out]

-(ArcTanh[(a*Cos[x] - b*Sin[x])/Sqrt[a^2 + b^2]]/Sqrt[a^2 + b^2])

_______________________________________________________________________________________

Rubi in Sympy [A]  time = 2.18447, size = 32, normalized size = 0.89 \[ - \frac{\operatorname{atanh}{\left (\frac{a \cos{\left (x \right )} - b \sin{\left (x \right )}}{\sqrt{a^{2} + b^{2}}} \right )}}{\sqrt{a^{2} + b^{2}}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  rubi_integrate(1/(b*cos(x)+a*sin(x)),x)

[Out]

-atanh((a*cos(x) - b*sin(x))/sqrt(a**2 + b**2))/sqrt(a**2 + b**2)

_______________________________________________________________________________________

Mathematica [A]  time = 0.0564802, size = 38, normalized size = 1.06 \[ \frac{2 \tanh ^{-1}\left (\frac{b \tan \left (\frac{x}{2}\right )-a}{\sqrt{a^2+b^2}}\right )}{\sqrt{a^2+b^2}} \]

Antiderivative was successfully verified.

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

[Out]

(2*ArcTanh[(-a + b*Tan[x/2])/Sqrt[a^2 + b^2]])/Sqrt[a^2 + b^2]

_______________________________________________________________________________________

Maple [A]  time = 0.071, size = 35, normalized size = 1. \[ 2\,{\frac{1}{\sqrt{{a}^{2}+{b}^{2}}}{\it Artanh} \left ( 1/2\,{\frac{2\,b\tan \left ( x/2 \right ) -2\,a}{\sqrt{{a}^{2}+{b}^{2}}}} \right ) } \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  int(1/(b*cos(x)+a*sin(x)),x)

[Out]

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

_______________________________________________________________________________________

Maxima [F]  time = 0., size = 0, normalized size = 0. \[ \text{Exception raised: ValueError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate(1/(b*cos(x) + a*sin(x)),x, algorithm="maxima")

[Out]

Exception raised: ValueError

_______________________________________________________________________________________

Fricas [A]  time = 0.234516, size = 154, normalized size = 4.28 \[ \frac{\log \left (-\frac{2 \,{\left (a^{3} + a b^{2}\right )} \cos \left (x\right ) - 2 \,{\left (a^{2} b + b^{3}\right )} \sin \left (x\right ) +{\left (2 \, a b \cos \left (x\right ) \sin \left (x\right ) -{\left (a^{2} - b^{2}\right )} \cos \left (x\right )^{2} - a^{2} - 2 \, b^{2}\right )} \sqrt{a^{2} + b^{2}}}{2 \, a b \cos \left (x\right ) \sin \left (x\right ) -{\left (a^{2} - b^{2}\right )} \cos \left (x\right )^{2} + a^{2}}\right )}{2 \, \sqrt{a^{2} + b^{2}}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate(1/(b*cos(x) + a*sin(x)),x, algorithm="fricas")

[Out]

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

_______________________________________________________________________________________

Sympy [F(-2)]  time = 0., size = 0, normalized size = 0. \[ \text{Exception raised: AttributeError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate(1/(b*cos(x)+a*sin(x)),x)

[Out]

Exception raised: AttributeError

_______________________________________________________________________________________

GIAC/XCAS [A]  time = 0.224888, size = 82, normalized size = 2.28 \[ -\frac{{\rm ln}\left (\frac{{\left | 2 \, b \tan \left (\frac{1}{2} \, x\right ) - 2 \, a - 2 \, \sqrt{a^{2} + b^{2}} \right |}}{{\left | 2 \, b \tan \left (\frac{1}{2} \, x\right ) - 2 \, a + 2 \, \sqrt{a^{2} + b^{2}} \right |}}\right )}{\sqrt{a^{2} + b^{2}}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate(1/(b*cos(x) + a*sin(x)),x, algorithm="giac")

[Out]

-ln(abs(2*b*tan(1/2*x) - 2*a - 2*sqrt(a^2 + b^2))/abs(2*b*tan(1/2*x) - 2*a + 2*s
qrt(a^2 + b^2)))/sqrt(a^2 + b^2)