3.533 \(\int \frac {A+B \cos (x)+C \sin (x)}{(b \cos (x)+c \sin (x))^2} \, dx\)

Optimal. Leaf size=85 \[ -\frac {-A b \sin (x)+A c \cos (x)-b C+B c}{\left (b^2+c^2\right ) (b \cos (x)+c \sin (x))}-\frac {(b B+c C) \tanh ^{-1}\left (\frac {c \cos (x)-b \sin (x)}{\sqrt {b^2+c^2}}\right )}{\left (b^2+c^2\right )^{3/2}} \]

[Out]

-(B*b+C*c)*arctanh((c*cos(x)-b*sin(x))/(b^2+c^2)^(1/2))/(b^2+c^2)^(3/2)+(-B*c+b*C-A*c*cos(x)+A*b*sin(x))/(b^2+
c^2)/(b*cos(x)+c*sin(x))

________________________________________________________________________________________

Rubi [A]  time = 0.06, antiderivative size = 85, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 22, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.136, Rules used = {3153, 3074, 206} \[ -\frac {-A b \sin (x)+A c \cos (x)-b C+B c}{\left (b^2+c^2\right ) (b \cos (x)+c \sin (x))}-\frac {(b B+c C) \tanh ^{-1}\left (\frac {c \cos (x)-b \sin (x)}{\sqrt {b^2+c^2}}\right )}{\left (b^2+c^2\right )^{3/2}} \]

Antiderivative was successfully verified.

[In]

Int[(A + B*Cos[x] + C*Sin[x])/(b*Cos[x] + c*Sin[x])^2,x]

[Out]

-(((b*B + c*C)*ArcTanh[(c*Cos[x] - b*Sin[x])/Sqrt[b^2 + c^2]])/(b^2 + c^2)^(3/2)) - (B*c - b*C + A*c*Cos[x] -
A*b*Sin[x])/((b^2 + c^2)*(b*Cos[x] + c*Sin[x]))

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])

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 3153

Int[((A_.) + cos[(d_.) + (e_.)*(x_)]*(B_.) + (C_.)*sin[(d_.) + (e_.)*(x_)])/((a_.) + cos[(d_.) + (e_.)*(x_)]*(
b_.) + (c_.)*sin[(d_.) + (e_.)*(x_)])^2, x_Symbol] :> Simp[(c*B - b*C - (a*C - c*A)*Cos[d + e*x] + (a*B - b*A)
*Sin[d + e*x])/(e*(a^2 - b^2 - c^2)*(a + b*Cos[d + e*x] + c*Sin[d + e*x])), x] + Dist[(a*A - b*B - c*C)/(a^2 -
 b^2 - c^2), Int[1/(a + b*Cos[d + e*x] + c*Sin[d + e*x]), x], x] /; FreeQ[{a, b, c, d, e, A, B, C}, x] && NeQ[
a^2 - b^2 - c^2, 0] && NeQ[a*A - b*B - c*C, 0]

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]  time = 0.28, size = 92, normalized size = 1.08 \[ \frac {A \left (b^2+c^2\right ) \sin (x)+b (b C-B c)}{b \left (b^2+c^2\right ) (b \cos (x)+c \sin (x))}+\frac {2 (b B+c C) \tanh ^{-1}\left (\frac {b \tan \left (\frac {x}{2}\right )-c}{\sqrt {b^2+c^2}}\right )}{\left (b^2+c^2\right )^{3/2}} \]

Antiderivative was successfully verified.

[In]

Integrate[(A + B*Cos[x] + C*Sin[x])/(b*Cos[x] + c*Sin[x])^2,x]

[Out]

(2*(b*B + c*C)*ArcTanh[(-c + b*Tan[x/2])/Sqrt[b^2 + c^2]])/(b^2 + c^2)^(3/2) + (b*(-(B*c) + b*C) + A*(b^2 + c^
2)*Sin[x])/(b*(b^2 + c^2)*(b*Cos[x] + c*Sin[x]))

________________________________________________________________________________________

