3.4.52 \(\int \frac {A+B \cos (x)}{b \cos (x)+c \sin (x)} \, dx\) [352]

3.4.52.1 Optimal result
3.4.52.2 Mathematica [A] (verified)
3.4.52.3 Rubi [A] (verified)
3.4.52.4 Maple [A] (verified)
3.4.52.5 Fricas [B] (verification not implemented)
3.4.52.6 Sympy [C] (verification not implemented)
3.4.52.7 Maxima [B] (verification not implemented)
3.4.52.8 Giac [A] (verification not implemented)
3.4.52.9 Mupad [B] (verification not implemented)

3.4.52.1 Optimal result

Integrand size = 18, antiderivative size = 73 \[ \int \frac {A+B \cos (x)}{b \cos (x)+c \sin (x)} \, dx=\frac {b B x}{b^2+c^2}-\frac {A \text {arctanh}\left (\frac {c \cos (x)-b \sin (x)}{\sqrt {b^2+c^2}}\right )}{\sqrt {b^2+c^2}}+\frac {B c \log (b \cos (x)+c \sin (x))}{b^2+c^2} \]

output
b*B*x/(b^2+c^2)+B*c*ln(b*cos(x)+c*sin(x))/(b^2+c^2)-A*arctanh((c*cos(x)-b* 
sin(x))/(b^2+c^2)^(1/2))/(b^2+c^2)^(1/2)
 
3.4.52.2 Mathematica [A] (verified)

Time = 0.13 (sec) , antiderivative size = 67, normalized size of antiderivative = 0.92 \[ \int \frac {A+B \cos (x)}{b \cos (x)+c \sin (x)} \, dx=\frac {2 A \text {arctanh}\left (\frac {-c+b \tan \left (\frac {x}{2}\right )}{\sqrt {b^2+c^2}}\right )}{\sqrt {b^2+c^2}}+\frac {B (b x+c \log (b \cos (x)+c \sin (x)))}{b^2+c^2} \]

input
Integrate[(A + B*Cos[x])/(b*Cos[x] + c*Sin[x]),x]
 
output
(2*A*ArcTanh[(-c + b*Tan[x/2])/Sqrt[b^2 + c^2]])/Sqrt[b^2 + c^2] + (B*(b*x 
 + c*Log[b*Cos[x] + c*Sin[x]]))/(b^2 + c^2)
 
3.4.52.3 Rubi [A] (verified)

Time = 0.29 (sec) , antiderivative size = 73, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.278, Rules used = {3042, 3617, 3042, 3553, 219}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {A+B \cos (x)}{b \cos (x)+c \sin (x)} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {A+B \cos (x)}{b \cos (x)+c \sin (x)}dx\)

\(\Big \downarrow \) 3617

\(\displaystyle A \int \frac {1}{b \cos (x)+c \sin (x)}dx+\frac {b B x}{b^2+c^2}+\frac {B c \log (b \cos (x)+c \sin (x))}{b^2+c^2}\)

\(\Big \downarrow \) 3042

\(\displaystyle A \int \frac {1}{b \cos (x)+c \sin (x)}dx+\frac {b B x}{b^2+c^2}+\frac {B c \log (b \cos (x)+c \sin (x))}{b^2+c^2}\)

\(\Big \downarrow \) 3553

\(\displaystyle -A \int \frac {1}{b^2+c^2-(c \cos (x)-b \sin (x))^2}d(c \cos (x)-b \sin (x))+\frac {b B x}{b^2+c^2}+\frac {B c \log (b \cos (x)+c \sin (x))}{b^2+c^2}\)

\(\Big \downarrow \) 219

\(\displaystyle -\frac {A \text {arctanh}\left (\frac {c \cos (x)-b \sin (x)}{\sqrt {b^2+c^2}}\right )}{\sqrt {b^2+c^2}}+\frac {b B x}{b^2+c^2}+\frac {B c \log (b \cos (x)+c \sin (x))}{b^2+c^2}\)

