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

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

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.0272597, antiderivative size = 47, normalized size of antiderivative = 1., number of steps used = 2, number of rules used = 2, integrand size = 19, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.105, Rules used = {3074, 206} \[ -\frac{\tanh ^{-1}\left (\frac{b \cos (c+d x)-a \sin (c+d x)}{\sqrt{a^2+b^2}}\right )}{d \sqrt{a^2+b^2}} \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

Rule 3074

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

Rule 206

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

Rubi steps

\begin{align*} \int \frac{1}{a \cos (c+d x)+b \sin (c+d x)} \, dx &=-\frac{\operatorname{Subst}\left (\int \frac{1}{a^2+b^2-x^2} \, dx,x,b \cos (c+d x)-a \sin (c+d x)\right )}{d}\\ &=-\frac{\tanh ^{-1}\left (\frac{b \cos (c+d x)-a \sin (c+d x)}{\sqrt{a^2+b^2}}\right )}{\sqrt{a^2+b^2} d}\\ \end{align*}

Mathematica [A]  time = 0.0596009, size = 45, normalized size = 0.96 \[ \frac{2 \tanh ^{-1}\left (\frac{a \tan \left (\frac{1}{2} (c+d x)\right )-b}{\sqrt{a^2+b^2}}\right )}{d \sqrt{a^2+b^2}} \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [A]  time = 0.075, size = 43, normalized size = 0.9 \begin{align*} 2\,{\frac{1}{d\sqrt{{a}^{2}+{b}^{2}}}{\it Artanh} \left ( 1/2\,{\frac{2\,\tan \left ( 1/2\,dx+c/2 \right ) a-2\,b}{\sqrt{{a}^{2}+{b}^{2}}}} \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(a*cos(d*x+c)+b*sin(d*x+c)),x)

[Out]

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

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [B]  time = 2.11999, size = 312, normalized size = 6.64 \begin{align*} \frac{\log \left (-\frac{2 \, a b \cos \left (d x + c\right ) \sin \left (d x + c\right ) +{\left (a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, a^{2} - b^{2} + 2 \, \sqrt{a^{2} + b^{2}}{\left (b \cos \left (d x + c\right ) - a \sin \left (d x + c\right )\right )}}{2 \, a b \cos \left (d x + c\right ) \sin \left (d x + c\right ) +{\left (a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} + b^{2}}\right )}{2 \, \sqrt{a^{2} + b^{2}} d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/2*log(-(2*a*b*cos(d*x + c)*sin(d*x + c) + (a^2 - b^2)*cos(d*x + c)^2 - 2*a^2 - b^2 + 2*sqrt(a^2 + b^2)*(b*co
s(d*x + c) - a*sin(d*x + c)))/(2*a*b*cos(d*x + c)*sin(d*x + c) + (a^2 - b^2)*cos(d*x + c)^2 + b^2))/(sqrt(a^2
+ b^2)*d)

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Exception raised: AttributeError

________________________________________________________________________________________

Giac [A]  time = 1.2816, size = 100, normalized size = 2.13 \begin{align*} -\frac{\log \left (\frac{{\left | 2 \, a \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) - 2 \, b - 2 \, \sqrt{a^{2} + b^{2}} \right |}}{{\left | 2 \, a \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) - 2 \, b + 2 \, \sqrt{a^{2} + b^{2}} \right |}}\right )}{\sqrt{a^{2} + b^{2}} d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(a*cos(d*x+c)+b*sin(d*x+c)),x, algorithm="giac")

[Out]

-log(abs(2*a*tan(1/2*d*x + 1/2*c) - 2*b - 2*sqrt(a^2 + b^2))/abs(2*a*tan(1/2*d*x + 1/2*c) - 2*b + 2*sqrt(a^2 +
 b^2)))/(sqrt(a^2 + b^2)*d)