fricas [B]  time = 3.02, size = 226, normalized size = 2.66 \[ \frac {2 \, C b^{3} - 2 \, B b^{2} c + 2 \, C b c^{2} - 2 \, B c^{3} + \sqrt {b^{2} + c^{2}} {\left ({\left (B b^{2} + C b c\right )} \cos \relax (x) + {\left (B b c + C c^{2}\right )} \sin \relax (x)\right )} \log \left (-\frac {2 \, b c \cos \relax (x) \sin \relax (x) + {\left (b^{2} - c^{2}\right )} \cos \relax (x)^{2} - 2 \, b^{2} - c^{2} + 2 \, \sqrt {b^{2} + c^{2}} {\left (c \cos \relax (x) - b \sin \relax (x)\right )}}{2 \, b c \cos \relax (x) \sin \relax (x) + {\left (b^{2} - c^{2}\right )} \cos \relax (x)^{2} + c^{2}}\right ) - 2 \, {\left (A b^{2} c + A c^{3}\right )} \cos \relax (x) + 2 \, {\left (A b^{3} + A b c^{2}\right )} \sin \relax (x)}{2 \, {\left ({\left (b^{5} + 2 \, b^{3} c^{2} + b c^{4}\right )} \cos \relax (x) + {\left (b^{4} c + 2 \, b^{2} c^{3} + c^{5}\right )} \sin \relax (x)\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*cos(x)+C*sin(x))/(b*cos(x)+c*sin(x))^2,x, algorithm="fricas")

[Out]

1/2*(2*C*b^3 - 2*B*b^2*c + 2*C*b*c^2 - 2*B*c^3 + sqrt(b^2 + c^2)*((B*b^2 + C*b*c)*cos(x) + (B*b*c + C*c^2)*sin
(x))*log(-(2*b*c*cos(x)*sin(x) + (b^2 - c^2)*cos(x)^2 - 2*b^2 - c^2 + 2*sqrt(b^2 + c^2)*(c*cos(x) - b*sin(x)))
/(2*b*c*cos(x)*sin(x) + (b^2 - c^2)*cos(x)^2 + c^2)) - 2*(A*b^2*c + A*c^3)*cos(x) + 2*(A*b^3 + A*b*c^2)*sin(x)
)/((b^5 + 2*b^3*c^2 + b*c^4)*cos(x) + (b^4*c + 2*b^2*c^3 + c^5)*sin(x))

________________________________________________________________________________________

giac [A]  time = 0.23, size = 150, normalized size = 1.76 \[ -\frac {{\left (B b + C c\right )} \log \left (\frac {{\left | 2 \, b \tan \left (\frac {1}{2} \, x\right ) - 2 \, c - 2 \, \sqrt {b^{2} + c^{2}} \right |}}{{\left | 2 \, b \tan \left (\frac {1}{2} \, x\right ) - 2 \, c + 2 \, \sqrt {b^{2} + c^{2}} \right |}}\right )}{{\left (b^{2} + c^{2}\right )}^{\frac {3}{2}}} - \frac {2 \, {\left (A b^{2} \tan \left (\frac {1}{2} \, x\right ) + C b c \tan \left (\frac {1}{2} \, x\right ) + A c^{2} \tan \left (\frac {1}{2} \, x\right ) - B c^{2} \tan \left (\frac {1}{2} \, x\right ) + C b^{2} - B b c\right )}}{{\left (b^{3} + b c^{2}\right )} {\left (b \tan \left (\frac {1}{2} \, x\right )^{2} - 2 \, c \tan \left (\frac {1}{2} \, x\right ) - b\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*cos(x)+C*sin(x))/(b*cos(x)+c*sin(x))^2,x, algorithm="giac")

[Out]

-(B*b + C*c)*log(abs(2*b*tan(1/2*x) - 2*c - 2*sqrt(b^2 + c^2))/abs(2*b*tan(1/2*x) - 2*c + 2*sqrt(b^2 + c^2)))/
(b^2 + c^2)^(3/2) - 2*(A*b^2*tan(1/2*x) + C*b*c*tan(1/2*x) + A*c^2*tan(1/2*x) - B*c^2*tan(1/2*x) + C*b^2 - B*b
*c)/((b^3 + b*c^2)*(b*tan(1/2*x)^2 - 2*c*tan(1/2*x) - b))

________________________________________________________________________________________

maple [A]  time = 0.17, size = 124, normalized size = 1.46 \[ \frac {-\frac {2 \left (A \,b^{2}+A \,c^{2}-B \,c^{2}+C b c \right ) \tan \left (\frac {x}{2}\right )}{b \left (b^{2}+c^{2}\right )}+\frac {2 \left (B c -b C \right )}{b^{2}+c^{2}}}{b \left (\tan ^{2}\left (\frac {x}{2}\right )\right )-2 c \tan \left (\frac {x}{2}\right )-b}+\frac {2 \left (b B +C c \right ) \arctanh \left (\frac {2 b \tan \left (\frac {x}{2}\right )-2 c}{2 \sqrt {b^{2}+c^{2}}}\right )}{\left (b^{2}+c^{2}\right )^{\frac {3}{2}}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((A+B*cos(x)+C*sin(x))/(b*cos(x)+c*sin(x))^2,x)

[Out]

2*(-(A*b^2+A*c^2-B*c^2+C*b*c)/b/(b^2+c^2)*tan(1/2*x)+(B*c-C*b)/(b^2+c^2))/(b*tan(1/2*x)^2-2*c*tan(1/2*x)-b)+2*
(B*b+C*c)/(b^2+c^2)^(3/2)*arctanh(1/2*(2*b*tan(1/2*x)-2*c)/(b^2+c^2)^(1/2))

________________________________________________________________________________________

maxima [B]  time = 0.42, size = 286, normalized size = 3.36 \[ -B {\left (\frac {b \log \left (\frac {c - \frac {b \sin \relax (x)}{\cos \relax (x) + 1} + \sqrt {b^{2} + c^{2}}}{c - \frac {b \sin \relax (x)}{\cos \relax (x) + 1} - \sqrt {b^{2} + c^{2}}}\right )}{{\left (b^{2} + c^{2}\right )}^{\frac {3}{2}}} + \frac {2 \, {\left (b c + \frac {c^{2} \sin \relax (x)}{\cos \relax (x) + 1}\right )}}{b^{4} + b^{2} c^{2} + \frac {2 \, {\left (b^{3} c + b c^{3}\right )} \sin \relax (x)}{\cos \relax (x) + 1} - \frac {{\left (b^{4} + b^{2} c^{2}\right )} \sin \relax (x)^{2}}{{\left (\cos \relax (x) + 1\right )}^{2}}}\right )} - C {\left (\frac {c \log \left (\frac {c - \frac {b \sin \relax (x)}{\cos \relax (x) + 1} + \sqrt {b^{2} + c^{2}}}{c - \frac {b \sin \relax (x)}{\cos \relax (x) + 1} - \sqrt {b^{2} + c^{2}}}\right )}{{\left (b^{2} + c^{2}\right )}^{\frac {3}{2}}} - \frac {2 \, {\left (b + \frac {c \sin \relax (x)}{\cos \relax (x) + 1}\right )}}{b^{3} + b c^{2} + \frac {2 \, {\left (b^{2} c + c^{3}\right )} \sin \relax (x)}{\cos \relax (x) + 1} - \frac {{\left (b^{3} + b c^{2}\right )} \sin \relax (x)^{2}}{{\left (\cos \relax (x) + 1\right )}^{2}}}\right )} - \frac {A}{c^{2} \tan \relax (x) + b c} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*cos(x)+C*sin(x))/(b*cos(x)+c*sin(x))^2,x, algorithm="maxima")

[Out]

-B*(b*log((c - b*sin(x)/(cos(x) + 1) + sqrt(b^2 + c^2))/(c - b*sin(x)/(cos(x) + 1) - sqrt(b^2 + c^2)))/(b^2 +
c^2)^(3/2) + 2*(b*c + c^2*sin(x)/(cos(x) + 1))/(b^4 + b^2*c^2 + 2*(b^3*c + b*c^3)*sin(x)/(cos(x) + 1) - (b^4 +
 b^2*c^2)*sin(x)^2/(cos(x) + 1)^2)) - C*(c*log((c - b*sin(x)/(cos(x) + 1) + sqrt(b^2 + c^2))/(c - b*sin(x)/(co
s(x) + 1) - sqrt(b^2 + c^2)))/(b^2 + c^2)^(3/2) - 2*(b + c*sin(x)/(cos(x) + 1))/(b^3 + b*c^2 + 2*(b^2*c + c^3)
*sin(x)/(cos(x) + 1) - (b^3 + b*c^2)*sin(x)^2/(cos(x) + 1)^2)) - A/(c^2*tan(x) + b*c)

________________________________________________________________________________________

mupad [B]  time = 3.05, size = 141, normalized size = 1.66 \[ -\frac {\frac {2\,\left (B\,c-C\,b\right )}{b^2+c^2}-\frac {2\,\mathrm {tan}\left (\frac {x}{2}\right )\,\left (A\,b^2+A\,c^2-B\,c^2+C\,b\,c\right )}{b\,\left (b^2+c^2\right )}}{-b\,{\mathrm {tan}\left (\frac {x}{2}\right )}^2+2\,c\,\mathrm {tan}\left (\frac {x}{2}\right )+b}+\frac {\mathrm {atan}\left (\frac {b^2\,c\,1{}\mathrm {i}+c^3\,1{}\mathrm {i}-b\,\mathrm {tan}\left (\frac {x}{2}\right )\,\left (b^2+c^2\right )\,1{}\mathrm {i}}{{\left (b^2+c^2\right )}^{3/2}}\right )\,\left (B\,b+C\,c\right )\,2{}\mathrm {i}}{{\left (b^2+c^2\right )}^{3/2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((A + B*cos(x) + C*sin(x))/(b*cos(x) + c*sin(x))^2,x)

[Out]

(atan((b^2*c*1i + c^3*1i - b*tan(x/2)*(b^2 + c^2)*1i)/(b^2 + c^2)^(3/2))*(B*b + C*c)*2i)/(b^2 + c^2)^(3/2) - (
(2*(B*c - C*b))/(b^2 + c^2) - (2*tan(x/2)*(A*b^2 + A*c^2 - B*c^2 + C*b*c))/(b*(b^2 + c^2)))/(b + 2*c*tan(x/2)
- b*tan(x/2)^2)

________________________________________________________________________________________

sympy [F(-1)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Timed out} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*cos(x)+C*sin(x))/(b*cos(x)+c*sin(x))**2,x)

[Out]

Timed out

________________________________________________________________________________________