input
Int[(A + B*Cos[x])/(b*Cos[x] + c*Sin[x]),x]
 
output
(b*B*x)/(b^2 + c^2) - (A*ArcTanh[(c*Cos[x] - b*Sin[x])/Sqrt[b^2 + c^2]])/S 
qrt[b^2 + c^2] + (B*c*Log[b*Cos[x] + c*Sin[x]])/(b^2 + c^2)
 

3.4.52.3.1 Defintions of rubi rules used

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

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3553
Int[(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x 
_Symbol] :> Simp[-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 3617
Int[((A_.) + cos[(d_.) + (e_.)*(x_)]*(B_.))/((a_.) + cos[(d_.) + (e_.)*(x_) 
]*(b_.) + (c_.)*sin[(d_.) + (e_.)*(x_)]), x_Symbol] :> Simp[b*B*((d + e*x)/ 
(e*(b^2 + c^2))), x] + (Simp[c*B*(Log[a + b*Cos[d + e*x] + c*Sin[d + e*x]]/ 
(e*(b^2 + c^2))), x] + Simp[(A*(b^2 + c^2) - a*b*B)/(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}, 
 x] && NeQ[b^2 + c^2, 0] && NeQ[A*(b^2 + c^2) - a*b*B, 0]
 
3.4.52.4 Maple [A] (verified)

Time = 0.70 (sec) , antiderivative size = 117, normalized size of antiderivative = 1.60

method result size
default \(\frac {2 B \left (-\frac {c \ln \left (1+\tan \left (\frac {x}{2}\right )^{2}\right )}{2}+b \arctan \left (\tan \left (\frac {x}{2}\right )\right )\right )}{b^{2}+c^{2}}+\frac {B c \ln \left (\tan \left (\frac {x}{2}\right )^{2} b -2 c \tan \left (\frac {x}{2}\right )-b \right )-\frac {2 \left (-A \,b^{2}-A \,c^{2}\right ) \operatorname {arctanh}\left (\frac {2 b \tan \left (\frac {x}{2}\right )-2 c}{2 \sqrt {b^{2}+c^{2}}}\right )}{\sqrt {b^{2}+c^{2}}}}{b^{2}+c^{2}}\) \(117\)
risch \(-\frac {B x}{i c -b}+\frac {2 i B x \,b^{2} c}{-b^{4}-2 b^{2} c^{2}-c^{4}}+\frac {2 i B x \,c^{3}}{-b^{4}-2 b^{2} c^{2}-c^{4}}+\frac {\ln \left ({\mathrm e}^{i x}+\frac {\left (i b -c \right ) \sqrt {A^{2} b^{2}+A^{2} c^{2}}}{A \left (b^{2}+c^{2}\right )}\right ) B c}{b^{2}+c^{2}}+\frac {\ln \left ({\mathrm e}^{i x}+\frac {\left (i b -c \right ) \sqrt {A^{2} b^{2}+A^{2} c^{2}}}{A \left (b^{2}+c^{2}\right )}\right ) \sqrt {A^{2} b^{2}+A^{2} c^{2}}}{b^{2}+c^{2}}+\frac {\ln \left ({\mathrm e}^{i x}-\frac {\left (i b -c \right ) \sqrt {A^{2} b^{2}+A^{2} c^{2}}}{A \left (b^{2}+c^{2}\right )}\right ) B c}{b^{2}+c^{2}}-\frac {\ln \left ({\mathrm e}^{i x}-\frac {\left (i b -c \right ) \sqrt {A^{2} b^{2}+A^{2} c^{2}}}{A \left (b^{2}+c^{2}\right )}\right ) \sqrt {A^{2} b^{2}+A^{2} c^{2}}}{b^{2}+c^{2}}\) \(336\)

input
int((A+B*cos(x))/(b*cos(x)+c*sin(x)),x,method=_RETURNVERBOSE)
 
output
2*B/(b^2+c^2)*(-1/2*c*ln(1+tan(1/2*x)^2)+b*arctan(tan(1/2*x)))+2/(b^2+c^2) 
*(1/2*B*c*ln(tan(1/2*x)^2*b-2*c*tan(1/2*x)-b)-(-A*b^2-A*c^2)/(b^2+c^2)^(1/ 
2)*arctanh(1/2*(2*b*tan(1/2*x)-2*c)/(b^2+c^2)^(1/2)))
 
3.4.52.5 Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 143 vs. \(2 (69) = 138\).

Time = 0.27 (sec) , antiderivative size = 143, normalized size of antiderivative = 1.96 \[ \int \frac {A+B \cos (x)}{b \cos (x)+c \sin (x)} \, dx=\frac {2 \, B b x + B c \log \left (2 \, b c \cos \left (x\right ) \sin \left (x\right ) + {\left (b^{2} - c^{2}\right )} \cos \left (x\right )^{2} + c^{2}\right ) + \sqrt {b^{2} + c^{2}} A \log \left (-\frac {2 \, b c \cos \left (x\right ) \sin \left (x\right ) + {\left (b^{2} - c^{2}\right )} \cos \left (x\right )^{2} - 2 \, b^{2} - c^{2} + 2 \, \sqrt {b^{2} + c^{2}} {\left (c \cos \left (x\right ) - b \sin \left (x\right )\right )}}{2 \, b c \cos \left (x\right ) \sin \left (x\right ) + {\left (b^{2} - c^{2}\right )} \cos \left (x\right )^{2} + c^{2}}\right )}{2 \, {\left (b^{2} + c^{2}\right )}} \]

input
integrate((A+B*cos(x))/(b*cos(x)+c*sin(x)),x, algorithm="fricas")
 
output
1/2*(2*B*b*x + B*c*log(2*b*c*cos(x)*sin(x) + (b^2 - c^2)*cos(x)^2 + c^2) + 
 sqrt(b^2 + c^2)*A*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)))/(b^2 + c^2)
 
3.4.52.6 Sympy [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 10.60 (sec) , antiderivative size = 673, normalized size of antiderivative = 9.22 \[ \int \frac {A+B \cos (x)}{b \cos (x)+c \sin (x)} \, dx=\begin {cases} \tilde {\infty } \left (A \log {\left (\tan {\left (\frac {x}{2} \right )} \right )} - B \log {\left (\tan ^{2}{\left (\frac {x}{2} \right )} + 1 \right )} + B \log {\left (\tan {\left (\frac {x}{2} \right )} \right )}\right ) & \text {for}\: b = 0 \wedge c = 0 \\\frac {A \log {\left (\tan {\left (\frac {x}{2} \right )} \right )} - B \log {\left (\tan ^{2}{\left (\frac {x}{2} \right )} + 1 \right )} + B \log {\left (\tan {\left (\frac {x}{2} \right )} \right )}}{c} & \text {for}\: b = 0 \\- \frac {2 A}{2 i c \sin {\left (x \right )} + 2 c \cos {\left (x \right )}} - \frac {B x \sin {\left (x \right )}}{2 i c \sin {\left (x \right )} + 2 c \cos {\left (x \right )}} + \frac {i B x \cos {\left (x \right )}}{2 i c \sin {\left (x \right )} + 2 c \cos {\left (x \right )}} + \frac {i B \sin {\left (x \right )}}{2 i c \sin {\left (x \right )} + 2 c \cos {\left (x \right )}} & \text {for}\: b = - i c \\- \frac {2 A}{- 2 i c \sin {\left (x \right )} + 2 c \cos {\left (x \right )}} - \frac {B x \sin {\left (x \right )}}{- 2 i c \sin {\left (x \right )} + 2 c \cos {\left (x \right )}} - \frac {i B x \cos {\left (x \right )}}{- 2 i c \sin {\left (x \right )} + 2 c \cos {\left (x \right )}} - \frac {i B \sin {\left (x \right )}}{- 2 i c \sin {\left (x \right )} + 2 c \cos {\left (x \right )}} & \text {for}\: b = i c \\- \frac {A b^{2} \log {\left (\tan {\left (\frac {x}{2} \right )} - \frac {c}{b} - \frac {\sqrt {b^{2} + c^{2}}}{b} \right )}}{b^{2} \sqrt {b^{2} + c^{2}} + c^{2} \sqrt {b^{2} + c^{2}}} + \frac {A b^{2} \log {\left (\tan {\left (\frac {x}{2} \right )} - \frac {c}{b} + \frac {\sqrt {b^{2} + c^{2}}}{b} \right )}}{b^{2} \sqrt {b^{2} + c^{2}} + c^{2} \sqrt {b^{2} + c^{2}}} - \frac {A c^{2} \log {\left (\tan {\left (\frac {x}{2} \right )} - \frac {c}{b} - \frac {\sqrt {b^{2} + c^{2}}}{b} \right )}}{b^{2} \sqrt {b^{2} + c^{2}} + c^{2} \sqrt {b^{2} + c^{2}}} + \frac {A c^{2} \log {\left (\tan {\left (\frac {x}{2} \right )} - \frac {c}{b} + \frac {\sqrt {b^{2} + c^{2}}}{b} \right )}}{b^{2} \sqrt {b^{2} + c^{2}} + c^{2} \sqrt {b^{2} + c^{2}}} + \frac {B b x \sqrt {b^{2} + c^{2}}}{b^{2} \sqrt {b^{2} + c^{2}} + c^{2} \sqrt {b^{2} + c^{2}}} - \frac {B c \sqrt {b^{2} + c^{2}} \log {\left (\tan ^{2}{\left (\frac {x}{2} \right )} + 1 \right )}}{b^{2} \sqrt {b^{2} + c^{2}} + c^{2} \sqrt {b^{2} + c^{2}}} + \frac {B c \sqrt {b^{2} + c^{2}} \log {\left (\tan {\left (\frac {x}{2} \right )} - \frac {c}{b} - \frac {\sqrt {b^{2} + c^{2}}}{b} \right )}}{b^{2} \sqrt {b^{2} + c^{2}} + c^{2} \sqrt {b^{2} + c^{2}}} + \frac {B c \sqrt {b^{2} + c^{2}} \log {\left (\tan {\left (\frac {x}{2} \right )} - \frac {c}{b} + \frac {\sqrt {b^{2} + c^{2}}}{b} \right )}}{b^{2} \sqrt {b^{2} + c^{2}} + c^{2} \sqrt {b^{2} + c^{2}}} & \text {otherwise} \end {cases} \]

input
integrate((A+B*cos(x))/(b*cos(x)+c*sin(x)),x)
 
output
Piecewise((zoo*(A*log(tan(x/2)) - B*log(tan(x/2)**2 + 1) + B*log(tan(x/2)) 
), Eq(b, 0) & Eq(c, 0)), ((A*log(tan(x/2)) - B*log(tan(x/2)**2 + 1) + B*lo 
g(tan(x/2)))/c, Eq(b, 0)), (-2*A/(2*I*c*sin(x) + 2*c*cos(x)) - B*x*sin(x)/ 
(2*I*c*sin(x) + 2*c*cos(x)) + I*B*x*cos(x)/(2*I*c*sin(x) + 2*c*cos(x)) + I 
*B*sin(x)/(2*I*c*sin(x) + 2*c*cos(x)), Eq(b, -I*c)), (-2*A/(-2*I*c*sin(x) 
+ 2*c*cos(x)) - B*x*sin(x)/(-2*I*c*sin(x) + 2*c*cos(x)) - I*B*x*cos(x)/(-2 
*I*c*sin(x) + 2*c*cos(x)) - I*B*sin(x)/(-2*I*c*sin(x) + 2*c*cos(x)), Eq(b, 
 I*c)), (-A*b**2*log(tan(x/2) - c/b - sqrt(b**2 + c**2)/b)/(b**2*sqrt(b**2 
 + c**2) + c**2*sqrt(b**2 + c**2)) + A*b**2*log(tan(x/2) - c/b + sqrt(b**2 
 + c**2)/b)/(b**2*sqrt(b**2 + c**2) + c**2*sqrt(b**2 + c**2)) - A*c**2*log 
(tan(x/2) - c/b - sqrt(b**2 + c**2)/b)/(b**2*sqrt(b**2 + c**2) + c**2*sqrt 
(b**2 + c**2)) + A*c**2*log(tan(x/2) - c/b + sqrt(b**2 + c**2)/b)/(b**2*sq 
rt(b**2 + c**2) + c**2*sqrt(b**2 + c**2)) + B*b*x*sqrt(b**2 + c**2)/(b**2* 
sqrt(b**2 + c**2) + c**2*sqrt(b**2 + c**2)) - B*c*sqrt(b**2 + c**2)*log(ta 
n(x/2)**2 + 1)/(b**2*sqrt(b**2 + c**2) + c**2*sqrt(b**2 + c**2)) + B*c*sqr 
t(b**2 + c**2)*log(tan(x/2) - c/b - sqrt(b**2 + c**2)/b)/(b**2*sqrt(b**2 + 
 c**2) + c**2*sqrt(b**2 + c**2)) + B*c*sqrt(b**2 + c**2)*log(tan(x/2) - c/ 
b + sqrt(b**2 + c**2)/b)/(b**2*sqrt(b**2 + c**2) + c**2*sqrt(b**2 + c**2)) 
, True))
 
3.4.52.7 Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 153 vs. \(2 (69) = 138\).

Time = 0.31 (sec) , antiderivative size = 153, normalized size of antiderivative = 2.10 \[ \int \frac {A+B \cos (x)}{b \cos (x)+c \sin (x)} \, dx=B {\left (\frac {2 \, b \arctan \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1}\right )}{b^{2} + c^{2}} + \frac {c \log \left (-b - \frac {2 \, c \sin \left (x\right )}{\cos \left (x\right ) + 1} + \frac {b \sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}}\right )}{b^{2} + c^{2}} - \frac {c \log \left (\frac {\sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}} + 1\right )}{b^{2} + c^{2}}\right )} - \frac {A \log \left (\frac {c - \frac {b \sin \left (x\right )}{\cos \left (x\right ) + 1} + \sqrt {b^{2} + c^{2}}}{c - \frac {b \sin \left (x\right )}{\cos \left (x\right ) + 1} - \sqrt {b^{2} + c^{2}}}\right )}{\sqrt {b^{2} + c^{2}}} \]

input
integrate((A+B*cos(x))/(b*cos(x)+c*sin(x)),x, algorithm="maxima")
 
output
B*(2*b*arctan(sin(x)/(cos(x) + 1))/(b^2 + c^2) + c*log(-b - 2*c*sin(x)/(co 
s(x) + 1) + b*sin(x)^2/(cos(x) + 1)^2)/(b^2 + c^2) - c*log(sin(x)^2/(cos(x 
) + 1)^2 + 1)/(b^2 + c^2)) - A*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)))/sqrt(b^2 + c^2)
 
3.4.52.8 Giac [A] (verification not implemented)

Time = 0.34 (sec) , antiderivative size = 131, normalized size of antiderivative = 1.79 \[ \int \frac {A+B \cos (x)}{b \cos (x)+c \sin (x)} \, dx=\frac {B b x}{b^{2} + c^{2}} - \frac {B c \log \left (\tan \left (\frac {1}{2} \, x\right )^{2} + 1\right )}{b^{2} + c^{2}} + \frac {B c \log \left ({\left | b \tan \left (\frac {1}{2} \, x\right )^{2} - 2 \, c \tan \left (\frac {1}{2} \, x\right ) - b \right |}\right )}{b^{2} + c^{2}} - \frac {A \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 )}{\sqrt {b^{2} + c^{2}}} \]

input
integrate((A+B*cos(x))/(b*cos(x)+c*sin(x)),x, algorithm="giac")
 
output
B*b*x/(b^2 + c^2) - B*c*log(tan(1/2*x)^2 + 1)/(b^2 + c^2) + B*c*log(abs(b* 
tan(1/2*x)^2 - 2*c*tan(1/2*x) - b))/(b^2 + c^2) - A*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))) 
/sqrt(b^2 + c^2)
 
3.4.52.9 Mupad [B] (verification not implemented)

Time = 33.80 (sec) , antiderivative size = 692, normalized size of antiderivative = 9.48 \[ \int \frac {A+B \cos (x)}{b \cos (x)+c \sin (x)} \, dx=\ln \left (32\,A^2\,B\,b^2-32\,A\,B^2\,b^2-\frac {\left (A\,\sqrt {{\left (b^2+c^2\right )}^3}+B\,c^3+B\,b^2\,c\right )\,\left (32\,b\,\mathrm {tan}\left (\frac {x}{2}\right )\,\left (A^2\,b^2-A^2\,c^2+4\,A\,B\,c^2+B^2\,b^2-3\,B^2\,c^2\right )-64\,A^2\,b^2\,c-32\,B^2\,b^2\,c+\frac {\left (A\,\sqrt {{\left (b^2+c^2\right )}^3}+B\,c^3+B\,b^2\,c\right )\,\left (32\,A\,b^4+32\,B\,b^4+32\,A\,b^2\,c^2-64\,B\,b^2\,c^2+32\,b\,c\,\mathrm {tan}\left (\frac {x}{2}\right )\,\left (2\,A\,b^2+2\,A\,c^2+4\,B\,b^2+B\,c^2\right )+\frac {96\,b\,c\,\left (b+c\,\mathrm {tan}\left (\frac {x}{2}\right )\right )\,\left (A\,\sqrt {{\left (b^2+c^2\right )}^3}+B\,c^3+B\,b^2\,c\right )}{b^2+c^2}\right )}{{\left (b^2+c^2\right )}^2}+64\,A\,B\,b^2\,c\right )}{{\left (b^2+c^2\right )}^2}+32\,B\,b\,c\,\mathrm {tan}\left (\frac {x}{2}\right )\,{\left (A-B\right )}^2\right )\,\left (\frac {B\,c}{b^2+c^2}+\frac {A\,\sqrt {{\left (b^2+c^2\right )}^3}}{{\left (b^2+c^2\right )}^2}\right )+\ln \left (32\,A^2\,B\,b^2-32\,A\,B^2\,b^2-\frac {\left (B\,c^3-A\,\sqrt {{\left (b^2+c^2\right )}^3}+B\,b^2\,c\right )\,\left (32\,b\,\mathrm {tan}\left (\frac {x}{2}\right )\,\left (A^2\,b^2-A^2\,c^2+4\,A\,B\,c^2+B^2\,b^2-3\,B^2\,c^2\right )-64\,A^2\,b^2\,c-32\,B^2\,b^2\,c+\frac {\left (B\,c^3-A\,\sqrt {{\left (b^2+c^2\right )}^3}+B\,b^2\,c\right )\,\left (32\,A\,b^4+32\,B\,b^4+32\,A\,b^2\,c^2-64\,B\,b^2\,c^2+32\,b\,c\,\mathrm {tan}\left (\frac {x}{2}\right )\,\left (2\,A\,b^2+2\,A\,c^2+4\,B\,b^2+B\,c^2\right )+\frac {96\,b\,c\,\left (b+c\,\mathrm {tan}\left (\frac {x}{2}\right )\right )\,\left (B\,c^3-A\,\sqrt {{\left (b^2+c^2\right )}^3}+B\,b^2\,c\right )}{b^2+c^2}\right )}{{\left (b^2+c^2\right )}^2}+64\,A\,B\,b^2\,c\right )}{{\left (b^2+c^2\right )}^2}+32\,B\,b\,c\,\mathrm {tan}\left (\frac {x}{2}\right )\,{\left (A-B\right )}^2\right )\,\left (\frac {B\,c}{b^2+c^2}-\frac {A\,\sqrt {{\left (b^2+c^2\right )}^3}}{{\left (b^2+c^2\right )}^2}\right )-\frac {B\,\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )-\mathrm {i}\right )\,1{}\mathrm {i}}{b+c\,1{}\mathrm {i}}-\frac {B\,\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )+1{}\mathrm {i}\right )}{c+b\,1{}\mathrm {i}} \]

input
int((A + B*cos(x))/(b*cos(x) + c*sin(x)),x)
 
output
log(32*A^2*B*b^2 - 32*A*B^2*b^2 - ((A*((b^2 + c^2)^3)^(1/2) + B*c^3 + B*b^ 
2*c)*(32*b*tan(x/2)*(A^2*b^2 - A^2*c^2 + B^2*b^2 - 3*B^2*c^2 + 4*A*B*c^2) 
- 64*A^2*b^2*c - 32*B^2*b^2*c + ((A*((b^2 + c^2)^3)^(1/2) + B*c^3 + B*b^2* 
c)*(32*A*b^4 + 32*B*b^4 + 32*A*b^2*c^2 - 64*B*b^2*c^2 + 32*b*c*tan(x/2)*(2 
*A*b^2 + 2*A*c^2 + 4*B*b^2 + B*c^2) + (96*b*c*(b + c*tan(x/2))*(A*((b^2 + 
c^2)^3)^(1/2) + B*c^3 + B*b^2*c))/(b^2 + c^2)))/(b^2 + c^2)^2 + 64*A*B*b^2 
*c))/(b^2 + c^2)^2 + 32*B*b*c*tan(x/2)*(A - B)^2)*((B*c)/(b^2 + c^2) + (A* 
((b^2 + c^2)^3)^(1/2))/(b^2 + c^2)^2) + log(32*A^2*B*b^2 - 32*A*B^2*b^2 - 
((B*c^3 - A*((b^2 + c^2)^3)^(1/2) + B*b^2*c)*(32*b*tan(x/2)*(A^2*b^2 - A^2 
*c^2 + B^2*b^2 - 3*B^2*c^2 + 4*A*B*c^2) - 64*A^2*b^2*c - 32*B^2*b^2*c + (( 
B*c^3 - A*((b^2 + c^2)^3)^(1/2) + B*b^2*c)*(32*A*b^4 + 32*B*b^4 + 32*A*b^2 
*c^2 - 64*B*b^2*c^2 + 32*b*c*tan(x/2)*(2*A*b^2 + 2*A*c^2 + 4*B*b^2 + B*c^2 
) + (96*b*c*(b + c*tan(x/2))*(B*c^3 - A*((b^2 + c^2)^3)^(1/2) + B*b^2*c))/ 
(b^2 + c^2)))/(b^2 + c^2)^2 + 64*A*B*b^2*c))/(b^2 + c^2)^2 + 32*B*b*c*tan( 
x/2)*(A - B)^2)*((B*c)/(b^2 + c^2) - (A*((b^2 + c^2)^3)^(1/2))/(b^2 + c^2) 
^2) - (B*log(tan(x/2) - 1i)*1i)/(b + c*1i) - (B*log(tan(x/2) + 1i))/(b*1i 
+ c)